You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/app/docs/quickstart/page.mdx
+39-7Lines changed: 39 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@ export const metadata = {
7
7
8
8
# Quickstart
9
9
10
-
Let's dive into iroh by building a simple peer-to-peer file transfer tool in rust.{{ className: 'lead' }}
10
+
Let's dive into iroh by building a simple peer-to-peer file transfer tool in rust!{{ className: 'lead' }}
11
11
12
12
13
13
## What we'll build
14
14
15
-
At the end we should be able to transfer a file from one device that has it by running this:
15
+
At the end we should be able to transfer a file from one device by running this:
16
16
17
17
```sh
18
18
$ cargo run -- send ./file.txt
@@ -21,7 +21,7 @@ File analyzed. Fetch this file by running:
21
21
cargo run -- receive blobabvojvy[...] file.txt
22
22
```
23
23
24
-
And then on any other device running this:
24
+
And then fetch it on any other device like so:
25
25
```sh
26
26
$ cargo run -- receive blobabvojvy[...] file.txt
27
27
Starting download.
@@ -31,7 +31,7 @@ Finished copying.
31
31
Shutting down.
32
32
```
33
33
34
-
In this guide we'll be omitting the imports statements required to get this working.
34
+
In this guide we'll be omitting the import statements required to get this working.
35
35
If you're ever confused about what to import, take a look at the imports in the [complete example](https://github.com/n0-computer/iroh-blobs/blob/main/examples/transfer.rs).
36
36
37
37
@@ -66,9 +66,9 @@ There we go, this is all we need to [open connections](https://docs.rs/iroh/late
66
66
67
67
<Note>
68
68
Here, we're specifically configuring the `Endpoint`'s builder to include "number 0 discovery".
69
-
This makes it connect to DNS servers that number 0 runs to find which relay to talk to for specific `NodeId`s.
69
+
This makes it connect to DNS servers that [number 0](https://n0.computer) runs to find which relay to talk to for specific `NodeId`s.
70
70
It's a great default!
71
-
But if you want to, you can add other discovery types like [`discovery_local_network`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.discovery_local_network) based on mDNS, or [`discovery_dht`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.discovery_dht) for discovery based on the bit-torrent mainline DHT.
71
+
But if you want to, you can add other discovery types like [`discovery_local_network`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.discovery_local_network) based on mDNS, or [`discovery_dht`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.discovery_dht) for discovery based on the bittorrent mainline DHT.
72
72
73
73
If all of this is too much magic for your taste, it's possible for the endpoint to work entirely without any discovery services.
74
74
In that case, you'll need to make sure you're not only dialing by `NodeId`, but also help the `Endpoint` out with giving it the whole [`NodeAddr`](https://docs.rs/iroh/latest/iroh/struct.NodeAddr.html) when connecting.
@@ -189,7 +189,15 @@ Now all we need to do is fill in the `todo!()`s one-by-one:
189
189
190
190
### Getting ready to send
191
191
192
+
If we want to make a file available over the network with iroh-blobs, we first need to index this file.
192
193
194
+
<Note>
195
+
What does this step do?
196
+
197
+
It hashes the file using BLAKE3 and stores a so-called "outboard" for that file.
198
+
This outboard file contains information about hashes for parts of this file.
199
+
All of this enables some extra features with iroh-blobs like automatically verifying the integrity of the file *during* streaming, verified range downloads and download resumption.
This first download the file completely into memory, then copy that memory into a file in two steps.
267
+
268
+
There's ways to make this work without having to store the whole file in memory, but that involves setting up `Blobs::persistent` instead of `Blobs::memory` and using `blobs.export` with `EntryMode::TryReference`.
269
+
We'll leave these changes as an excercise to the reader 😉
0 commit comments