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

dcutr: consider more than just external addresses #4496

Closed
Tracked by #4523
thomaseizinger opened this issue Sep 13, 2023 · 3 comments · Fixed by #4624
Closed
Tracked by #4523

dcutr: consider more than just external addresses #4496

thomaseizinger opened this issue Sep 13, 2023 · 3 comments · Fixed by #4624

Comments

@thomaseizinger
Copy link
Contributor

Description

At the moment, the dcutr::Behaviour only sends external addresses to the remote. See

handler::relayed::Handler::new(connected_point, self.observed_addresses());
and
fn observed_addresses(&self) -> Vec<Multiaddr> {
self.external_addresses
.iter()
.cloned()
.filter(|a| !a.iter().any(|p| p == Protocol::P2pCircuit))
.map(|a| a.with(Protocol::P2p(self.local_peer_id)))
.collect()
}

I'd argue this is kind of flawed. We don't need hole punching if we have external addresses. Instead, we should likely gather and use external address candidates as well as allow the user to add their own candidates to the this list.

Likely, this is a left-over from before we landed #3954.

@thomaseizinger thomaseizinger added the decision-pending Marks issues where a decision is pending before we can move forward. label Sep 13, 2023
@thomaseizinger
Copy link
Contributor Author

cc @mxinden @jxs

@mxinden
Copy link
Member

mxinden commented Sep 14, 2023

You are right. Good catch @thomaseizinger! libp2p-dcutr should use address candidates, e.g. reported through libp2p-identify.

@thomaseizinger thomaseizinger added difficulty:moderate help wanted bug and removed decision-pending Marks issues where a decision is pending before we can move forward. labels Sep 14, 2023
@thomaseizinger
Copy link
Contributor Author

You are right. Good catch @thomaseizinger! libp2p-dcutr should use address candidates, e.g. reported through libp2p-identify.

FTR: Instead of using ExternalAddresses, we should be taking addresses from FromSwarm::NewExternalAddrCandidate.

@thomaseizinger thomaseizinger self-assigned this Oct 11, 2023
@mergify mergify bot closed this as completed in #4624 Oct 26, 2023
mergify bot pushed a commit that referenced this issue Oct 26, 2023
In a serious of refactorings, we seem to have introduced a bug where we where exchanged the _external_ addresses of our node as part of `libp2p-dcutr`. This is ironically quite pointless. If we have external addresses, then there is no need for hole-punching (i.e. DCUtR).

Instead of gathering external addresses, we use an LRU cache to store our observed addresses. Repeatedly observed addresses will be tried first which should increase the success rate of a hole-punch.

Resolves: #4496.

Pull-Request: #4624.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants