Autonat doesn't support multiple addresses well
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Right now autonat sends concatenation of other_addresses and listen_addresses, which are always processed in the same order by receiving side:
https://github.com/libp2p/rust-libp2p/blob/caf9da4a69f1cce8183d4b17c792476ee44c37bc/protocols/autonat/src/behaviour/as_client.rs#L188-L206
If my understanding of the code is correct, only the first successfully dialed address will be returned.
This is problematic in case of multiple addresses though:
- out of multiple public addresses only the first one will be confirmed
- mix of public and private addresses doesn't seem to play very nicely with this either
I think the solution here is that either sender of the probe or receiver should shuffle addresses such that we check different addresses.
I'm not very familiar with autonat right now to understand if it is architecturally supposed to support this use case at all since confirmations will be done for different addresses in different calls.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in protocols/autonat/src/behaviour/as_client.rs at lines 188-206 and trace how other_addresses and listen_addresses are concatenated and processed by the receiving side. Determine whether multiple addresses are intended to be confirmed across probe calls, then define and validate behavior that handles multiple public and mixed public/private addresses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100