Releases: libp2p/go-libp2p
v0.26.4
v0.26.3
What's Changed
- release v0.26.1 by @marten-seemann in #2146
- rcmgr: fix JSON marshalling of ResourceManagerStat peer map by @MarcoPolo in #2156
- retract v0.26.1, release v0.26.2 by @marten-seemann in #2153
- websocket: Don't limit message sizes in the websocket reader by @MarcoPolo in #2193
Full Changelog: v0.26.0...v0.26.3
v0.26.2
v0.26.1
Retracted
This release included some changes not intended for a patch release. The issue came from a bug in our release automation tooling. More details here: #2153.
New release coming soon.
What's Changed
- chore: update examples to v0.26.0 by @marten-seemann in #2134
- swarm: Check context once more before dialing by @MarcoPolo in #2139
- basic_host: Fix flaky tests by @MarcoPolo in #2136
- examples: Add sleep to fix flaky test by @MarcoPolo in #2129
- identify: Bump timeouts/sleep in tests by @MarcoPolo in #2135
- identify: Fix flaky TestMetricsNoAllocNoCover test by @MarcoPolo in #2142
- relay: initialize the ASN util when starting the service by @marten-seemann in #2143
- swarm: emit PeerConnectedness event from swarm instead of from hosts by @marten-seemann in #1574
- connmgr: Use eventually equal helper in connmgr tests by @MarcoPolo in #2128
- swarm metrics: fix connection direction by @sukunrt in #2147
- chore: update webtransport-go to v0.5.2 by @marten-seemann in #2149
- autonat: don't use autonat for address discovery by @sukunrt in #2148
Full Changelog: v0.26.0...v0.26.1
v0.26.0
π¦ Highlights
Circuit Relay Changes
Removed Circuit Relay v1
We've decided to remove support for Circuit Relay v1 in this release. v1 Relays have been retired a few months ago. Notably, running the Relay v1 protocol was expensive and resulted in only a small number of nodes in the network. Users had to either manually configure these nodes as static relays, or discover them from the DHT.
Furthermore, rust-libp2p has dropped support and js-libp2p is dropping support for Relay v1.
Support for Relay v2 was first added in late 2021 in v0.16.0. With Circuit Relay v2 it became cheap to run (limited) relays. Public nodes also started the relay service by default. There's now a massive number of Relay v2 nodes on the IPFS network, and they don't advertise their service to the DHT any more. Because there's now so many of these nodes, connecting to just a small number of nodes (e.g. by joining the DHT), a node is statistically guaranteed to connect to some relays.
Unlimited Relay v2
In conjunction with removing relay v1, we also added an option to Circuit Relay v2 to disable limits.
This done by enabling WithInfiniteLimits
. When enabled this allows for users to have a drop in replacement for Relay v1 with Relay v2.
Additional metrics
Since the last release, we've added additional metrics to different components.
Metrics were added to:
- AutoNat: Current Reachability Status and Confidence, Client and Server DialResponses, Server DialRejections. The dashboard is available here.
- Swarm:
- Early Muxer Selection: Added early_muxer label indicating whether a connection was established using early muxer selection.
- IP Version: Added ip_version label to connection metrics
- Identify:
We also migrated the metric dashboards to a top-level dashboards directory.
Changelog
- github.com/libp2p/go-libp2p:
- identify: add more detailed metrics (#2126) (libp2p/go-libp2p#2126)
- autorelay: refactor relay finder and start autorelay after identify (#2120) (libp2p/go-libp2p#2120)
- don't use the time value from the time.Ticker channel (#2127) (libp2p/go-libp2p#2127)
- Wrap conn with metrics (#2131) (libp2p/go-libp2p#2131)
- chore: update changelog for 0.26.0 (#2132) (libp2p/go-libp2p#2132)
- chore: update quic-go to v0.33.0 (#2124) (libp2p/go-libp2p#2124)
- circuitv2: Update proto files to proto3 (#2121) (libp2p/go-libp2p#2121)
- swarm: remove parallel tests from swarm tests (#2130) (libp2p/go-libp2p#2130)
- circuitv2: add a relay option to disable limits (#2125) (libp2p/go-libp2p#2125)
- quic: fix stalled virtual listener (#2122) (libp2p/go-libp2p#2122)
- swarm: add early muxer selection to swarm metrics (#2119) (libp2p/go-libp2p#2119)
- metrics: add options to disable metrics and to set Prometheus registerer (#2116) (libp2p/go-libp2p#2116)
- swarm: add ip_version to metrics (#2114) (libp2p/go-libp2p#2114)
- Revert mistaken "Bump timeout"
- Bump timeout
- remove all circuit v1 related code (#2107) (libp2p/go-libp2p#2107)
- quic: don't send detailed error messages when closing connections (#2112) (libp2p/go-libp2p#2112)
- metrics: add no alloc metrics for eventbus, swarm, identify (#2108) (libp2p/go-libp2p#2108)
- chore: fix typo in Changelog (#2111) (libp2p/go-libp2p#2111)
- chore: update changelog (#2109) (libp2p/go-libp2p#2109)
- chore: unify dashboard location (#2110) (libp2p/go-libp2p#2110)
- autonat: add metrics (#2086) (libp2p/go-libp2p#2086)
- relaymanager: do not start new relay if one already exists (#2093) (libp2p/go-libp2p#2093)
- autonat: don't emit reachability changed events on address change (#2092) (libp2p/go-libp2p#2092)
- chore: update release.md (#2090) (libp2p/go-libp2p#2090)
- chore: modify changelog entries (#2101) (libp2p/go-libp2p#2101)
- Introduce a changelog (#2084) (libp2p/go-libp2p#2084)
- use atomic.Int32 and atomic.Int64 (#2096) (libp2p/go-libp2p#2096)
- change atomic.Value to atomic.Pointer (#2088) (libp2p/go-libp2p#2088)
- interop-tests: use new action with s3 caching (#2076) (libp2p/go-libp2p#2076)
- use atomic.Bool instead of int32 operations (#2089) (libp2p/go-libp2p#2089)
- chore: update examples to v0.25.1 (#2080) (libp2p/go-libp2p#2080)
Contributors
Contributor | Commits | Lines Β± | Files Changed |
---|---|---|---|
Sukun | 11 | +2979/-696 | 76 |
Marten Seemann | 5 | +52/-3619 | 33 |
Marco Munizaga | 11 | +865/-520 | 35 |
Prithvi Shahi | 5 | +66/-21 | 10 |
Full Changelog: v0.25.1...v0.26.0
v0.25.1
What's Changed
Patch update to fix some test-utils used by https://github.com/libp2p/go-libp2p-kad-dht
See the release notes for v0.25.0 for more details on this release.
- mocknet: Start host in mocknet by @MarcoPolo in #2078
- chore: update go-multistream by @MarcoPolo in #2081
Full Changelog: v0.25.0...v0.25.1
v0.25.0
π¦ Highlights
Metrics
We've started instrumenting the entire stack. In this release, we're adding metrics for:
- the swarm: tracking incoming and outgoing connections, transports, security protocols and stream multiplexers in sue: (https://github.com/libp2p/go-libp2p/blob/master/p2p/net/swarm/grafana-dashboards/swarm.json)
- the event bus: tracking how different events are propagated through the stack and to external consumers (https://github.com/libp2p/go-libp2p/blob/master/p2p/host/eventbus/grafana-dashboards/eventbus.json)
Our metrics effort is still ongoing, see #1356 for progress. We'll add metrics and dashboards for more libp2p components in a future release.
Switching to Google's official Protobuf compiler
So far, we were using GoGo Protobuf to compile our Protobuf definitions to Go code. However, this library was deprecated in October last year: https://twitter.com/awalterschulze/status/1584553056100057088. We benchmarked serialization and deserialization, and found that it's (only) 20% slower than GoGo. Since the vast majority of go-libp2p's CPU time is spent in code paths other than Protobuf handling, switching to the official compiler seemed like a worthwhile tradeoff.
Removal of OpenSSL
Before this release, go-libp2p had an option to use OpenSSL bindings for certain cryptographic primitives, mostly to speed up the generation of signatures and their verification. When building go-libp2p using go build
, we'd use the standard library crypto packages. OpenSSL was only used when passing in a build tag: go build -tags openssl
.
Maintaining our own fork of the long unmaintained go-openssl package has proven to place a larger than expected maintenance burden on the libp2p stewards, and when we recently discovered a range of new bugs (this and this and this), we decided to re-evaluate if this code path is really worth it. The results surprised us, it turns out that:
- The Go standard library is faster than OpenSSL for all key types that are not RSA.
- Verifying RSA signatures is as fast as Ed25519 signatures using the Go standard library, and even faster in OpenSSL.
- Generating RSA signatures is painfully slow, both using Go standard library crypto and using OpenSSL (but even slower using Go standard library).
Now the good news is, that if your node is not using an RSA key, it will never create any RSA signatures (it might need to verify them though, when it connects to a node that uses RSA keys). If you're concerned about CPU performance, it's a good idea to avoid RSA keys (the same applies to bandwidth, RSA keys are huge!). Even for nodes using RSA keys, it turns out that generating the signatures is not a significant part of their CPU load, as verified by profiling one of Kubo's bootstrap nodes.
We therefore concluded that it's safe to drop this code path altogether, and thereby reduce our maintenance burden.
New Resource Manager types
- Introduces a new type
LimitVal
which can explicitly specify "use default", "unlimited", "block all", as well as any positive number. The zero value ofLimitVal
(the value when you create the object in Go) is "Use default".- The JSON marshalling of this is straightforward.
- Introduces a new
ResourceLimits
type which usesLimitVal
instead of ints so it can encode the above for the resources. - Changes
LimitConfig
toPartialLimitConfig
and usesResourceLimits
. This along with the marshalling changes means you can now marshal the fact that some resource limit is set to block all.- Because the default is to use the defaults, this avoids the footgun of initializing the resource manager with 0 limits (that would block everything).
In general, you can go from a resource config with defaults to a concrete one with .Build()
. e.g. ResourceLimits.Build() => BaseLimit
, PartialLimitConfig.Build() => ConcreteLimitConfig
, LimitVal.Build() => int
. See PR #2000 for more details.
If you're using the defaults for the resource manager, there should be no changes needed.
Resource Manager optimized metrics
We moved away from OpenCensus to the prometheus SDK. Metrics hot path now has no allocations and a test to ensure this behavior in the future. See #1955 for more details.
Websockets: change underlying library
From the unmantained https://github.com/gorilla/websocket to https://github.com/nhooyr/websocket. More details here: #1982.
Other Breaking Changes
We've cleaned up our API to consistently use protocol.ID
for libp2p and application protocols. Specifically, this means that the peer store now uses protocol.ID
s, and the host's SetStreamHandler
as well.
What's Changed
- chore: use generic LRU cache by @muXxer in #1980
- core/crypto: drop all OpenSSL code paths by @marten-seemann in #1953
- add WebTransport to the list of default transports by @marten-seemann in #1915
- identify: remove old code targeting Go 1.17 by @marten-seemann in #1964
- core: remove introspection package by @marten-seemann in #1978
- identify: remove support for Identify Delta by @marten-seemann in #1975
- roadmap: remove optimizations of the TCP-based handshake by @marten-seemann in #1959
- circuitv2: correctly set the transport in the ConnectionState by @marten-seemann in #1972
- switch to Google's Protobuf library, make protobufs compile with go generate by @marten-seemann in #1979
- ci: run go generate as part of the go-check workflow by @marten-seemann in #1986
- ci: use GitHub token to install protoc by @marten-seemann in #1996
- feat: add some users to the readme by @p-shahi in #1981
- CI: Fast multidimensional Interop tests by @MarcoPolo in #1991
- Fix: Ignore zero values when marshalling Limits. by @ajnavarro in #1998
- feat: add ci flakiness score to readme by @MarcoPolo in #2002
- peerstore: make it possible to use an empty peer ID by @marten-seemann in #2006
- feat: rcmgr: Export resource manager errors by @MarcoPolo in #2008
- feat: ci test-plans: Parse test timeout parameter for interop test by @MarcoPolo in #2014
- Clean addresses with peer id before adding to addrbook by @sukunrt in #2007
- Expose muxer ids by @aschmahmann in #2012
- swarm: add a basic metrics tracer by @marten-seemann in #1973
- consistently use protocol.ID instead of strings by @sukunrt in #2004
- swarm metrics: fix datasource for dashboard by @MarcoPolo in #2024
- chore: remove textual roadmap in favor for Starmap by @p-shahi in #2036
- rcmgr: *: Always close connscope by @MarcoPolo in #2037
- chore: remove license files from the eventbus package by @marten-seemann in #2042
- Migrate to test-plan composite action by @thomaseizinger in #2039
- use quic-go and webtransport-go from quic-go organization by @marten-seemann in #2040
- holepunch: fix flaky test by not removing holepunch protocol handler by @marten-seemann in #1948
- quic / webtransport: extend test to test dialing a draft-29 and a v1 by @marten-seemann in #1957
- p2p/test: add test for EvtLocalAddressesUpdated event by @marten-seemann in #2016
- quic, tcp: only register Prometheus counters when metrics are enabled by @marten-seemann in #1971
- p2p/test: fix flaky notification test by @marten-seemann in #2051
- quic: disable sending of Version Negotiation packets by @marten-seemann in #2015
- eventbus: add metrics by @sukunrt in #2038
- metrics: use a single slice pool for all metrics tracer by @marten-seemann in #2054
- webtransport: tidy up some test output by @MarcoPolo in #2053
- set names for eventbus event subscriptions by @marten-seemann in #2057
- autorelay: Split libp2p.EnableAutoRelay into 2 functions by @sukunrt in #2022
- rcmgr: Use prometheus SDK for rcmgr metrics by @MarcoPolo in #2044
- websocket: Replace gorilla websocket transport with nhooyr websocket transport by @MarcoPolo in #1982
- rcmgr: add libp2p prefix to all metrics by @marten-seemann in https://github.com/libp2p/go-libp...
v0.24.2
This patch release fixes two panics that could occur in the WebTransport code path.
What's Changed
- webtransport: initialize a NullResourceManager if none is provided by @marten-seemann in #1962
- webtransport: update webtransport-go to v0.4.3 by @marten-seemann in #1968
Full Changelog: v0.24.1...v0.24.2
v0.24.1
This patch release:
- fixes a race condition in WebTransport, leading to streams not being accepted occasionally: quic-go/webtransport-go#53
- includes the role (remote / local) in QUIC error messages: quic-go/quic-go#3629
- fixes a bug in the routed host, that didn't always report the right error on connection failures: #1946
What's Changed
- webtransport: update webtransport-go to v0.4.2 by @marten-seemann in #1941
- quic: update quic-go to v0.31.1 by @marten-seemann in #1942
- quic: fix race condition in TestClientCanDialDifferentQUICVersions by @marten-seemann in #1937
- webtransport: fix flaky accept queue test by @marten-seemann in #1938
- chore: update examples to v0.24.0 by @marten-seemann in #1936
- routed host: return Connect error if FindPeer doesn't yield new addresses by @marten-seemann in #1946
- release v0.24.1 by @marten-seemann in #1945
Full Changelog: v0.24.0...v0.24.1
v0.24.0
Breaking Changes
Constructor options
- removed the deprecated
libp2p.DefaultStaticRelays
andlibp2p.StaticRelays
options. Static relays can be configured as an option tolibp2p.EnableAutoRelay
libp2p.Security
now requires passing in a constructor (previously, it also allowed passing in a fully constructed security transport)libp2p.Muxer
now requires passing in a fully constructed muxer (previously, it also allowed passing in a muxer constructor)- Removed
libp2pquic.DisableReuseport
andlibp2pquic.WithMetrics
. These options are now available in thequicreuse
package (quicreuse.DisableReuseport
andquicreuse.WithMetrics
), and can be enabled by using thelibp2p.QUICReuse
option (example:libp2p.QUICReuse(quicreuse.NewConnManager, quicreuse.DisableReuseport, quicreuse.WithMetrics)
).
Under the hood, we now use fx in the construction of the host, which lead to a great simplification of our setup logic (see #1858 for details).
QUIC Versions
When we first rolled out QUIC support in 2020, QUIC wasn't an RFC yet (in fact, we were involved in the standardization process at the IETF!). Back then, we rolled out support for QUIC draft-29. This version is almost identical to RFC 9000, so there was never a good reason to force an update.
Now that rust-libp2p is shipping QUIC support, we decided to finally initiate the update. We do so by introducing a new multiaddress component: /ip4/1.2.3.4/udp/4001/quic
now denotes a multiaddr that uses QUIC draft-29 (as it has before, we're just making it explicit now). QUIC v1 would use /ip4/1.2.3.4/udp/4001/quic-v1
.
We intend to keep support for QUIC draft-29 for roughly half a year, and disable listening on draft-29 addresses after that.
Depending on how you configure your node, you might need to update the addresses you're listening on (i.e. change quic => quic-v1
in the addresses, or duplicate the QUIC addresses).
π¦ Highlights
WebTransport
We added experimental WebTransport support in our last release. Since then, we're using some magic to allow running QUIC and WebTransport on the same port. This means that users who've already configured port forwarding / firewall rules for QUIC don't need to do anything to allow WebTransport connections to their node.
Optimized Stream Multiplexer Selection
When dialing a TCP connection to another libp2p node, we perform the following steps:
- TCP 3-way handshake: 1 RTT
- multistream-select to negotiate the security protocol (TLS 1.3 or Noise): 1 RTT
- security handshake: 1 RTT
- multistream-select to negotiate the stream multiplexer (yamux or mplex)
In total, this handshakes takes 4 RTTs. In this release, we optimize this handshake by inlining the stream multiplexer negotiation into the security handshake. On the wire, this looks very different for TLS 1.3 and for Noise, but the result is the same: we know which stream multiplexer to use when the handshake finishes, and can therefore save one roundtrip on every handshake. Head to the specification to learn how this works in detail.
π Bugfixes since v0.23.4
Changelog
- github.com/libp2p/go-libp2p:
- release v0.24.0 (#1934) (libp2p/go-libp2p#1934)
- chore: update deps (#1932) (libp2p/go-libp2p#1932)
- ci: fix path to interop test plan composition file (#1933) (libp2p/go-libp2p#1933)
- Disable support for signed/static TLS certificates in WebTransport (#1927) (libp2p/go-libp2p#1927)
- webtransport: add PSK to constructor, and fail if it is used (#1929) (libp2p/go-libp2p#1929)
- use a different set of default transports when PSK is enabled (#1921) (libp2p/go-libp2p#1921)
- transport.Listener,quic: Support multiple QUIC versions with the same Listener. Only return a single multiaddr per listener. (#1923) (libp2p/go-libp2p#1923)
- chore: update webtransport-go to get fix (#1924) (libp2p/go-libp2p#1924)
- quic / webtransport: make it possible to listen on the same address / port (#1905) (libp2p/go-libp2p#1905)
- autorelay: fix flaky TestReconnectToStaticRelays (#1903) (libp2p/go-libp2p#1903)
- swarm / rcmgr: synchronize the concurrent outbound dials with limits (#1898) (libp2p/go-libp2p#1898)
- add QUIC v1 addresses to the default listen addresses (#1914) (libp2p/go-libp2p#1914)
- webtransport: update webtransport-go to v0.3.0 (#1895) (libp2p/go-libp2p#1895)
- tls: fix flaky TestHandshakeConnectionCancellations test (#1896) (libp2p/go-libp2p#1896)
- holepunch: disable the resource manager in tests (#1897) (libp2p/go-libp2p#1897)
- transports: expose the name of the transport in the ConnectionState (#1911) (libp2p/go-libp2p#1911)
- respect the user's security protocol preference order (libp2p/go-libp2p#1912)
- circuitv2: disable the resource manager in tests (#1899) (libp2p/go-libp2p#1899)
- expose the security protocol on the ConnectionState (libp2p/go-libp2p#1907)
- Update go-netroute so that we get the correct priority of routes (#1902) (libp2p/go-libp2p#1902)
- fix: autorelay: treat static relays as just another peer source (#1875) (libp2p/go-libp2p#1875)
- feat: quic,webtransport: enable both quic-draft29 and quic-v1 addrs on quic. only quic-v1 on webtransport (#1881) (libp2p/go-libp2p#1881)
- holepunch: add multiaddress filter (#1839) (libp2p/go-libp2p#1839)
- README: remove broken links from table of contents (#1893) (libp2p/go-libp2p#1893)
- quic: update quic-go to v0.31.0 (#1882) (libp2p/go-libp2p#1882)
- add an integration test for muxer selection (libp2p/go-libp2p#1887)
- core/network: fix typo
- tls / noise: prefer the client's muxer preferences (libp2p/go-libp2p#1888)
- upgrader: absorb the muxer_multistream.Transport into the upgrader (#1885) (libp2p/go-libp2p#1885)
- Apply service peer default (#1878) (libp2p/go-libp2p#1878)
- webtransport: use deterministic TLS certificates (#1833) (libp2p/go-libp2p#1833)
- remove deprecated StaticRelays option (#1868) (libp2p/go-libp2p#1868)
- autorelay: remove the default static relay option (#1867) (libp2p/go-libp2p#1867)
- core/protocol: remove deprecated Negotiator.NegotiateLazy (#1869) (libp2p/go-libp2p#1869)
- config: use fx dependency injection to construct transports (libp2p/go-libp2p#1858)
- noise: add an option to allow unknown peer ID in SecureOutbound (#1823) (libp2p/go-libp2p#1823)
- Add some guard rails and docs (#1863) (libp2p/go-libp2p#1863)
- Fix concurrent map access in connmgr (#1860) (libp2p/go-libp2p#1860)
- fix: return filtered addrs (#1855) (libp2p/go-libp2p#1855)
- chore: preallocate slices (#1842) (libp2p/go-libp2p#1842)
- Close ping stream when we exit the loop (#1853) (libp2p/go-libp2p#1853)
- tls: don't set the deprecated tls.Config.PreferServerCipherSuites field (#1845) (libp2p/go-libp2p#1845)
- routed host: search for new multi addresses upon connect failure (#1835) (libp2p/go-libp2p#1835)
- core/peerstore: removed unused provider addr ttl constant (#1848) (libp2p/go-libp2p#1848)
- basichost: improve protocol negotiation debug message (#1846) (libp2p/go-libp2p#1846)
- noise: use Noise Extension to negotiate the muxer during the handshake (#1813) ...