Releases: libp2p/go-libp2p
v0.43.0
Highlights
This is a small release to allow users to upgrade to the latest quic-go version as the quic-go API was changed heavily in quic-go v0.53
What's Changed
- quic: upgrade quic-go to v0.53 by @sukunrt in #3323
- basichost: fix Addrs docstring by @sukunrt in #3341
- basichost: fix deadlock with addrs_manager by @sukunrt in #3348
- chore: upgrade quic-go to v0.54.0 by @sukunrt in #3351
Full Changelog: v0.42.0...v0.43.0
v0.42.1
What's Changed
- addrsmanager: extract out addressing logic from basichost by @sukunrt in #3075
- fix: fix incorrect nil return value by @huochexizhan in #3219
- fix(libp2phttp): bound NewStream timeout by @algorandskiy in #3225
- webrtc: fix memory leak with udpmux.muxedConnection context by @sukunrt in #3243
- connmgr: fix transport association bug by @sukunrt in #3221
- connmgr: remove WithEmergencyTrim by @sukunrt in #3217
- fix: Add wrapped error type in
stream.go
by @Prabhat1308 in #3237 - autonatv2: fix server dial data request policy by @sukunrt in #3247
- autonatv2: explicitly handle dns addrs by @sukunrt in #3249
- transport: add GatedMaListener type by @sukunrt in #3186
- chore(examples): p2p-forge/client v0.4.0 by @lidel in #3211
- optimize: using t.TempDir() replace os.MkdirTemp in testfile by @argentpapa in #3222
- peerstore: remove unused badger tests by @sukunrt in #3252
- chore: p2p-forge v0.5.0 by @lidel in #3257
- ci: uci/copy-templates by @web3-bot in #3254
- fix(relay): fix data-race in relayFinder by @b00f in #3258
- identify: reduce timeout to 5 seconds by @sukunrt in #3259
- peerstore: remove leveldb tests by @sukunrt in #3260
- webrtc: support receiving 256kB messages by @sukunrt in #3255
- rcmgr: use netip.Prefix as map key instead of string by @sukunrt in #3264
- chore(certificate): update test vectors by @vladopajic in #3242
- build(test_analysis): use
modernc.org/sqlite
directly by @levisyin in #3227 - ci: add golangci-lint for linting by @sukunrt in #3269
- fix: Improve NAT port mapping failure logging by @VolodymyrBg in #3261
- Add missing log for failed GC record unmarshalling in
purgeStore()
by @vipocenka in #3273 - identify: rate limit id push protocol by @sukunrt in #3266
- quicreuse: add some documentation for the package by @sukunrt in #3279
- eventbus: change slow consumer event from error to warn by @guillaumemichel in #3286
- chore: use tcort/github-action-markdown-link-check by @sukunrt in #3291
- swarm_test: support more transports for GenSwarm by @sukunrt in #3130
- go-clock migration by @guillaumemichel in #3293
- fix: Ensure tcpGatedMaListener wrapping on both metrics and non-metri… by @GarmashAlex in #3275
- ci: uci/copy-templates by @web3-bot in #3282
- Revert "go-clock migration" by @guillaumemichel in #3303
- basichost: use autonatv2 to verify reachability by @sukunrt in #3231
- quic: gate connections before handshake by @sukunrt in #3283
- autonatv2: add Unknown addrs to event by @sukunrt in #3305
- chore: fix errors reported by golangci-lint by @galargh in #3295
- autonatv2: add metrics by @sukunrt in #3308
- mocknet: notify listeners on listen by @sukunrt in #3310
- ci: go-check now support golangci-lint by @galargh in #3309
- chore: update deps by @sukunrt in #3312
- Release v0.42.0 by @sukunrt in #3318
New Contributors
- @huochexizhan made their first contribution in #3219
- @algorandskiy made their first contribution in #3225
- @Prabhat1308 made their first contribution in #3237
- @argentpapa made their first contribution in #3222
- @b00f made their first contribution in #3258
- @vladopajic made their first contribution in #3242
- @levisyin made their first contribution in #3227
- @VolodymyrBg made their first contribution in #3261
- @vipocenka made their first contribution in #3273
- @GarmashAlex made their first contribution in #3275
Full Changelog: v0.41.0...v0.42.1
v0.42.0
⚠ Breaking Changes
Added a new method, VerifySourceAddress(net.Addr) bool
, to the Resource Manager interface.
For more details see the Source Address Verification section.
For custom implementation which want to opt out of Source Address Verification and keep the existing behavior, return false
from the method.
🔦 Highlights
Per Address Reachability via AutoNAT v2
libp2p hosts can now determine reachability for individual addresses using AutoNATV2. To opt in to reachability checking use the EnableAutoNATV2
libp2p option. Using this nodes can now determine their IPv4, IPv6, and browser address reachability separately. In a future release, AutoRelay will use this information and make appropriate relay reservations accordingly. https://pkg.go.dev/github.com/libp2p/go-libp2p#EnableAutoNATv2
To query addresses by their reachability, ConfirmedAddrs() (reachable, unreachable, unknown []ma.Multiaddr)
that provides Reachability information per host address. https://pkg.go.dev/github.com/libp2p/go-libp2p/p2p/host/basic#BasicHost.ConfirmedAddrs
For notifications, Subscribe to the event event.EvtHostReachableAddrsChanged
https://pkg.go.dev/github.com/libp2p/go-libp2p/core/event#EvtHostReachableAddrsChanged
Rate Limiting
We've introduced the package github.com/libp2p/go-libp2p/x/rate
for rate limiting. The struct rate.Limiter
provides Global, Network Specific, and Subnet Specific rate limiting. The Subnet specific rate limits allows for better DoS Protection by rate limiting malicious IPs. https://pkg.go.dev/github.com/libp2p/go-libp2p/x/rate
Use Limit(f func(s network.Stream)) func(s network.Stream)
on Limiter
to limit specific stream handlers. For example, within libp2p, the Identify Service uses this as
ids.Host.SetStreamHandler(IDPush, ids.rateLimiter.Limit(ids.handlePush))
to rate limit the number of times peers can perform identify push.
For non Stream use cases use the Allow(ip)
method on the limiter.
Connection Rate Limiting
New connection requests are now rate limited per IP. By default we allow 1 connection every 5 seconds from an IP address with a burst of 16 connections per IP. The burst is high enough that this should only block malicious peers.
To configure the connection rate limits, use the WithConnRateLimiters
option on the Resource Manager. https://pkg.go.dev/github.com/libp2p/go-libp2p/p2p/host/resource-manager#WithConnRateLimiters
Source Address Verification for QUIC
This release introduces Source Address Verification for QUIC, preventing DoS attacks by spoofing IP addresses. See: https://www.rfc-editor.org/rfc/rfc9000.html#section-8 for details.
We are now gating incoming QUIC connections before the handshake is started. This further improves DoS protection by not wasting CPU on handshaking QUIC connections which would have been dropped by the Resource Manager.
Other changes
- WebRTC Direct peers can now send messages of up to 256 kB (see spec: libp2p/specs#628)
- Refactored the addressing code within BasicHost and moved it into Address Manager. In a future release, this will be exposed to users with an improved Address API for the libp2p Host.
What's Changed
- addrsmanager: extract out addressing logic from basichost by @sukunrt in #3075
- fix: fix incorrect nil return value by @huochexizhan in #3219
- fix(libp2phttp): bound NewStream timeout by @algorandskiy in #3225
- webrtc: fix memory leak with udpmux.muxedConnection context by @sukunrt in #3243
- connmgr: fix transport association bug by @sukunrt in #3221
- connmgr: remove WithEmergencyTrim by @sukunrt in #3217
- fix: Add wrapped error type in
stream.go
by @Prabhat1308 in #3237 - autonatv2: fix server dial data request policy by @sukunrt in #3247
- autonatv2: explicitly handle dns addrs by @sukunrt in #3249
- transport: add GatedMaListener type by @sukunrt in #3186
- chore(examples): p2p-forge/client v0.4.0 by @lidel in #3211
- optimize: using t.TempDir() replace os.MkdirTemp in testfile by @argentpapa in #3222
- peerstore: remove unused badger tests by @sukunrt in #3252
- chore: p2p-forge v0.5.0 by @lidel in #3257
- ci: uci/copy-templates by @web3-bot in #3254
- fix(relay): fix data-race in relayFinder by @b00f in #3258
- identify: reduce timeout to 5 seconds by @sukunrt in #3259
- peerstore: remove leveldb tests by @sukunrt in #3260
- webrtc: support receiving 256kB messages by @sukunrt in #3255
- rcmgr: use netip.Prefix as map key instead of string by @sukunrt in #3264
- chore(certificate): update test vectors by @vladopajic in #3242
- build(test_analysis): use
modernc.org/sqlite
directly by @levisyin in #3227 - ci: add golangci-lint for linting by @sukunrt in #3269
- fix: Improve NAT port mapping failure logging by @VolodymyrBg in #3261
- Add missing log for failed GC record unmarshalling in
purgeStore()
by @vipocenka in #3273 - identify: rate limit id push protocol by @sukunrt in #3266
- quicreuse: add some documentation for the package by @sukunrt in #3279
- eventbus: change slow consumer event from error to warn by @guillaumemichel in #3286
- chore: use tcort/github-action-markdown-link-check by @sukunrt in #3291
- swarm_test: support more transports for GenSwarm by @sukunrt in #3130
- go-clock migration by @guillaumemichel in #3293
- fix: Ensure tcpGatedMaListener wrapping on both metrics and non-metri… by @GarmashAlex in #3275
- ci: uci/copy-templates by @web3-bot in #3282
- Revert "go-clock migration" by @guillaumemichel in #3303
- basichost: use autonatv2 to verify reachability by @sukunrt in #3231
- quic: gate connections before handshake by @sukunrt in #3283
- autonatv2: add Unknown addrs to event by @sukunrt in #3305
- chore: fix errors reported by golangci-lint by @galargh in #3295
- autonatv2: add metrics by @sukunrt in #3308
- mocknet: notify listeners on listen by @sukunrt in #3310
- ci: go-check now support golangci-lint by @galargh in #3309
- chore: update deps by @sukunrt in #3312
New Contributors
- @huochexizhan made their first contribution in #3219
- @algorandskiy made their first contribution in #3225
- @Prabhat1308 made their first contribution in #3237
- @argentpapa made their first contribution in #3222
- @b00f made their first contribution in #3258
- @vladopajic made their first contribution in #3242
- @levisyin made their first contribution in #3227
- @VolodymyrBg made their first contribution in #3261
- @vipocenka made their first contribution in #3273
- @GarmashAlex made their first contribution in #3275
Full Changelog: v0.41.0...v0.42.0
v0.41.1
What's Changed
7059eb5 conngater: fix incorrect err return value (#3219)
74c6860 fix(libp2phttp): bound NewStream timeout (#3225)
ccc4849 webrtc: fix memory leak with udpmux.muxedConnection context (#3243)
99a511f connmgr: fix transport association bug (#3221)
eb3ff9f autonatv2: fix server dial data request policy (#3247)
8ce45df Release v0.41.1
Full Changelog: v0.41.0...v0.41.1
v0.41.0
⚠︎ Breaking Changes
- This release updates go-multiaddr to v0.15 which has some breaking changes. This should not affect most users, but reference the go-multiaddr v0.15.0 release notes for breaking changes: https://github.com/multiformats/go-multiaddr/releases/tag/v0.15.0.
🔦 Highlights
Overall this is a fairly minor release focused on supporting the go-multiaddr v0.15.0.
- Update to go-multiaddr v0.15. This is a pretty big release for go-multiaddr that should make it harder to misuse. See the v0.15.0 release notes for breaking changes: https://github.com/multiformats/go-multiaddr/releases/tag/v0.15.0
- Uniform HTTP Peer ID Auth over native HTTP transport and HTTP over libp2p streams. See the http.Host Autthenticated HTTP example in the Go doc for an example of usage.
- Some upnp fixes that should make upnp/nat-pmp more reliable and easier to debug. This fixes an issue with FRITZ!Box routers.
What's Changed
- ci: uci/update-go by @web3-bot in #3195
- autorelay: send addresses on eventbus; dont wrap address factory by @sukunrt in #3071
- basichost: add certhashes to addrs in place by @sukunrt in #3200
- chore: move go-nat to internal package by @MarcoPolo in #3154
- chore: update quic-go to v0.50.0 by @MarcoPolo in #3204
- chore: Update go-multiaddr to v0.15 by @MarcoPolo in #3145
- chore(identify): move log to debug level by @lidel in #3206
- feat(libp2phttp): More ergonomic auth by @MarcoPolo in #3188
- fix(dcutr): Fix end to end tests and add legacy behavior flag (default=true) by @MarcoPolo in #3044
- fix(libp2phttp): Fix relative to absolute multiaddr URI logic (#3208) @MarcoPolo
Full Changelog: v0.40.0...v0.41.0
v0.40.0
⚠ Breaking Change!
Introducing error codes mandated changing the error types returned by stream resets. All checks that depended on checking the error string or comparing equality with network.ErrReset
, now need to use errors.Is(err, network.ErrReset)
. More details below in the error codes section.
🔦 Highlights
Error Codes
This releases introduces error codes for Stream Reset and Connection Close. This allows sending for more information to the peer about the error condition causing the abort. go-libp2p has already defined some error codes which are useful for many different use cases. You can find them in:
https://pkg.go.dev/github.com/libp2p/go-libp2p@v0.40.0/core/network#StreamErrorCode
and: https://pkg.go.dev/github.com/libp2p/go-libp2p@v0.40.0/core/network#ConnErrorCode
On streams, you can signal an error on reset by using:
str.ResetWithError(errCode)
On connections, you can signal an error on close by using:
conn.ResetWithError(errCode)
Not all transports support error codes. Most notably, WebTransport has no support for sending error codes at the moment. See the spec: libp2p/specs#623 for more details.
If you want to define custom error codes for your application protocol, you can reserve a block for your application by opening a PR in the specs repo. The above mentioned spec has details on reserving error codes for applications. Until the spec is merged, you must open a PR targeting the spec's branch.
Breaking Change!
This introduces a breaking change for users who checked stream reset errors by testing for equality with network.ErrReset
as err == network.ErrReset
. These tests now need to use the errors.Is(err, network.ErrReset)
test. Stream Resets now return either *network.StreamError
if the stream was reset by remote, or *network.ConnError
if the connection was closed by remote.
What's Changed
- chore: update pion/ice to v4 by @achingbrain in #3175
- Implement error codes spec by @sukunrt in #2927
- swarm: remove unnecessary error log by @sukunrt in #3128
- test(p2p/protocol/identify): Fix user agent assertion in Go 1.24 by @Jorropo in #3177
- feat(swarm): logging waitForDirectConn return error by @wlynxg in #3183
- feat: add AutoTLS example by @2color in #3103
- autonatv2: allow multiple concurrent requests per peer by @sukunrt in #3187
New Contributors
- @achingbrain made their first contribution in #3175
Full Changelog: v0.39.0...v0.40.0
v0.39.1
What's Changed
- fix: fix comment by @linchizhen in #3124
- ci: get back on the main release track of release checker by @galargh in #3117
- Upgrade pion/webrtc to v4 by @badgooooor in #3098
- tcp: fix metrics test build directive by @sukunrt in #3052
- Update contribution guidelines by @MarcoPolo in #3134
- tcpreuse: error on using tcpreuse with pnet by @sukunrt in #3129
- nat: ignore mapping if external port is 0 by @sukunrt in #3094
- quicreuse: make it possible to use an application-constructed quic.Transport by @marten-seemann in #3122
- test: fix failing test by @MarcoPolo in #3141
- fix(net/nat): data race problem of
extAddr
by @wlynxg in #3140 - tcpreuse: fix rcmgr accounting when tcp metrics are enabled by @sukunrt in #3142
- ci: move to actions/upload-artifact@v4 by @MarcoPolo in #3152
- feat(transport/websocket): support SOCKS proxy with wss by @MarcoPolo in #3137
- Update quic-go to v0.49.0 by @MarcoPolo in #3153
- feat: Implement Custom TCP Dialers by @MarcoPolo in #3166
- feat(holepunch): add logging when DirectConnect execution fails by @wlynxg in #3146
- chore: update dependencies by @MarcoPolo in #3173
- chore: release v0.39.0 by @MarcoPolo in #3174
New Contributors
- @linchizhen made their first contribution in #3124
- @badgooooor made their first contribution in #3098
Full Changelog: v0.38.1...v0.39.1
v0.38.3
What's Changed
- fix(autorelay): Move relayFinder peer disconnect cleanup to separate goroutine by @MarcoPolo in #3105
- ci: Install specific protoc version when generating protobufs by @MarcoPolo in #3112
- fix(httpauth): Correctly handle concurrent requests on server by @MarcoPolo in #3111
- Release v0382 by @sukunrt in #3147
Full Changelog: v0.38.0...v0.38.3
v0.39.0
🔦 Highlights
This is a small release. The main thing is updating quic-go to v0.49.0 and enabling specific environments with the new WithDialerForAddr
option.
Changelog
- Update quic-go to v0.49.0 #3153
- Support application provided
quic.Transport
s @marten-seemann in #3122 - Support SOCKS proxy with ws(s) #3137
- Support WithDialerForAddr for running TCP over arbitrary user-defined proxies. #3166
Full Changelog: v0.38.1...v0.39.0
v0.38.2
What's Changed
a4433e7 Release v0.38.2
9e08a02 tcpreuse: fix rcmgr accounting when tcp metrics are enabled (#3142)
6735dd5 fix(net/nat): data race problem of extAddr
(#3140)
1ebb404 test: fix failing test (#3141)
8f09a3e nat: ignore mapping if external port is 0 (#3094)
1529945 tcpreuse: error on using tcpreuse with pnet (#3129)
7397e65 chore: Update contribution guidelines (#3134)
05b4afe tcp: fix metrics test build directive (#3052)
1a2387c ci: get back on the main release track of release checker (#3117)
051fe11 webtransport: fix docstring comment for getCurrentBucketStartTime
Full Changelog: v0.38.1...v0.38.2