Commit Graph

5793 Commits

Author SHA1 Message Date
sukun
0cf29bdaf0 mocknet: notify listeners on listen v0.42.0-alpha-2 2025-06-13 00:12:15 +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
Guillaume Michel
97f29c5c20 Merge pull request #3293 from libp2p/go-clock-migration
go-clock migration
2025-05-22 10:23:35 +02:00
guillaumemichel
ea3a161aa8 bump go-flow-metrics 2025-05-22 10:10:24 +02:00
guillaumemichel
dd80260b70 go-clock migration 2025-05-21 10:07:42 +02:00
sukun
455a983b0e swarm_test: support more transports for GenSwarm (#3130) 2025-05-16 16:06:54 +05:30
sukun
a085837878 chore: use tcort/github-action-markdown-link-check (#3291)
The existing checker is consistently failing
2025-05-16 15:18:34 +05:30
Guillaume Michel
c1c77458c2 eventbus: change slow consumer event from error to warn (#3286)
Closes ipfs/kubo#10778
2025-05-15 23:41:34 +05:30
sukun
813d78c0ee quicreuse: add some documentation for the package (#3279)
This adds some helpful documentation for the package and explicitly specifies the reuse and association logic for ListenQUICAndAssociate and DialQUIC.
2025-05-15 14:40:35 +05:30
sukun
50d714c94c identify: rate limit id push protocol (#3266)
The rate limits id pushes from peers to one every five second with an allowed burst of 10 pushes. This should be enough for all but malfunctioning and malicious peers.

We can use the exact same code for autonat, autonatv2, circuit v2, etc.

Introducing limits to identify separately to get some feedback for #3265. For this PR, I'd like to ignore issues regarding where should this piece of code go, and focus on how specifically it should behave. See the long comment in rateLimiter.allow for example. 

Part of: #3265
2025-05-01 22:32:38 +05:30
Ocenka
effdc6525c fix(pstoreds): add missing log for failed GC record unmarshalling in purgeStore() (#3273) 2025-04-21 11:10:54 -07:00
VolodymyrBg
054c96a0c8 nat: improve port mapping failure logging (#3261) 2025-04-14 15:24:32 +05:30
sukun
4b7997256e ci: add golangci-lint for linting (#3269) 2025-04-14 15:21:03 +05:30
levisyin
58d21ca241 build(test_analysis): use modernc.org/sqlite directly (#3227) 2025-04-10 21:15:27 -07:00
vladopajic
2aa0bca834 chore(certificate): update test vectors (#3242) 2025-04-07 09:36:41 -07:00
sukun
8d6ceabd74 rcmgr: use netip.Prefix as map key instead of string (#3264) 2025-04-04 14:56:20 +05:30
sukun
803505d734 webrtc: support receiving 256kB messages (#3255)
In experiments with js we've found that increasing the message size
increases throughput. See: libp2p/specs#628 (comment)
for details. 

This changes the protobuf reader for the stream to read 256kB messages.
This also forces a change to the connection SCTP read buffer to be
increased to about 2.5 MB, to support 1 message being buffered for 10
streams.

This isn't enough to support larger messages. We most likely need to
change the inferred SDP of the server to use 256kB maxMessageSize, and
need some backwards compatible mechanism in the handshake to opt in to
large messages. See: libp2p/specs#628 for
details
2025-04-01 16:18:42 +05:30
sukun
74e6e2c9ed peerstore: remove leveldb tests (#3260)
This also removes the go-leveldb-datastore dependency. There's no
reason to test with levelDB. This code should work with any compliant
go-datastore.

Bumps go-datastore to latest as it removes the go-process dependency.

Fixes: #3250
2025-04-01 13:35:31 +05:30
sukun
4c2639e7ce identify: reduce timeout to 5 seconds (#3259)
The max message size is about 100kB. 5 seconds are enough to transfer this.
2025-04-01 13:35:06 +05:30
b00f
88b1a70f24 fix(relay): fix data-race in relayFinder (#3258)
`relayFinder.relays` should only be accessed with the `relayMx` held
2025-03-31 19:50:49 +05:30
Piotr Galar
17fd61051d Merge pull request #3254 from libp2p/uci/copy-templates
ci: uci/copy-templates
2025-03-28 19:05:41 +01:00
Prithvi Shahi
f8c19263cf Merge branch 'master' into uci/copy-templates 2025-03-28 09:24:14 -07:00
Marcin Rataj
6bcefdc3d1 chore: update p2p-forge to v0.5.0 for autotls example (#3257) 2025-03-28 12:07:12 +05:30
web3-bot
96318bce3b chore: add or force update .github/workflows/generated-pr.yml 2025-03-27 02:06:46 +00:00
web3-bot
d0b5129827 chore: add or force update .github/workflows/stale.yml 2025-03-27 02:06:46 +00:00
sukun
61f03f45a4 peerstore: remove unused badger tests (#3252)
We were testing with both badger and LevelDB. Removing badger as just testing with LevelDB should be enough. Not sure if we need LevelDB either, but for now just removing badger as it is any way unused.

See: #3250
2025-03-26 13:50:53 +05:30
argentpapa
92aa563331 chore: using t.TempDir() instead of os.MkdirTemp (#3222) 2025-03-26 00:41:33 +05:30
Marcin Rataj
2e810f7de4 chore(examples): p2p-forge/client v0.4.0 (#3211) 2025-03-26 00:40:36 +05:30
sukun
6249e685e9 transport: add GatedMaListener type (#3186)
This introduces a new GatedMaListener type which gates conns
accepted from a manet.Listener with a gater and creates the rcmgr
scope for it. Explicitly passing the scope allows for many guardrails
that the previous interface assertion didn't.

This breaks the previous responsibility of the upgradeListener method
into two, one gating the connection initially, and the other upgrading
the connection with a security and muxer selection.

This split makes it easy to gate the connection with the resource
manager as early as possible. This is especially true for websocket
because we want to gate the connection just after the TCP connection is
established, and not after the tls handshake + websocket upgrade is
completed.
2025-03-25 22:09:57 +05:30
sukun
8430ad3e2f autonatv2: explicitly handle dns addrs (#3249) 2025-03-24 23:43:37 +05:30
sukun
0682ad7c50 autonatv2: fix server dial data request policy (#3247) 2025-03-24 21:34:39 +05:30