We are excited to share with you all the progress that has been made on go-libp2p (opens new window) in 2022. It has been a year full of exciting new features, code organization, and a growing team of talented contributors.
Throughout the year, we released seven updates to go-libp2p ranging from v0.18.0 (opens new window) to v0.24.0 (opens new window), with a number of patch releases in between. We also welcomed Marco (opens new window) to the PL EngRes go-libp2p engineering team (opens new window), bringing the total number of team members to two (alongside Marten (opens new window))😀. In total, we had 21 contributors (opens new window) to the project in 2022.
Without further ado, let's take a look at notable accomplishments in the last year:
# New Features ✨
# Transport Protocols 🚚
# WebTransport 📡
One of the most exciting developments of the year was the release of the WebTransport protocol in v0.23.0 (opens new window). WebTransport enables browser-to-server connectivity in go-libp2p when paired with a peer running js-libp2p-webtransport (opens new window) in the browser.
# WebRTC (Browser to Server) 🛰️
In addition to WebTransport, the go-libp2p team also began work on enabling the WebRTC transport, in partnership with Little Bear Labs. This new transport will allow for connectivity between go-libp2p server nodes and js-libp2p browser nodes using js-libp2p-webrtc (opens new window).
While this feature is still under development and testing, you can check out a proof-of-concept demo of it in action on our libp2p Day 2022 Recap blog post (opens new window).
We expect to release this feature in Q1 2023 (tracking issue (opens new window)).
# QUIC Versions 🐰
We also made developments to the existing QUIC implementation in go-libp2p. In go-libp2p, we maintained support for two versions of QUIC, RFC 9000 (opens new window) and the draft-29 version (opens new window). In v0.24.0 (opens new window), go-libp2p changed two things. The first was to properly distinguish between these two QUIC versions (in their multiaddresses) and second was to change the default dial behavior. Previously, go-libp2p nodes would dial draft-29 by default but after v0.24.0, nodes prefer the new QUIC version. This was partly inspired by the alpha release of the QUIC implementation in rust-libp2p (opens new window).
To learn more about how different versions of QUIC work please read our docs (opens new window).
# DoS Protection 🏰 & Resource Management 📦
We added the Resource Manager component (opens new window) in v0.18.0 (opens new window). This feature allows developers to configure limits on the number of incoming and outgoing connections and streams, the number of streams per protocol and service, as well as configure libp2p memory usage.
These controls are key for DoS mitigation, which is why we also added autoscaling limits and canonical log lines in v0.21.0 (opens new window). To learn more about how to incorporate DoS mitigation into your libp2p projects, check out our documentation on the topic here (opens new window).
# Faster Handshakes 🤝
In the second half of 2022, the go-libp2p team began working to decrease the TTFB (time to first byte) and increase the speed of connection establishment (for transports that don't have native stream multiplexing like TCP and WebSocket). The first part of this effort was the Early Muxer Negotiation feature (opens new window).
In v0.24.0 (opens new window), go-libp2p added optimized muxer selection via TLS' ALPN extension (opens new window) and Noise extensions (opens new window). This resulted in a net saving one round trip, which may seem minimal but is big waste during connection establishment!
To learn more about how early muxer negotiation works, please read our docs (opens new window).
# AutoRelay discovers Circuit Relay v2 🔭
In v0.19.0 (opens new window), we enabled AutoRelay to discover nodes running Circuit Relay v2. Support for relay v2 was first added in late 2021 in v0.16.0 (opens new window) (which also removed support for relay v1 and added the Direct Connection Upgrade through Relay (opens new window) protocol). This improvement allows go-libp2p nodes to discover and connect to other nodes running Circuit Relay v2, improving the overall performance and reliability of the network.
Notably, running Circuit Relay v1 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. 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 v2 relays 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. Furthermore, a node can use these relays if it discovers that it's behind a NAT.
# Project Improvements 🏡
# Interoperability Testing ⚙️
We also began a concerted effort to improve interoperability between go-libp2p and libp2p implementations in other languages, such as Rust, JS, and Nim. With the addition of new transports like WebTransport and WebRTC, it is important to ensure that these different implementations can work together seamlessly.
The details of our interoperability testing efforts can be seen in the shared libp2p/test-plans Roadmap (opens new window).
# Monorepo Consolidation 1️⃣
go-libp2p is a monorepo as of the v0.22.0 release (opens new window).
In attempt to address the go-libp2p repo sprawl and consolidate various modules, a monorepo was created that resulted in a big quality of life improvement for the project. The go-libp2p maintainers always wanted to address the sprawl but it wasn’t possible until lazy module loading was added to Go 1.17 (opens new window). The consolidation started in v0.18.0 (opens new window) and finished in v0.22.0 release (opens new window) (where go-libp2p-core was finally migrated.) This improvement makes changes and improvements across go-libp2p much easier.
# Simplify libp2p Setup Logic with Fx 🦄
In v0.24.0 (opens new window) go-libp2p included a change to use Fx (opens new window), a Go dependency injection library. This enabled simplifying the logic necessary to construct libp2p (opens new window).
# Contributions to other projects 🧑💻
In addition to the improvements made directly to go-libp2p, we also made a number of contributions to other projects in 2022. Chief among them were quic-go (opens new window), webtransport-go (opens new window), along with pion/sctp (opens new window) and pion/datachannel (opens new window). These contributions helped progress network protocol development in go and improve the overall ecosystem. Some of these libraries (like quic-go and webtransport-go are authored by maintainers of go-libp2p.)
# Plans for 2023 📅
As we look ahead to 2023, we have a number of exciting plans for go-libp2p. Our primary focus areas for the next year can be found in our go-libp2p Roadmap (opens new window). We encourage the developer community to review the roadmap and provide feedback and suggestions. You can do so by creating a pull request or by making a suggestion in this tracking issue (opens new window).
Key areas of focus:
- Interoperability and end-to-end testing
- Expanding seamless browser connectivity
- Adding support for libp2p + HTTP
- Optimizing performance
- Better observability with metrics
# Resources and how you can help contribute 💪
We always welcome contributions from the community! If you would like to get involved and help contribute to go-libp2p, there are a few ways you can do so. To start, you can connect with the libp2p maintainers (opens new window) to learn more about the project and find out how you can get involved.
If you're ready to start pushing code immediately, you can also check out any of these help wanted/good first issues (opens new window) and start contributing right away. The libp2p maintainers are always happy to provide guidance and support to new contributors.
If you would like to learn more about libp2p, there are a number of resources available for you:
- The libp2p documentation (opens new window) provides a comprehensive overview of the libp2p project and its core components.
- The Connectivity website (opens new window) describes the various libp2p transport implementations.
- The libp2p Specifications (opens new window) provide in-depth technical information about the various protocols and standards that underpin libp2p.
Thank you for reading! 🙏