diff --git a/src/app/docs/tour/2-relays/page.mdx b/src/app/docs/tour/2-relays/page.mdx
index cb78c1de..81df0c56 100644
--- a/src/app/docs/tour/2-relays/page.mdx
+++ b/src/app/docs/tour/2-relays/page.mdx
@@ -6,9 +6,9 @@ A bunch of things happen in the background when an endpoint binds. The first thi
Relays are servers that help establish connections between devices. They’re the backbone of an iroh network. When your endpoint starts, it sends pings to all of the configured relays & measures how long the PONGs take to come back, also known as a measure of round trip latency. Relay servers are spread around the world, and the one with the lowest latency is usually the relay server you are physically closest to, but all we really care about is which one answers the fastest. Your endpoint will pick the relay with the lowest latency (the one that answered first) & use that as a *home relay.* With a home relay picked our endpoint opens a single WebSocket connection & work with the relay to figure out the details like our endpoint’s public IP address. At this point our endpoint is ready to dial & be dialed. This entire process happens in 0-3 seconds.
-Aside from being a public-facing home-base on the internet, relays have a second crucial role, which is to… relay. Meaning: when one node *doesn’t* have a direct connection to another node, it’ll use the relay to send data to that node. This means that even if we *can’t* establish a direct connection, data will still flow between the two devices. This is the part that let’s us say it’s “peer 2 peer that works”: sometimes peer-2-peer isn’t possible, so we have a seamless fallback baked in.
+Aside from being a public-facing home-base on the internet, relays have a second crucial role, which is to… relay. Meaning: when one endpoint *doesn’t* have a direct connection to another endpoint, it’ll use the relay to send data to that endpoint. This means that even if we *can’t* establish a direct connection, data will still flow between the two devices. This is the part that let’s us say it’s “peer 2 peer that works”: sometimes peer-2-peer isn’t possible, so we have a seamless fallback baked in.
-Keep in mind, connections are end-2-end encrypted, which means relays can’t read traffic, only pass along encrypted packets intended for the other side of the connection. Relays *do* know the list of node identifiers that are connected to it, and which nodes are connected to whom, but not what they are saying.
+Keep in mind, connections are end-2-end encrypted, which means relays can’t read traffic, only pass along encrypted packets intended for the other side of the connection. Relays *do* know the list of endpoint identifiers that are connected to it, and which endpoints are connected to whom, but not what they are saying.
Coming back to our program, let’s add support for relays:
@@ -20,7 +20,7 @@ async fn main() -> anyhow::Result<()> {
.relay_mode(iroh::RelayMode::Default);
let endpoint = builder.bind().await?;
- println!("node id: {:?}", endpoint.node_id());
+ println!("endpoint id: {:?}", endpoint.id());
Ok(())
}
diff --git a/src/app/docs/tour/3-discovery/page.mdx b/src/app/docs/tour/3-discovery/page.mdx
index 21dba69c..6edd2a4f 100644
--- a/src/app/docs/tour/3-discovery/page.mdx
+++ b/src/app/docs/tour/3-discovery/page.mdx
@@ -2,13 +2,13 @@ import { PageLink } from '@/components/PageNavigation';
# 3. Discovery
-Discovery is the glue that connects a [Node Identifier](/docs/concepts/endpoint#node-identifiers) to something we can dial. There are a few different types of discovery services, but for all of them you put a `NodeID` in, and get back either the home relay of that node, or IP addresses to dial.
+Discovery is the glue that connects a [Endpoint Identifier](/docs/concepts/endpoint#endpoint-identifiers) to something we can dial. There are a few different types of discovery services, but for all of them you put a `EndpointID` in, and get back either the home relay of that endpoint, or IP addresses to dial.
-There are different implementations of the discovery service in iroh, the most popular of which are DNS & Local Discovery. DNS uses the same domain name system that connects "example.com" to an IP address to map node ids to relay servers, and local discovery uses your local network to find nodes to talk to on local WiFi, even if that WiFi network doesn’t have a wider internet connection.
+There are different implementations of the discovery service in iroh, the most popular of which are DNS & Local Discovery. DNS uses the same domain name system that connects "example.com" to an IP address to map endpoint ids to relay servers, and local discovery uses your local network to find endpoints to talk to on local WiFi, even if that WiFi network doesn’t have a wider internet connection.
### DNS Discovery
-First, let's add the n0 DNS discovery service as a default:
+Iroh endpoints come with some defaults that include using our public infrastructure to enable discovery:
```rust
use iroh::{Endpoint, RelayMode};
@@ -17,20 +17,18 @@ use iroh::{Endpoint, RelayMode};
async fn main() -> anyhow::Result<()> {
let builder = Endpoint::builder()
.relay_mode(RelayMode::Default)
- .discovery_n0();
+ .bind().await?;
- let endpoint = builder.bind().await?;
-
- println!("node id: {:?}", endpoint.node_id());
+ println!("endpoint id: {:?}", endpoint.id());
Ok(())
}
```
-Now when this endpoint boots up, it will list itself on the n0 DNS service. From here we can pass along the node identifier, and other nodes can use the n0 DNS service to find the home relay of this node.
+Now when this endpoint boots up, it will list itself on the n0 DNS service. From here we can pass along the endpoint identifier, and other endpoints can use the n0 DNS service to find the home relay of this endpoint.
### Local Discovery
-Local discovery has the extra trick of being able to actually find new nodes on the local network. Before we can do that, we need to add the `discovery-local-network` feature to our `Cargo.toml` file:
+Local discovery has the extra trick of being able to actually find new endpoints on the local network. Before we can do that, we need to add the `discovery-local-network` feature to our `Cargo.toml` file:
```
cargo add iroh --features discovery-local-network
@@ -53,18 +51,17 @@ use iroh::{Endpoint, RelayMode, SecretKey};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
+ let mdns = iroh::discovery::mdns::MdnsDiscovery::builder();
let builder = Endpoint::builder()
- .relay_mode(RelayMode::Default)
- .discovery_n0()
- .discovery_local_network();
+ .discovery(mdns);
let endpoint = builder.bind().await?;
- println!("node id: {:?}", endpoint.node_id());
+ println!("endpoint id: {:?}", endpoint.id());
Ok(())
}
```
-Here we’ve added discovery to the endpoint constructor, passing in our two discovery services, and that’s it, iroh will now use these two services to get something it can dial for a given node ID.
+Here we’ve added discovery to the endpoint constructor, passing in our two discovery services, and that’s it, iroh will now use these two services to get something it can dial for a given endpoint ID.
For an example of this in action, check out the [local discovery example](https://github.com/n0-computer/iroh/blob/main/iroh/examples/locally-discovered-nodes.rs).
diff --git a/src/app/docs/tour/4-protocols/page.mdx b/src/app/docs/tour/4-protocols/page.mdx
index abc8fc95..11f0dfa3 100644
--- a/src/app/docs/tour/4-protocols/page.mdx
+++ b/src/app/docs/tour/4-protocols/page.mdx
@@ -22,7 +22,7 @@ use iroh_blobs::net_protocol::Blobs;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
- let endpoint = Endpoint::builder().discovery_n0().bind().await?;
+ let endpoint = Endpoint::builder().bind().await?;
let blobs = Blobs::memory().build(&endpoint);
@@ -41,7 +41,7 @@ async fn main() -> anyhow::Result<()> {
This code doesn't actually _do_ anything with the blobs protocol. For a real-world example, check out [sendme](https://github.com/n0-computer/sendme)
-This code sets up everything we need to both provide data we have locally when others request it, and ask other nodes that run the blobs protocol for data. Starting at the top, we first construct the endpoint, then we construct an instance of the blobs protocol, then add a _router_ (more on that in a minute) that listens for blobs protocol connections.
+This code sets up everything we need to both provide data we have locally when others request it, and ask other endpoints that run the blobs protocol for data. Starting at the top, we first construct the endpoint, then we construct an instance of the blobs protocol, then add a _router_ (more on that in a minute) that listens for blobs protocol connections.
diff --git a/src/app/docs/tour/5-routers/page.mdx b/src/app/docs/tour/5-routers/page.mdx
index 5fc5d017..1659bd55 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::{net::Gossip, ALPN};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
- let endpoint = Endpoint::builder().discovery_n0().bind().await?;
+ let endpoint = Endpoint::builder().bind().await?;
let blobs = Blobs::memory().build(&endpoint);
diff --git a/src/app/docs/tour/6-conclusion/page.mdx b/src/app/docs/tour/6-conclusion/page.mdx
index 04a123a9..8ee592ff 100644
--- a/src/app/docs/tour/6-conclusion/page.mdx
+++ b/src/app/docs/tour/6-conclusion/page.mdx
@@ -4,14 +4,14 @@ import { PageLink } from '@/components/PageNavigation';
Before we go, let’s talk through a little of what iroh *doesn’t* cover:
-### Magically keep nodes online
-First, iroh doesn’t magically ensure the device you’re trying to dial is online. It doesn’t buffer messages & wait until you turn your phone back on. The technical term for this is “network churn”, and programming around the reality that nodes can come online & go offline whenever they want is the core concern of all distributed systems programming.
+### Magically keep endpoints online
+First, iroh doesn’t magically ensure the device you’re trying to dial is online. It doesn’t buffer messages & wait until you turn your phone back on. The technical term for this is “network churn”, and programming around the reality that endpoints can come online & go offline whenever they want is the core concern of all distributed systems programming.
### Obscure your IP address
-Second, iroh doesn’t obscure your IP address. nodes accepting connections will know your IP address. This is one of the biggest reason we think that iroh should be a library that users build into apps that have an in-built sense of trust. Keep in mind: sharing IP addresses is common practice in the wild, nearly all of major video conferencing tools do this. Video games do this. Heck, Spotify used to do this. And keep in mind, seeing your IP address is a thing traditional servers *always* have access to.
+Second, iroh doesn’t obscure your IP address. endpoints accepting connections will know your IP address. This is one of the biggest reason we think that iroh should be a library that users build into apps that have an in-built sense of trust. Keep in mind: sharing IP addresses is common practice in the wild, nearly all of major video conferencing tools do this. Video games do this. Heck, Spotify used to do this. And keep in mind, seeing your IP address is a thing traditional servers *always* have access to.
### Peer Signaling
-Lastly, iroh doesn’t yet come with a built-in peer signaling mechanism, that is, a way to get alice’s node id to bob. This seems like a massive oversight, but it’s on purpose: different apps have different opinions about how peers should learn about each other. In some cases it’s as simple as storing NodeIDs in an app database & passing them out as API responses. In other cases it’s local discovery only, or using tickets to encode dialing details + protocol invocations in a single string. We'll talk through patterns for peer signaling in future docs.
+Lastly, iroh doesn’t yet come with a built-in peer signaling mechanism, that is, a way to get alice’s endpoint id to bob. This seems like a massive oversight, but it’s on purpose: different apps have different opinions about how peers should learn about each other. In some cases it’s as simple as storing EndpointIDs in an app database & passing them out as API responses. In other cases it’s local discovery only, or using tickets to encode dialing details + protocol invocations in a single string. We'll talk through patterns for peer signaling in future docs.
## Conclusion
diff --git a/src/app/docs/tour/page.mdx b/src/app/docs/tour/page.mdx
index 4347581a..f54b429a 100644
--- a/src/app/docs/tour/page.mdx
+++ b/src/app/docs/tour/page.mdx
@@ -26,7 +26,7 @@ Hello, world!
Here's a high level overview of how everything fits together:
-Iroh is a library for establishing the most direct QUIC connection possible between two devices. Every _endpoint_ uses the public half of a cryptographic keypair to identify itself. Assuming at least one configured _relay server_ is reachable, an endpoint keeps exactly one TCP connection to a “home relay” that other nodes use for connection establishment, and as a fallback transport. Iroh uses a suite of _discovery services_ to resolve home relays & endpoint IDs. Connections between endpoints use QUIC ALPNs to distinguish between _protocols_, while _routers_ automate the endpoint accept loop for protocol multiplexing.{{ className: 'lead' }}
+Iroh is a library for establishing the most direct QUIC connection possible between two devices. Every _endpoint_ uses the public half of a cryptographic keypair to identify itself. Assuming at least one configured _relay server_ is reachable, an endpoint keeps exactly one TCP connection to a “home relay” that other endpoints use for connection establishment, and as a fallback transport. Iroh uses a suite of _discovery services_ to resolve home relays & endpoint IDs. Connections between endpoints use QUIC ALPNs to distinguish between _protocols_, while _routers_ automate the endpoint accept loop for protocol multiplexing.{{ className: 'lead' }}
This paragraph touches on five key points worth understanding in iroh:
diff --git a/src/app/page.jsx b/src/app/page.jsx
index 90f80acc..5c2fe05b 100644
--- a/src/app/page.jsx
+++ b/src/app/page.jsx
@@ -172,16 +172,16 @@ use iroh_ping::{ALPN as PingALPN, Ping};
#[tokio::main]
async fn main() -> Result<()> {
// create the receive side
- let recv_endpoint = Endpoint::builder().discovery_n0().bind().await?;
+ let recv_endpoint = Endpoint::builder().bind().await?;
let recv_router = Router::builder(recv_endpoint)
.accept(PingALPN, Ping::new())
.spawn();
// get the receive side's address:
- let addr = recv_router.endpoint().node_addr().await?;
+ let addr = recv_router.endpoint().addr().await?;
// create the send side & send a ping!
- let send_ep = Endpoint::builder().discovery_n0().bind().await?;
+ let send_ep = Endpoint::builder().bind().await?;
let send_pinger = Ping::new();
send_pinger.ping(&send_ep, addr).await?;
diff --git a/src/app/proto/protocols.js b/src/app/proto/protocols.js
index 04cbd2bb..6d693574 100644
--- a/src/app/proto/protocols.js
+++ b/src/app/proto/protocols.js
@@ -13,7 +13,7 @@ export const protocols = [
"featured": 2,
"icon": "iconPlatforms",
"title": "Gossip",
- "tagline": "Broadcast messages to groups of nodes by topic.",
+ "tagline": "Broadcast messages to groups of endpoints by topic.",
"slug": "iroh-gossip",
"repository": "https://github.com/n0-computer/iroh-gossip",
"documentation": "https://docs.rs/iroh-gossip/latest/iroh_gossip/",
@@ -60,7 +60,7 @@ export const protocols = [
{
"icon": "",
"title": "Iroh ping",
- "tagline": "A minimal protocol to ping iroh nodes.",
+ "tagline": "A minimal protocol to ping iroh endpoints.",
"slug": "iroh-ping",
"documentation": "https://docs.rs/iroh-ping/latest/iroh_ping/",
"repository": "https://github.com/n0-computer/iroh-ping",
From c8e999d743b7ffad66ef7e28a61e50f1df1982e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cramfox=E2=80=9D?= <“kasey@n0.computer”>
Date: Wed, 22 Oct 2025 16:11:08 -0400
Subject: [PATCH 4/4] docs: fixing missed errors
---
.../blog/message-framing-tutorial/page.mdx | 30 +++++++++----------
src/app/docs/concepts/discovery/page.mdx | 4 +--
src/app/docs/concepts/endpoint/page.mdx | 2 +-
src/app/docs/concepts/router/page.mdx | 2 +-
src/app/docs/concepts/tickets/page.mdx | 2 ++
src/app/docs/examples/gossip-chat/page.mdx | 6 ++--
src/app/docs/overview/page.mdx | 2 +-
src/app/docs/protocols/writing/page.mdx | 8 ++---
src/app/docs/quickstart/page.mdx | 4 +--
src/app/docs/tour/3-discovery/page.mdx | 8 ++---
src/app/docs/tour/4-protocols/page.mdx | 10 ++++---
src/app/docs/tour/5-routers/page.mdx | 2 +-
src/app/page.jsx | 4 +--
13 files changed, 43 insertions(+), 41 deletions(-)
diff --git a/src/app/blog/message-framing-tutorial/page.mdx b/src/app/blog/message-framing-tutorial/page.mdx
index c559f707..2cbb758a 100644
--- a/src/app/blog/message-framing-tutorial/page.mdx
+++ b/src/app/blog/message-framing-tutorial/page.mdx
@@ -48,7 +48,7 @@ Message framing is a generally applicable concept, and by no means limited to wo
QUIC connections are made of streams and those streams can be bi-directional or uni-directional. Bi-directional streams are streams you can read from and write to in both directions. Uni-directional streams are streams that can only be written to on one side and read from by the other.
-A single QUIC connection to another node can have many streams, some uni-directional, some bi-directional.
+A single QUIC connection to another endpoint can have many streams, some uni-directional, some bi-directional.
For the purposes of this tutorial, we are going to focus on a single, uni-directional stream, where one side *writes* to the stream and the other side *reads* from it.
@@ -107,19 +107,19 @@ const ALPN: &[u8] = b"iroh/smol/0";
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// create the receive side
- let recv_ep = Endpoint::builder().bind().await?;
+ let recv_ep = Endpoint::bind().await?;
let recv_router = Router::builder(recv_ep).spawn();
- let addr = recv_router.endpoint().node_addr().initialized().await;
+ let addr = recv_router.endpoint().endpoint_addr().initialized().await;
// create a send side
- let send_ep = Endpoint::builder().bind().await?;
+ let send_ep = Endpoint::bind().await?;
let conn = send_ep.connect(addr, ALPN).await?;
Ok(())
}
```
-The `iroh::Endpoint` is the endpoint on which we make connections. By default, an `iroh::Endpoint` allows us to dial by `node_id` without having to manually send address information.
+The `iroh::Endpoint` is the endpoint on which we make connections. By default, an `iroh::Endpoint` allows us to dial by `endpoint_id` without having to manually send address information.
We use the `EndpointBuilder` to create the receive endpoint, `recv_ep`.
@@ -129,7 +129,7 @@ The ALPN string is formatted based on the conventions we recommend. The first se
We use the `RouterBuilder` to create the `recv_router`, which won't do much for us until we add our custom protocol later.
-The `addr` is the `NodeAddr` of the receive endpoint, which contains all the address information we know about ourselves, including our `node_id`. We will use the `addr` to connect from the send endpoint to the receive endpoint, using the `Endpoint::connect` method.
+The `addr` is the `endpointAddr` of the receive endpoint, which contains all the address information we know about ourselves, including our `endpoint_id`. We will use the `addr` to connect from the send endpoint to the receive endpoint, using the `Endpoint::connect` method.
# Scaffolding out `write_frame` and `read_frame`
@@ -154,12 +154,12 @@ const ALPN: &[u8] = b"iroh/smol-msgs/0";
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// create the receive side
- let recv_ep = Endpoint::builder().bind().await?;
+ let recv_ep = Endpoint::bind().await?;
let recv_router = Router::builder(recv_ep).spawn();
- let addr = recv_router.endpoint().node_addr().initialized().await;
+ let addr = recv_router.endpoint().endpoint_addr().initialized().await;
// create a send side & send some messages :)
- let send_ep = Endpoint::builder().bind().await?;
+ let send_ep = Endpoint::bind().await?;
let conn = send_ep.connect(addr, ALPN).await?;
let mut stream = conn.open_uni().await?;
@@ -253,12 +253,12 @@ const ALPN: &[u8] = b"iroh/smol/0";
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// create the receive side
- let recv_ep = Endpoint::builder().bind().await?;
+ let recv_ep = Endpoint::bind().await?;
let recv_router = Router::builder(recv_ep).accept(ALPN, SmolProtocol).spawn();
- let addr = recv_router.endpoint().node_addr().initialized().await;
+ let addr = recv_router.endpoint().endpoint_addr().initialized().await;
// create a send side & send some messages :)
- let send_ep = Endpoint::builder().bind().await?;
+ let send_ep = Endpoint::bind().await?;
let conn = send_ep.connect(addr, ALPN).await?;
let mut stream = conn.open_uni().await?;
@@ -400,12 +400,12 @@ const ALPN: &[u8] = b"iroh/smol/0";
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// create the receive side
- let recv_ep = Endpoint::builder().bind().await?;
+ let recv_ep = Endpoint::bind().await?;
let recv_router = Router::builder(recv_ep).accept(ALPN, SmolProtocol).spawn();
- let addr = recv_router.endpoint().node_addr().initialized().await;
+ let addr = recv_router.endpoint().endpoint_addr().initialized().await;
// create a send side & send some messages :)
- let send_ep = Endpoint::builder().bind().await?;
+ let send_ep = Endpoint::bind().await?;
let conn = send_ep.connect(addr, ALPN).await?;
let mut stream = conn.open_uni().await?;
diff --git a/src/app/docs/concepts/discovery/page.mdx b/src/app/docs/concepts/discovery/page.mdx
index 53d25c62..a9265b13 100644
--- a/src/app/docs/concepts/discovery/page.mdx
+++ b/src/app/docs/concepts/discovery/page.mdx
@@ -65,14 +65,14 @@ DHT Discovery is _not_ enabled by default, and must be enabled by the user. You'
iroh = { version = "0.nn", features = ["discovery-pkarr-dht"] }
```
-Then configure your endpoint to use DHT discovery concurrently with DNS discovery:
+Then configure your endpoint to use DHT discovery concurrently with mDNS discovery, but not with the default DNS discovery, use the `Endpoint::empty_builder` method. This requires specifiying a `RelayMode`, which in this example we will keep default.
```rust
use iroh::Endpoint;
let dht_discovery = iroh::discovery::dht::DhtDiscovery::builder();
let mdns = iroh::discovery::mdns::MdnsDiscovery::builder();
-let ep = Endpoint::builder()
+let ep = Endpoint::empty_builder(iroh::RelayMode::Default)
.discovery(dnt_discovery)
.discovery(mdns)
.bind()
diff --git a/src/app/docs/concepts/endpoint/page.mdx b/src/app/docs/concepts/endpoint/page.mdx
index b915aea3..c006b460 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::builder().bind().await.unwrap();
+ let endpoint = Endpoint::.bind().await.unwrap();
// ...
}
```
diff --git a/src/app/docs/concepts/router/page.mdx b/src/app/docs/concepts/router/page.mdx
index 5a9be1e6..5b4ba9cb 100644
--- a/src/app/docs/concepts/router/page.mdx
+++ b/src/app/docs/concepts/router/page.mdx
@@ -17,7 +17,7 @@ use iroh_blobs::util::local_pool::LocalPool;
#[tokio::main]
async fn main() -> Result<()> {
// Build an endpoint, defaulting to the public n0 relay network
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
// configure the blobs protocol to run in-memory
let blobs = Blobs::memory().build(&endpoint);
diff --git a/src/app/docs/concepts/tickets/page.mdx b/src/app/docs/concepts/tickets/page.mdx
index b92d4ea9..08609c1d 100644
--- a/src/app/docs/concepts/tickets/page.mdx
+++ b/src/app/docs/concepts/tickets/page.mdx
@@ -2,6 +2,8 @@
Tickets are a way to share dialing information between iroh endpoints. They're a single token that contains everything needed to connect to another endpoint, or to fetch a blob or document. {{className: 'lead'}}
+You can use the default iroh endpoint tickets or build your own tickets using the `iroh-tickets` crate.
+
Have a ticket? Try pasting it into the [iroh ticket explorer](https://ticket.iroh.computer) to break it down! Here's an [example](https://ticket.iroh.computer?ticket=docaaacarwhmusoqf362j3jpzrehzkw3bqamcp2mmbhn3fmag3mzzfjp4beahj2v7aezhojvfqi5wltr4vxymgzqnctryyup327ct7iy4s5noxy6aaa)
diff --git a/src/app/docs/examples/gossip-chat/page.mdx b/src/app/docs/examples/gossip-chat/page.mdx
index 2474b80a..756ee453 100644
--- a/src/app/docs/examples/gossip-chat/page.mdx
+++ b/src/app/docs/examples/gossip-chat/page.mdx
@@ -138,7 +138,7 @@ use iroh_gossip::{net::Gossip, proto::TopicId};
#[tokio::main]
async fn main() -> Result<()> {
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
println!("> our endpoint id: {}", endpoint.id());
let gossip = Gossip::builder().spawn(endpoint.clone()).await?;
@@ -332,7 +332,7 @@ use serde::{Deserialize, Serialize};
#[tokio::main]
async fn main() -> Result<()> {
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
println!("> our endpoint id: {}", endpoint.id());
let gossip = Gossip::builder().spawn(endpoint.clone()).await?;
@@ -588,7 +588,7 @@ async fn main() -> Result<()> {
}
};
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
println!("> our endpoint id: {}", endpoint.id());
let gossip = Gossip::builder().spawn(endpoint.clone()).await?;
diff --git a/src/app/docs/overview/page.mdx b/src/app/docs/overview/page.mdx
index 33b7d2da..d47aacde 100644
--- a/src/app/docs/overview/page.mdx
+++ b/src/app/docs/overview/page.mdx
@@ -13,7 +13,7 @@ This gives you fast, reliable QUIC connections that are authenticated and encryp
## Iroh is "dial by public key"
-In the iroh world, you dial another endpoint by its `IdEndpoint`, a 32-byte ed25519 public key. Unlike IP addresses, this ID is globally unique, and instead of being assigned, you can cheaply generate as many as you want yourself. It also doesn't change when you change networks.
+In the iroh world, you dial another endpoint by its `EndpointId`, a 32-byte ed25519 public key. Unlike IP addresses, this ID is globally unique, and instead of being assigned, you can cheaply generate as many as you want yourself. It also doesn't change when you change networks.
You won't have to think about NATs getting in your way, iroh traverses them for you.
Basing connections on asymmetric public keys is what allows iroh to *always* end-to-end encrypt and authenticate connections.
diff --git a/src/app/docs/protocols/writing/page.mdx b/src/app/docs/protocols/writing/page.mdx
index 53fa36c1..6fc1c3a8 100644
--- a/src/app/docs/protocols/writing/page.mdx
+++ b/src/app/docs/protocols/writing/page.mdx
@@ -36,7 +36,7 @@ The easiest way to start listening for incoming connections is by using iroh's [
```rs
async fn start_accept_side() -> anyhow::Result {
- let endpoint = iroh::Endpoint::builder().bind().await?;
+ let endpoint = iroh::Endpoint::.bind().await?;
let router = iroh::protocol::Router::builder(endpoint)
.spawn();
@@ -97,7 +97,7 @@ Now, we can modify our router so it handles incoming connections with our newly
```rs
async fn start_accept_side() -> anyhow::Result {
- let endpoint = iroh::Endpoint::builder().bind().await?;
+ let endpoint = iroh::Endpoint::bind().await?;
let router = iroh::protocol::Router::builder(endpoint)
.accept(ALPN, Echo) // This makes the router handle incoming connections with our ALPN via Echo::accept!
@@ -120,7 +120,7 @@ impl ProtocolHandler for Echo {
fn accept(&self, connection: Connection) -> BoxFuture> {
Box::pin(async move {
// We can get the remote's endpoint id from the connection.
- let endpoint_id = connection.remote_endpoint_id()?;
+ let endpoint_id = connection.remote_id()?;
println!("accepted connection from {endpoint_id}");
// Our protocol is a simple request-response protocol, so we expect the
@@ -172,7 +172,7 @@ This is what that looks like:
```rs
async fn connect_side(addr: EndpointAddr) -> Result<()> {
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
// Open a connection to the accepting endpoint
let conn = endpoint.connect(addr, ALPN).await?;
diff --git a/src/app/docs/quickstart/page.mdx b/src/app/docs/quickstart/page.mdx
index 07f3cbe6..e1eda353 100644
--- a/src/app/docs/quickstart/page.mdx
+++ b/src/app/docs/quickstart/page.mdx
@@ -54,7 +54,7 @@ This is what manages the possibly changing network underneath, maintains a conne
async fn main() -> anyhow::Result<()> {
// Create an endpoint, it allows creating and accepting
// connections in the iroh p2p world
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
// ...
@@ -85,7 +85,7 @@ It loads files from your file system and provides a protocol for seekable, resum
async fn main() -> anyhow::Result<()> {
// Create an endpoint, it allows creating and accepting
// connections in the iroh p2p world
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
// We initialize an in-memory backing store for iroh-blobs
let store = MemStore::new();
diff --git a/src/app/docs/tour/3-discovery/page.mdx b/src/app/docs/tour/3-discovery/page.mdx
index 6edd2a4f..f255b99d 100644
--- a/src/app/docs/tour/3-discovery/page.mdx
+++ b/src/app/docs/tour/3-discovery/page.mdx
@@ -15,9 +15,7 @@ use iroh::{Endpoint, RelayMode};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
- let builder = Endpoint::builder()
- .relay_mode(RelayMode::Default)
- .bind().await?;
+ let builder = Endpoint::.bind().await?;
println!("endpoint id: {:?}", endpoint.id());
Ok(())
@@ -44,7 +42,7 @@ rand = "0.8.5"
tokio = "1.43.0"
```
-And with that we can set up local discovery:
+And with that we can set up local discovery, alongside our default discovery:
```rust
use iroh::{Endpoint, RelayMode, SecretKey};
@@ -61,7 +59,7 @@ async fn main() -> anyhow::Result<()> {
}
```
-Here we’ve added discovery to the endpoint constructor, passing in our two discovery services, and that’s it, iroh will now use these two services to get something it can dial for a given endpoint ID.
+Here we’ve added discovery to the endpoint constructor, passing in our two default and one custom discovery services, and that’s it, iroh will now use these three services to get something it can dial for a given endpoint ID.
For an example of this in action, check out the [local discovery example](https://github.com/n0-computer/iroh/blob/main/iroh/examples/locally-discovered-nodes.rs).
diff --git a/src/app/docs/tour/4-protocols/page.mdx b/src/app/docs/tour/4-protocols/page.mdx
index 11f0dfa3..3f072433 100644
--- a/src/app/docs/tour/4-protocols/page.mdx
+++ b/src/app/docs/tour/4-protocols/page.mdx
@@ -18,17 +18,19 @@ then adjust our code:
```rust
use iroh::{protocol::Router, Endpoint};
-use iroh_blobs::net_protocol::Blobs;
+use iroh_blobs::{store::mem::MemStore, BlobsProtocol};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
- let blobs = Blobs::memory().build(&endpoint);
+ let store = MemStore::new();
+
+ let blobs = BlobsProtocol::new(&store, None);
// build the router
let router = Router::builder(endpoint)
- .accept(iroh_blobs::ALPN, blobs.clone())
+ .accept(iroh_blobs::ALPN, blobs)
.spawn();
router.shutdown().await?;
diff --git a/src/app/docs/tour/5-routers/page.mdx b/src/app/docs/tour/5-routers/page.mdx
index 1659bd55..b71ac453 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::{net::Gossip, ALPN};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
- let endpoint = Endpoint::builder().bind().await?;
+ let endpoint = Endpoint::bind().await?;
let blobs = Blobs::memory().build(&endpoint);
diff --git a/src/app/page.jsx b/src/app/page.jsx
index 5c2fe05b..98bf9fdc 100644
--- a/src/app/page.jsx
+++ b/src/app/page.jsx
@@ -172,7 +172,7 @@ use iroh_ping::{ALPN as PingALPN, Ping};
#[tokio::main]
async fn main() -> Result<()> {
// create the receive side
- let recv_endpoint = Endpoint::builder().bind().await?;
+ let recv_endpoint = Endpoint::bind().await?;
let recv_router = Router::builder(recv_endpoint)
.accept(PingALPN, Ping::new())
.spawn();
@@ -181,7 +181,7 @@ async fn main() -> Result<()> {
let addr = recv_router.endpoint().addr().await?;
// create the send side & send a ping!
- let send_ep = Endpoint::builder().bind().await?;
+ let send_ep = Endpoint::bind().await?;
let send_pinger = Ping::new();
send_pinger.ping(&send_ep, addr).await?;