Skip to content

Commit 3b59419

Browse files
committed
Update code and typo
1 parent 59ffaf3 commit 3b59419

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

src/app/docs/tour/3-discovery/page.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ There are different implementations of the discovery service in iroh, the most p
1111
Iroh endpoints come with some defaults that include using our public infrastructure to enable discovery:
1212

1313
```rust
14-
use iroh::{Endpoint, RelayMode};
14+
use iroh::Endpoint;
1515

1616
#[tokio::main]
1717
async fn main() -> anyhow::Result<()> {
18-
let builder = Endpoint::.bind().await?;
18+
let endpoint = Endpoint::bind().await?;
1919

2020
println!("endpoint id: {:?}", endpoint.id());
2121
Ok(())
@@ -45,7 +45,7 @@ tokio = "1.43.0"
4545
And with that we can set up local discovery, alongside our default discovery:
4646

4747
```rust
48-
use iroh::{Endpoint, RelayMode, SecretKey};
48+
use iroh::Endpoint;
4949

5050
#[tokio::main]
5151
async fn main() -> anyhow::Result<()> {

src/app/docs/tour/4-protocols/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Coming from the world of HTTP client/server models, protocols are kinda like req
1111
Protocols are an ever-growing topic, but to give you a basic idea, let's add the [blobs](/proto/iroh-blobs) protocol. First we need to add it to our dependencies:
1212

1313
```
14-
cargo add iroh-blobs --features=rpc
14+
cargo add iroh-blobs
1515
```
1616

1717
then adjust our code:

src/app/docs/tour/5-routers/page.mdx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,26 @@ Then we can setup gossip & add it to our router:
1414

1515
```rust
1616
use iroh::{protocol::Router, Endpoint};
17-
use iroh_blobs::net_protocol::Blobs;
18-
use iroh_gossip::{net::Gossip, ALPN};
17+
use iroh_blobs::{store::mem::MemStore, BlobsProtocol};
18+
use iroh_gossip::Gossip;
1919

2020
#[tokio::main]
2121
async fn main() -> anyhow::Result<()> {
22-
let endpoint = Endpoint::bind().await?;
23-
24-
let blobs = Blobs::memory().build(&endpoint);
25-
26-
let gossip = Gossip::builder().spawn(endpoint.clone()).await?;
27-
28-
// build the router
29-
let router = Router::builder(endpoint)
30-
.accept(iroh_blobs::ALPN, blobs.clone())
31-
.accept(iroh_gossip::ALPN, gossip.clone())
22+
let endpoint= Endpoint::bind().await?;
23+
let store=MemStore::new();
24+
let blobs=BlobsProtocol::new(&store,None);
25+
26+
let gossip=Gossip::builder().spawn(endpoint.clone());
27+
28+
29+
//build the router
30+
let router=Router::builder(endpoint)
31+
.accept(iroh_blobs::ALPN, blobs)
32+
.accept(iroh_gossip::ALPN, gossip)
3233
.spawn();
33-
34+
3435
router.shutdown().await?;
36+
3537
Ok(())
3638
}
3739
```

0 commit comments

Comments
 (0)