Commit 46439c9 1 parent 7d8a0fc commit 46439c9 Copy full SHA for 46439c9
File tree 1 file changed +39
-0
lines changed
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ # AutoNAT Client Example
2
+
3
+ This example demonstrates NAT detection and connectivity strategies using libp2p's AutoNAT protocol.
4
+
5
+ ## How It Works
6
+
7
+ The application:
8
+ 1 . Detects whether your node is behind NAT/firewall (private) or publicly accessible
9
+ 2 . Establishes appropriate connectivity based on NAT status
10
+ 3 . Registers with a rendezvous point for peer discovery
11
+
12
+ ### Private Node Behavior
13
+ When behind NAT (most home networks):
14
+ - Detects private NAT status through AutoNAT probes
15
+ - Creates a relay reservation with a public relay node
16
+ - Uses the relay address to register with a rendezvous point
17
+ - Other peers can connect through the relay circuit
18
+
19
+ ### Public Node Behavior
20
+ When publicly accessible:
21
+ - Confirms public status with high confidence (2+ successful probes)
22
+ - Registers direct address with rendezvous point
23
+ - Other peers can connect directly without relay
24
+
25
+ ## Running the Example
26
+
27
+ ```
28
+ cargo run
29
+ ```
30
+
31
+ For custom options:
32
+ ```
33
+ cargo run -- --listen-port 4001
34
+ ```
35
+
36
+ ## Troubleshooting
37
+
38
+ - If you can't register with the rendezvous point, check that you have a valid relay connection
39
+ - Connection timeouts may indicate firewall issues blocking libp2p protocols
You can’t perform that action at this time.
0 commit comments