Skip to content

Commit a731f8e

Browse files
authored
fix(autonat): update examples (libp2p#3310)
Fix AutoNAT examples that became outdated due to libp2p#2959 and libp2p#2618.
1 parent f770e2a commit a731f8e

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,11 @@ libp2p-yamux = { path = "../../muxers/yamux" }
4141
all-features = true
4242
rustdoc-args = ["--cfg", "docsrs"]
4343
rustc-args = ["--cfg", "docsrs"]
44+
45+
[[example]]
46+
name = "client"
47+
path = "examples/autonat_client.rs"
48+
49+
[[example]]
50+
name = "server"
51+
path = "examples/autonat_server.rs"

examples/autonat_client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ impl Behaviour {
116116
refresh_interval: Duration::from_secs(30),
117117
boot_delay: Duration::from_secs(5),
118118
throttle_server_period: Duration::ZERO,
119+
only_global_ips: false,
119120
..Default::default()
120121
},
121122
),

examples/autonat_server.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ impl Behaviour {
9595
)),
9696
auto_nat: autonat::Behaviour::new(
9797
local_public_key.to_peer_id(),
98-
autonat::Config::default(),
98+
autonat::Config {
99+
only_global_ips: false,
100+
..Default::default()
101+
},
99102
),
100103
}
101104
}

0 commit comments

Comments
 (0)