Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename bitswap-transfer example #662

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Once you have your example finished, do not forget to run `go mod tidy` and addi

## Examples and Tutorials

- [Fetching a UnixFS file by CID](./unixfs-file-cid)
- [Transfering UnixFS file data with Bitswap](./bitswap-transfer)
- [Gateway backed by a local blockstore in form of a CAR file](./gateway/car-file)
- [Gateway backed by a remote (HTTP) blockstore and IPNS resolver](./gateway/proxy-blocks)
- [Gateway backed by a remote (HTTP) CAR Gateway](./gateway/proxy-car)
Expand Down
1 change: 1 addition & 0 deletions examples/bitswap-transfer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bitswap-transfer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Downloading a UnixFS file
# Transfering UnixFS file with Bitswap

This is an example that quickly shows how to use IPFS tooling to move around a file.

Expand All @@ -13,26 +13,26 @@ In client mode, it will start up, connect to the server, request the data needed
From the `boxo/examples` directory run the following:

```
> cd unixfs-file-cid/
> cd bitswap-transfer/
> go build
```

## Usage

```
> ./unixfs-file-cid
> ./bitswap-transfer
2023/01/30 21:34:11 I am /ip4/127.0.0.1/tcp/53935/p2p/QmUtp8xEVgWC5dNPthF2g37eVvCdrqY1FPxLxXZoKkPbdp
2023/01/30 21:34:11 hosting UnixFS file with CID: bafybeiecq2irw4fl5vunnxo6cegoutv4de63h7n27tekkjtak3jrvrzzhe
2023/01/30 21:34:11 listening for inbound connections and Bitswap requests
2023/01/30 21:34:11 Now run "./unixfs-file-cid -d /ip4/127.0.0.1/tcp/53935/p2p/QmUtp8xEVgWC5dNPthF2g37eVvCdrqY1FPxLxXZoKkPbdp" on a different terminal
2023/01/30 21:34:11 Now run "./bitswap-transfer -d /ip4/127.0.0.1/tcp/53935/p2p/QmUtp8xEVgWC5dNPthF2g37eVvCdrqY1FPxLxXZoKkPbdp" on a different terminal
```

The IPFS server hosting the data over libp2p will print out its `Multiaddress`, which indicates how it can be reached (ip4+tcp) and its randomly generated ID (`QmUtp8xEV...`)

Now, launch another node that talks to the hosting node:

```
> ./unixfs-file-cid -d /ip4/127.0.0.1/tcp/53935/p2p/QmUtp8xEVgWC5dNPthF2g37eVvCdrqY1FPxLxXZoKkPbdp
> ./bitswap-transfer -d /ip4/127.0.0.1/tcp/53935/p2p/QmUtp8xEVgWC5dNPthF2g37eVvCdrqY1FPxLxXZoKkPbdp
```

The IPFS client will then download the file from the server peer and let you know that it's been received.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (
"github.com/ipfs/boxo/files"
)

const exampleBinaryName = "unixfs-file-cid"
const exampleBinaryName = "bitswap-transfer"

func main() {
ctx, cancel := context.WithCancel(context.Background())
Expand Down
Loading