Skip to content

Commit 49ffbb8

Browse files
committed
comments from phillip
1 parent 7be9c57 commit 49ffbb8

File tree

6 files changed

+63
-578
lines changed

6 files changed

+63
-578
lines changed

connecting/local-discovery.mdx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "mDNS"
3+
---
4+
5+
The mDNS discovery mechanism will automatically broadcast your endpoint's
6+
presence on the local network, and listen for other endpoints doing the same. When
7+
another endpoint is discovered, the dialing information is exchanged, and a
8+
connection can be established directly over the local network without needing a relay.
9+
10+
Devices need to be connected to the same local network for mDNS discovery to
11+
work. This can be a Wi-Fi network, an Ethernet network, or even a mobile
12+
hotspot. mDNS is not designed to work over the internet or across different
13+
networks.
14+
15+
## Usage
16+
17+
Local Discovery is _not_ enabled by default, and must be enabled explicitly.
18+
You'll need to add the `discovery-local-network` feature flag to your
19+
`Cargo.toml` to use it.
20+
21+
```toml
22+
[dependencies]
23+
# Make sure to use the most recent version here instead of nn. (at the time of writing: 0.32)
24+
iroh = { version = "0.nn", features = ["address-lookup-mdns"] }
25+
```
26+
27+
Then configure your endpoint to use local discovery concurrently with the default DNS discovery:
28+
29+
```rust
30+
use iroh::{Endpoint, presets};
31+
32+
let mdns = iroh::address_lookup::mdns::MdnsAddressLookup::builder();
33+
let ep = Endpoint::builder()
34+
.address_lookup(mdns)
35+
.bind(presets::N0)
36+
.await?;
37+
```
38+
39+
For more information on how mDNS discovery works, see the [mDNS documentation](https://docs.rs/iroh/latest/iroh/address_lookup/mdns/index.html).

docs.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@
4040
"connecting/custom-relays",
4141
"connecting/dns-discovery",
4242
"connecting/dht-discovery",
43+
"connecting/local-discovery",
4344
"connecting/gossip",
4445
"connecting/endpoint-hooks"
4546
]
4647
},
4748
{
48-
"group": "Protocols",
49+
"group": "Sending Data",
4950
"pages": [
5051
"protocols/kv-crdts",
5152
"protocols/blobs",
5253
"protocols/rpc",
5354
"protocols/automerge",
5455
"protocols/streaming",
5556
"examples/chat",
56-
"protocols/writing-a-protocol"
57+
"protocols/writing-a-protocol",
58+
"protocols/using-quic"
5759
]
5860
},
5961
{
6062
"group": "Transports",
6163
"pages": [
62-
"transports/quic",
63-
"transports/mdns",
6464
"transports/tor",
6565
"transports/nym",
6666
"transports/bluetooth"

protocols/using-quic.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,26 @@
22
title: "Using QUIC"
33
---
44

5-
## Why this matters for iroh
5+
Every endpoint uses QUIC over UDP by default — no configuration required.
66

7-
iroh is built on top of QUIC, providing connectivity, NAT traversal, and encrypted connections out of the box. While iroh handles the hard parts of networking—holepunching, relay servers, and discovery—**you still need to design how your application exchanges data once connected**.
7+
iroh's QUIC implementation is built on
8+
[noq](https://github.com/n0-computer/noq), which includes multipath support and
9+
QUIC NAT traversal.
10+
11+
All connections are encrypted and authenticated using TLS 1.3. Holepunching,
12+
relay fallback, and multipath are all handled at the QUIC layer automatically.
13+
14+
## Custom transports
15+
16+
QUIC over UDP is the default, but iroh supports plugging in additional custom
17+
transports alongside it.
18+
19+
All transports, even custom transports [Tor](/transports/tor), [Nym](/transports/nym), and
20+
[Bluetooth](/transports/bluetooth) deliver QUIC datagrams.
21+
22+
## Using QUIC
23+
24+
While iroh handles the hard parts of networking—holepunching, relay servers, and discovery—**you still need to design how your application exchanges data once connected**.
825

926
Many developers reach for iroh expecting it to completely abstract away the underlying transport. However, iroh intentionally exposes QUIC's powerful stream API because:
1027

protocols/writing-a-protocol.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ This follows the [request-response pattern](/protocols/using-quic#request-and-re
164164

165165
```rs
166166
async fn connect_side(addr: EndpointAddr) -> Result<()> {
167-
let endpoint = Endpoint::bind(presets::N0).await?;
167+
let endpoint = Endpoint::bind(iroh::presets::N0).await?;
168168

169169
// Open a connection to the accepting endpoint
170170
let conn = endpoint.connect(addr, ALPN).await?;

transports/mdns.mdx

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)