diff --git a/src/app/docs/concepts/endpoint/page.mdx b/src/app/docs/concepts/endpoint/page.mdx index c006b460..780a9356 100644 --- a/src/app/docs/concepts/endpoint/page.mdx +++ b/src/app/docs/concepts/endpoint/page.mdx @@ -11,12 +11,12 @@ use iroh::Endpoint; #[tokio::main] async fn main() { - let endpoint = Endpoint::.bind().await.unwrap(); + let endpoint = Endpoint::bind().await.unwrap(); // ... } ``` -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. 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..c6283478 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 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.clone()) - .accept(iroh_gossip::ALPN, gossip.clone()) + .accept(iroh_blobs::ALPN, blobs) + .accept(iroh_gossip::ALPN, gossip) .spawn(); - + router.shutdown().await?; + Ok(()) } ```