From 3b59419601623202e7f640e4a323828c1dbc827c Mon Sep 17 00:00:00 2001 From: Anonymous-AAA Date: Thu, 23 Oct 2025 08:59:20 +0530 Subject: [PATCH 1/5] Update code and typo --- src/app/docs/tour/3-discovery/page.mdx | 6 +++--- src/app/docs/tour/4-protocols/page.mdx | 2 +- src/app/docs/tour/5-routers/page.mdx | 28 ++++++++++++++------------ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/app/docs/tour/3-discovery/page.mdx b/src/app/docs/tour/3-discovery/page.mdx index f255b99d..02994cb8 100644 --- a/src/app/docs/tour/3-discovery/page.mdx +++ b/src/app/docs/tour/3-discovery/page.mdx @@ -11,11 +11,11 @@ There are different implementations of the discovery service in iroh, the most p Iroh endpoints come with some defaults that include using our public infrastructure to enable discovery: ```rust -use iroh::{Endpoint, RelayMode}; +use iroh::Endpoint; #[tokio::main] async fn main() -> anyhow::Result<()> { - let builder = Endpoint::.bind().await?; + let endpoint = Endpoint::bind().await?; println!("endpoint id: {:?}", endpoint.id()); Ok(()) @@ -45,7 +45,7 @@ tokio = "1.43.0" And with that we can set up local discovery, alongside our default discovery: ```rust -use iroh::{Endpoint, RelayMode, SecretKey}; +use iroh::Endpoint; #[tokio::main] async fn main() -> anyhow::Result<()> { diff --git a/src/app/docs/tour/4-protocols/page.mdx b/src/app/docs/tour/4-protocols/page.mdx index 3f072433..748d9b2e 100644 --- a/src/app/docs/tour/4-protocols/page.mdx +++ b/src/app/docs/tour/4-protocols/page.mdx @@ -11,7 +11,7 @@ Coming from the world of HTTP client/server models, protocols are kinda like req 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: ``` -cargo add iroh-blobs --features=rpc +cargo add iroh-blobs ``` then adjust our code: diff --git a/src/app/docs/tour/5-routers/page.mdx b/src/app/docs/tour/5-routers/page.mdx index b71ac453..bc5428a7 100644 --- a/src/app/docs/tour/5-routers/page.mdx +++ b/src/app/docs/tour/5-routers/page.mdx @@ -14,24 +14,26 @@ Then we can setup gossip & add it to our router: ```rust use iroh::{protocol::Router, Endpoint}; -use iroh_blobs::net_protocol::Blobs; -use iroh_gossip::{net::Gossip, ALPN}; +use iroh_blobs::{store::mem::MemStore, BlobsProtocol}; +use iroh_gossip::Gossip; #[tokio::main] async fn main() -> anyhow::Result<()> { - let endpoint = Endpoint::bind().await?; - - let blobs = Blobs::memory().build(&endpoint); - - let gossip = Gossip::builder().spawn(endpoint.clone()).await?; - - // build the router - let router = Router::builder(endpoint) - .accept(iroh_blobs::ALPN, blobs.clone()) - .accept(iroh_gossip::ALPN, gossip.clone()) + let endpoint= Endpoint::bind().await?; + let store=MemStore::new(); + let blobs=BlobsProtocol::new(&store,None); + + let gossip=Gossip::builder().spawn(endpoint.clone()); + + + //build the router + let router=Router::builder(endpoint) + .accept(iroh_blobs::ALPN, blobs) + .accept(iroh_gossip::ALPN, gossip) .spawn(); - + router.shutdown().await?; + Ok(()) } ``` From 84d40fa9b572039788d117d45c53af25f9d3a6f6 Mon Sep 17 00:00:00 2001 From: Anonymous-AAA Date: Thu, 23 Oct 2025 09:25:19 +0530 Subject: [PATCH 2/5] update typo --- src/app/docs/concepts/endpoint/page.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/docs/concepts/endpoint/page.mdx b/src/app/docs/concepts/endpoint/page.mdx index c006b460..95626662 100644 --- a/src/app/docs/concepts/endpoint/page.mdx +++ b/src/app/docs/concepts/endpoint/page.mdx @@ -11,7 +11,7 @@ use iroh::Endpoint; #[tokio::main] async fn main() { - let endpoint = Endpoint::.bind().await.unwrap(); + let endpoint = Endpoint::bind().await.unwrap(); // ... } ``` From 891a5f32ca5a861e2a15a8796782ff88bb0fd00c Mon Sep 17 00:00:00 2001 From: Anonymous-AAA Date: Thu, 23 Oct 2025 09:34:36 +0530 Subject: [PATCH 3/5] update docs --- src/app/docs/concepts/endpoint/page.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/docs/concepts/endpoint/page.mdx b/src/app/docs/concepts/endpoint/page.mdx index 95626662..780a9356 100644 --- a/src/app/docs/concepts/endpoint/page.mdx +++ b/src/app/docs/concepts/endpoint/page.mdx @@ -16,7 +16,7 @@ async fn main() { } ``` -Breaking that down the `builder` sets up configuration for the endpoint, and `bind` creates the endpoint and starts listening for incoming connections. The `await` keyword is used to wait for the endpoint to be created in an asynchronous context. +Breaking that down, `bind` creates the endpoint and starts listening for incoming connections, while the `await` keyword is used to wait for the endpoint to be created in an asynchronous context. Once you have an endpoint, you can use it to create connections to other endpoints, or accept incoming connections from other endpoints. From 49e0c69184589a6a41f38f21ef1b6470424f6959 Mon Sep 17 00:00:00 2001 From: Alen Antony <77876851+Anonymous-AAA@users.noreply.github.com> Date: Fri, 24 Oct 2025 07:57:47 +0530 Subject: [PATCH 4/5] Update src/app/docs/tour/5-routers/page.mdx Co-authored-by: Brendan O'Brien --- src/app/docs/tour/5-routers/page.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/docs/tour/5-routers/page.mdx b/src/app/docs/tour/5-routers/page.mdx index bc5428a7..590a3187 100644 --- a/src/app/docs/tour/5-routers/page.mdx +++ b/src/app/docs/tour/5-routers/page.mdx @@ -20,10 +20,10 @@ use iroh_gossip::Gossip; #[tokio::main] async fn main() -> anyhow::Result<()> { let endpoint= Endpoint::bind().await?; - let store=MemStore::new(); - let blobs=BlobsProtocol::new(&store,None); + let store = MemStore::new(); + let blobs = BlobsProtocol::new(&store,None); - let gossip=Gossip::builder().spawn(endpoint.clone()); + let gossip = Gossip::builder().spawn(endpoint.clone()); //build the router From 2386bca8608ff2c9afa2504ef5621ac8c0eb06d2 Mon Sep 17 00:00:00 2001 From: Anonymous-AAA Date: Fri, 24 Oct 2025 08:02:39 +0530 Subject: [PATCH 5/5] fix spaces --- src/app/docs/tour/5-routers/page.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/docs/tour/5-routers/page.mdx b/src/app/docs/tour/5-routers/page.mdx index 590a3187..c6283478 100644 --- a/src/app/docs/tour/5-routers/page.mdx +++ b/src/app/docs/tour/5-routers/page.mdx @@ -19,7 +19,7 @@ use iroh_gossip::Gossip; #[tokio::main] async fn main() -> anyhow::Result<()> { - let endpoint= Endpoint::bind().await?; + let endpoint = Endpoint::bind().await?; let store = MemStore::new(); let blobs = BlobsProtocol::new(&store,None); @@ -27,7 +27,7 @@ async fn main() -> anyhow::Result<()> { //build the router - let router=Router::builder(endpoint) + let router = Router::builder(endpoint) .accept(iroh_blobs::ALPN, blobs) .accept(iroh_gossip::ALPN, gossip) .spawn();