Commit Graph

11 Commits

Author SHA1 Message Date
Marcin Rataj 41462353c6 feat: NonPublicAddrPublishing option (#3489)
Co-authored-by: Marco Munizaga <git@marcopolo.io>
2026-04-21 20:52:49 -07:00
Andrew Gillis e16f35e99a refactor: apply go fix modernizers from Go 1.26 (#3463)
Co-authored-by: sukun <sukunrt@gmail.com>
2026-02-26 12:40:50 -10:00
sukun 4f1ba59f36 basichost: don't advertise unreachable addrs. (#3357) 2025-10-06 19:38:55 +05:30
sukun 3e69227598 basichost: move EvtLocalAddrsChanged to addrs_manager (#3355) 2025-09-30 16:20:38 +05:30
sukun 90b841260e basichost: move observed address manager to basichost (#3332) 2025-08-18 12:16:16 -07:00
sukun fc4a618881 swarm: move AddCertHashes to swarm (#3330) 2025-08-07 22:41:24 +05:30
sukun 26a5710d35 basichost: fix deadlock with addrs_manager (#3348) 2025-07-30 17:08:12 +05:30
sukun 2d45a88295 autonatv2: add metrics (#3308) 2025-06-12 21:48:16 +05:30
sukun dbf7e1b972 autonatv2: add Unknown addrs to event (#3305)
Providing unknown addresses to the user, helps them infer whether autonatv2 has any more addresses it might confirm.

There's no upside to not sending this information.

This also changes host.ConfirmedAddrs to return all the three categories, Reachable, Unreachable, and Unknown addrs.
2025-06-10 21:02:18 +05:30
sukun fb1d9512e8 basichost: use autonatv2 to verify reachability (#3231)
This introduces addrsReachabilityTracker that tracks reachability on
a set of addresses. It probes reachability for addresses periodically
and has an exponential backoff in case there are too many errors
or we don't have any valid autonatv2 peer.

There's no smartness in the address selection logic currently. We just
test all provided addresses. It also doesn't use the addresses provided
by `AddrsFactory`, so currently there's no way to get a user provided
address tested for reachability, something that would be a problem for
dns addresses. I intend to introduce an alternative to
`AddrsFactory`, something like, `AnnounceAddrs(addrs []ma.Multiaddr)`
that's just appended to the set of addresses that we have, and check
reachability for those addresses.

There's only one method exposed in the BasicHost right now that's
`ReachableAddrs() []ma.Multiadd`r that returns the host's reachable
addrs. Users can also use the event `EvtHostReachableAddrsChanged`
to be notified when any addrs reachability changes.
2025-06-03 17:13:56 +05:30
sukun 5e6f217d84 addrsmanager: extract out addressing logic from basichost (#3075)
Benchmark for AllAddrs:

```
goos: linux
goarch: amd64
pkg: github.com/libp2p/go-libp2p
cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics
BenchmarkAllAddrs-16               16737            122245 ns/op           21240 B/op        218 allocs/op
```
after:
```
goos: linux
goarch: amd64
pkg: github.com/libp2p/go-libp2p
cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics
BenchmarkAllAddrs-16            11103236               105.7 ns/op           192 B/op          1 allocs/op
```
2025-02-27 22:24:57 +05:30