5822 Commits

Author SHA1 Message Date
Marco Munizaga
ffb05741eb docs: Update contribute section with mailing list and irc (#3387) 2025-09-25 19:12:30 +05:30
Marten Seemann
94bfb565ec README: remove Drand from notable users section 2025-09-20 21:49:53 -07:00
Marco Munizaga
9f5a948c94 chore: add help comment
I forgot macOS runs an old version of bash
2025-09-19 12:39:11 -07:00
cargoedit
c8e06bb688 refactor: replace context.WithCancel with t.Context
Signed-off-by: cargoedit <cargoedit@outlook.com>
2025-09-18 12:25:40 -07:00
Marco Munizaga
b3f1e66e26 feat(network): Add Conn.As
ConnAs works in a similar way to errors.As. It allows a user to cut
through the interface layers and extract a specific type of connection
if available.

This serves as a sort of escape hatch to allow users to leverage some
connection specific feature without having to support that feature for
all connections. Getting RTT information is one example.

It also allows us, within the library, to get specific types of
connections out of the interface box. This would have been useful in the
recent changes in tcpreuse. See
https://github.com/libp2p/go-libp2p/pull/3181 and
https://github.com/libp2p/go-libp2p/pull/3142.

Getting access to the underlying type can lead to hard to debug issues.
For example, if a user mutates connection state on the underlying type,
hooks that relied on only mutating that state from the wrapped
connection would never be called.

It is up to the user to ensure they are using this safely.
2025-09-08 14:11:08 -07:00
Marco Munizaga
3ecae665f1 Skip mdns tests on macOS in CI 2025-09-04 12:04:11 -07:00
Marcin Rataj
9afd260b32 fix: deduplicate NAT port mapping requests
Multiple libp2p transports can share the same port (TCP, QUIC,
WebTransport, WebRTC-direct), causing duplicate AddMapping calls
for the same protocol/port combination. This fix adds deduplication
in NAT.AddMapping to prevent redundant NAT device operations and
reduce log spam.
2025-09-04 12:04:11 -07:00
Marcin Rataj
8b798777dc fix: heal NAT mappings after router restart
Router restarts can cause UPnP/NAT-PMP services to change their
listening ports, leading to connection refused errors. This fix
implements automatic NAT rediscovery when consecutive connection
failures are detected, restoring all existing port mappings on
the new NAT instance.

See https://github.com/libp2p/go-libp2p/issues/3224#issuecomment-2866844723
for details on the router behavior that motivated this fix.
2025-09-04 12:04:11 -07:00
Antonio
95cad5091f feat: relay: add option for custom filter function 2025-09-03 20:18:40 -07:00
Marco Munizaga
72894e318a docs: remove broken link (#3375) 2025-08-25 14:34:11 -07:00
Marco Munizaga
c954da5e25 AI tooling must be disclosed for contributions (#3372) 2025-08-25 14:00:39 -07:00
Marco Munizaga
da810a1764 feat: Migrate to log/slog (#3364) 2025-08-25 14:00:01 -07:00
web3-bot
83d77757a2 ci: uci/update-go (#3371) 2025-08-20 14:18:56 -07:00
sukun
90b841260e basichost: move observed address manager to basichost (#3332) 2025-08-18 12:16:16 -07:00
Marco Munizaga
78f84c40c8 chore: support Go 1.24 & 1.25 (#3366) 2025-08-18 19:09:23 +05:30
Marco Munizaga
9f5945e189 feat(simlibp2p): Simulated libp2p Networks (#3262) 2025-08-15 09:44:03 -07:00
Carlos Peliciari
8e10f84961 bandwidthcounter: add Reset and TrimIdle methods to reporter interface (#3343) 2025-08-11 19:23:50 +05:30
sukun
0d37934033 network: rename NAT Types (#3331) 2025-08-11 19:21:00 +05:30
crStiv
62b9468d0c refactor(quicreuse): use errors.Join in Close method (#3363) 2025-08-08 17:14:09 -07:00
sukun
fc4a618881 swarm: move AddCertHashes to swarm (#3330) 2025-08-07 22:41:24 +05:30
Probot
02e583d319 quicreuse: clean up associations for closed listeners. (#3306)
Co-authored-by: Prithvi Shahi <shahi.prithvi@gmail.com>
Co-authored-by: sukun <sukunrt@gmail.com>
2025-08-07 22:39:44 +05:30
sukun
b75e678e64 Release v0.43 (#3353) v0.43.0 2025-08-07 21:02:01 +05:30
sukun
f6c14a215b chore: upgrade quic-go to v0.54.0 (#3351) 2025-07-31 11:46:38 -07:00
sukun
26a5710d35 basichost: fix deadlock with addrs_manager (#3348) 2025-07-30 17:08:12 +05:30
sukun
8e8f76abf6 basichost: fix Addrs docstring (#3341) 2025-07-28 20:04:04 +05:30
sukun
7b7c3ed4ce quic: upgrade quic-go to v0.53 (#3323) 2025-07-02 23:24:16 +02:00
sukun
000582cf2c Release v0.42.0 (#3318) v0.42.0 2025-06-18 21:48:03 +05:30
sukun
150f67b07c chore: update deps (#3312) v0.42.0-alpha-3 2025-06-17 18:46:23 +05:30
Piotr Galar
b0cc6503e5 ci: use go-check for golangci-lint (#3309) 2025-06-16 14:12:04 +05:30
sukun
90633f6ab3 mocknet: notify listeners on listen (#3310) 2025-06-15 22:37:24 +05:30
sukun
2d45a88295 autonatv2: add metrics (#3308) 2025-06-12 21:48:16 +05:30
Piotr Galar
b06bfecfc6 Merge pull request #3295 from libp2p/uci-golangci-lint
chore: fix errors reported by golangci-lint
2025-06-11 18:37:53 +01:00
galargh
735a7f0984 fix: revive in p2p transport tcp 2025-06-11 14:34:35 +01:00
galargh
2d4d2ee903 fix: golangci lint configuration 2025-06-11 14:34:29 +01:00
galargh
198e27ff11 chore: run gofmt 2025-06-11 11:15:11 +01:00
Piotr Galar
335c75a398 Merge branch 'master' into uci-golangci-lint 2025-06-11 10:42:45 +01:00
galargh
50f065b4df chore: fix revive issues 2025-06-11 10:00:47 +01:00
galargh
a0c9fdf2b3 chore: report all the issues from golangci 2025-06-11 10:00:39 +01:00
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.
v0.42.0-alpha
2025-06-10 21:02:18 +05:30
sukun
b82a39cb89 transport: rate limit new connections (#3283)
This rate limits new connections to prevent DoS attacks. 

For effectively rate limiting QUIC connections, we now gate QUIC connection attempts before the handshake, so that we don't spend compute on handshakes for connections that will eventually be cancelled. 

We can only set a single ConnContext per quic-go Transport, as there's only 1 listener per quic-go Transport. So we cannot set a different ConnContext for listeners on the same address. 

As we're now gating QUIC connections before the handshake, we use source address verification to ensure that spoofed IPs cannot DoS new connections from a particular IP. This is done by ensuring that some of the connection attempts always verify the source address. We get DoS protection at the expense of increased latency of source address verification.
2025-06-05 02:16:32 +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
galargh
6c15a3f3ff Revert "wip: testing uci golangci-lint support"
This reverts commit a96c3e14a7.
2025-06-03 11:56:05 +01:00
galargh
88d1e102f8 chore: fix golangci-lint errors 2025-06-02 09:51:53 +01:00
galargh
f702751935 chore: disable unused-param rule 2025-06-02 09:51:53 +01:00
galargh
3578f30176 chore: fix golangci-lint errors 2025-06-02 09:17:29 +01:00
galargh
2023a2707e chore: disable errcheck 2025-06-01 22:44:41 +01:00
Piotr Galar
a96c3e14a7 wip: testing uci golangci-lint support 2025-06-01 22:32:17 +01:00
Guillaume Michel
31c8c83308 chore: Revert "go-clock migration" (#3303) 2025-05-30 17:57:47 +05:30
web3-bot
4c254930f0 ci: update golangci-lint version (#3282)
Co-authored-by: Piotr Galar <piotr.galar@gmail.com>
2025-05-30 17:33:06 +05:30
GarmashAlex
853011ae73 tcp: ensure tcpGatedMaListener wrapping happens always (#3275) 2025-05-26 15:27:25 +05:30