Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(examples): call Swarm::add_external_address in dcutr and relay #4052

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/dcutr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ fn main() -> Result<(), Box<dyn Error>> {
..
})) => {
info!("Relay told us our public address: {:?}", observed_addr);
swarm.add_external_address(observed_addr);
learned_observed_addr = true;
}
event => panic!("{event:?}"),
Expand Down
8 changes: 8 additions & 0 deletions examples/relay-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ fn main() -> Result<(), Box<dyn Error>> {
loop {
match swarm.next().await.expect("Infinite Stream.") {
SwarmEvent::Behaviour(event) => {
if let BehaviourEvent::Identify(identify::Event::Received {
info: identify::Info { observed_addr, .. },
..
}) = &event
{
swarm.add_external_address(observed_addr.clone());
}

println!("{event:?}")
}
SwarmEvent::NewListenAddr { address, .. } => {
Expand Down
7 changes: 7 additions & 0 deletions protocols/identify/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## 0.43.0 - unreleased

- Observed addresses (aka. external address candidates) of the local node, reported by a remote node via `libp2p-identify`, are no longer automatically considered confirmed external addresses, in other words they are no longer trusted by default.
Instead users need to confirm the reported observed address either manually, or by using `libp2p-autonat`.
In trusted environments users can simply extract observed addresses from a `libp2p-identify::Event::Received { info: libp2p_identify::Info { observed_addr }}` and confirm them via `Swarm::add_external_address`.
See [PR 3954] and [PR XXX].
mxinden marked this conversation as resolved.
Show resolved Hide resolved

- Remove deprecated `Identify` prefixed symbols. See [PR 3698].
- Raise MSRV to 1.65.
See [PR 3715].
Expand All @@ -17,7 +22,9 @@
[PR 3698]: https://github.com/libp2p/rust-libp2p/pull/3698
[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
[PR 3876]: https://github.com/libp2p/rust-libp2p/pull/3876
[PR 3954]: https://github.com/libp2p/rust-libp2p/pull/3954
[PR 3980]: https://github.com/libp2p/rust-libp2p/pull/3980
[PR XXX]: https://github.com/libp2p/rust-libp2p/pull/XXX
mxinden marked this conversation as resolved.
Show resolved Hide resolved

## 0.42.2

Expand Down