Skip to content
CAI
Software that uses CAICheck a score

libp2p/rust-libp2p

75.1

Strong · 13 September 2026

91.7k

lines of production code

Rust

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a modular, monorepo-based implementation of the libp2p networking stack for Rust, providing the foundational components for building decentralized peer-to-peer applications. It manages the full lifecycle of network connections through a unified transport layer supporting TCP, QUIC, WebRTC, and WebSocket, secured by Noise and TLS protocols. The architecture facilitates complex network behaviors via a configurable swarm system, enabling features like NAT traversal through relays and hole-punching, distributed hash table routing, and various application-layer protocols such as gossipsub and request-response.

How it got here

2017–2020 — Monorepo restructuring and API modernization

36 changes.

The project underwent a major architectural overhaul, consolidating into a monorepo and replacing the legacy transport and swarm interfaces with a unified, poll-based API and a fluent builder pattern. This period saw the complete refactoring of core components like Kademlia, Gossipsub, and multiplexers to align with the new architecture, alongside the introduction of signed envelopes and new protocols like Rendezvous. Extensive dependency updates and MSRV bumps to Rust 1.88.0 accompanied these structural changes to ensure stability and interoperability.

2021–2022 — transport modernization and protocol expansion

37 changes.

This period focused on modernizing the transport layer by rewriting QUIC and Noise transports, adding WebRTC and TLS support, and introducing a Tokio-based TCP provider. It also expanded the protocol suite with Circuit Relay v2, AutoNATv2, and DCUtR, while enhancing swarm management through code generation and new utility structs.

2023 — SwarmBuilder migration and WebRTC/WASM expansion

55 changes.

This period focused on migrating the core library to a new phased SwarmBuilder API and updating examples to use modern async patterns. Significant effort was dedicated to expanding WebAssembly support by introducing WebRTC and WebTransport transports for browser environments. The release also added new protocols like performance benchmarking and connection management utilities, alongside comprehensive interop testing infrastructure.

2024–2026 — libp2p-stream and AutoNATv2 development

14 changes.

This period focused on introducing the new libp2p-stream crate for generic stream-oriented protocols and upgrading the AutoNAT protocol to version 2 with enhanced dial-back mechanisms. The work also included adding a local peer address store, implementing optional partial message support for GossipSub, and expanding test coverage for these new and existing components.

Features

Add Tokio-based TCP transport provider

A new \tokio\ provider has been added to the TCP transport layer, enabling users to integrate libp2p's TCP functionality with the Tokio async runtime. This new module implements the \Provider\ trait using \tokio::net::TcpListener\ and \tokio::net::TcpStream\, including specific handling for connection error states via \take\_error\ and network interface monitoring via \if\_watch\. This allows applications built on Tokio to utilize the standard TCP transport without requiring external adapters.

transports/tcp/src/provider · high confidence

Add Tokio-based WebRTC transport implementation

This change introduces the Tokio-specific implementation for the WebRTC transport, providing the core components required for peer-to-peer communication over WebRTC. It includes the \Transport\ struct for managing listeners and dialing, a \Connection\ wrapper implementing the \StreamMuxer\ trait to handle data channels, and a \Certificate\ type for generating and managing DTLS certificates. The implementation also features a custom \UDPMux\ for handling ICE traffic, utilities for SDP offer/answer generation, and an upgrade path that performs Noise protocol authentication over a dedicated data channel to establish secure libp2p sessions.

transports/webrtc/src/tokio · high confidence

Add UPnP example demonstrating external port mapping

A new UPnP example has been added to showcase how to use the libp2p UPnP network behavior to automatically open ports on a network gateway. The example builds a swarm using the new SwarmBuilder API, registers the UPnP behavior, and listens on a random OS-assigned port. It provides user feedback by printing the new external address when a port mapping is successfully established, or notifying the user if the gateway is not found or is non-routable.

examples/upnp · high confidence

Add WASM interop test runner with browser automation

New binaries have been added to the interop-tests suite to execute tests within a WASM environment. The \wasm\_ping\ binary launches a headless Chrome browser via chromedriver, serves a WASM application (bundled via rust-embed), and proxies Redis commands through an Axum HTTP server to facilitate communication between the browser and the test infrastructure. A corresponding \native\_ping\ binary and a shared configuration module (\config\) allow these tests to be driven by environment variables for transport, IP, and timeout settings.

interop-tests/src/bin · high confidence

Add WebRTC data channel streaming support for WASM environments

This change introduces a new \PollDataChannel\ implementation in the \transports/webrtc-websys\ module, enabling asynchronous read and write operations over WebRTC data channels within WASM targets. The implementation wraps the browser's \RtcDataChannel\ API, managing connection states (connecting, open, closed) and handling backpressure by detecting when the remote peer overloads the stream with messages. It integrates with the \tracing\ crate for logging and uses \futures\ for async I/O, allowing applications to treat WebRTC data channels as standard async streams.

transports/webrtc-websys/src/stream · high confidence

Add WebRTC transport implementation for WASM environments

Introduces a new WebRTC transport implementation that allows libp2p to function in WASM environments without requiring a signaling server. The module implements the \libp2p\_core::Transport\ trait, handling ICE negotiation, SDP generation, and DTLS+SCTP over UDP. It currently supports UDP-based connections and includes documentation on the underlying protocols (ICE, DTLS, SCTP) and the specific approach to certificate verification via multiaddr hashes.

transports/webrtc/src · high confidence

Add WebRTC transport support for WASM environments

Introduces a new WebRTC transport implementation for WebAssembly targets, enabling libp2p networking in browsers. This change adds the core transport components (connection, stream, and transport logic) that allow WASM applications to dial remote peers over WebRTC data channels, including SDP negotiation, Noise protocol authentication, and handling of browser-specific constraints like Firefox localhost limitations.

transports/webrtc-websys/src · high confidence

Add interop test harness for WASM and native environments

The interop-tests module now includes a new test harness that supports running libp2p ping tests in both native and WASM environments. The implementation uses conditional compilation to provide platform-specific implementations for time handling, logging, and swarm building, enabling tests to run on WASM targets using transports like WebSocket, WebTransport, and WebRTC, while maintaining native support for TCP, QUIC, and other protocols.

interop-tests/src · high confidence

Add libp2p performance benchmarking protocol server

The server-side implementation for the new libp2p performance protocol has been added, introducing a \NetworkBehaviour\ and \ConnectionHandler\ to manage inbound benchmark streams. This component supports iperf-style intermittent results, enforcing a configurable timeout per run and limiting the number of parallel runs allowed per connection. It utilizes \futures\_bounded\ for managing concurrent stream execution and includes tracing instrumentation for monitoring behavior and handler polling.

protocols/perf/src/server · high confidence

Add rendezvous server example with fixed keypair and tracing

A new rendezvous server example has been added to the examples directory. This example demonstrates how to set up a libp2p swarm using the new SwarmBuilder API, featuring a fixed Ed25519 keypair for consistent peer identification, integration with the rendezvous server protocol, and structured logging via the tracing crate.

examples/rendezvous/src · high confidence

Add stream example demonstrating libp2p\_stream Behaviour

A new example in \examples/stream\ demonstrates the \libp2p\_stream\ crate's \Behaviour\, which enables stream-oriented protocols with minimal Swarm interaction. The example implements a simple echo protocol over QUIC, showing how to accept incoming streams and open outgoing ones using the new \stream::Control\ API.

examples/stream · high confidence

Added hole-punching test harness

A new executable test harness has been added to validate hole-punching (DCUtR) scenarios. The tool connects to a Redis instance to retrieve relay addresses and peer IDs, then configures a libp2p swarm with TCP/QUIC transports, a relay client, and the DCUtR protocol. It supports dial and listen modes, reporting round-trip time (RTT) metrics upon successful connection establishment or failing on errors.

hole-punching-tests/src · high confidence

Added identify example demonstrating node identity exchange

The identify example has been added to demonstrate how to establish a connection between two nodes using TCP transport, authenticate with the noise protocol, and multiplex data streams with yamux. The example utilizes the new SwarmBuilder API with tokio and shows how to configure and run the identify behavior to exchange identification information between peers, including printing peer IDs and received info to the console.

examples/identify · high confidence

Implement Direct Connection Upgrade through Relay (DCUtR) protocol

Added the inbound and outbound handshake logic for the Direct Connection Upgrade through Relay (DCUtR) protocol, enabling peers to establish direct connections via a relay. The implementation handles the exchange of observed addresses, filters out relayed addresses, validates message types, and manages timing (including RTT-based delays) to facilitate the hole-punching process.

protocols/dcutr/src/handler, protocols/dcutr/src/protocol · high confidence

Implement S/Kademlia disjoint path lookup for peer discovery

Added \ClosestDisjointPeersIter\ in \protocols/kad/src/query/peers/closest/disjoint.rs\ to support S/Kademlia's disjoint path lookup strategy. This new iterator manages multiple parallel discovery paths, ensuring that peer responses are distributed across disjoint sets to improve robustness and coverage during the closest peers query process.

protocols/kad/src/query/peers/closest · high confidence

In-memory Kademlia record store with configurable limits

The Kademlia module now includes a \MemoryStore\ implementation for storing records and provider information in RAM. This store allows users to configure maximum record counts, value sizes, and provider limits via \MemoryStoreConfig\, enforcing these constraints during record insertion and provider updates to prevent unbounded memory growth.

protocols/kad/src/record/store · high confidence

Introduce AutoNATv2 client handler with dial-back and dial-request logic

The AutoNATv2 client handler now implements the core connection handling for the new protocol version. It adds a dial-back handler that listens for incoming nonce requests from peers and processes them using a bounded stream set with a 5-second timeout, and a dial-request handler that initiates outbound substreams to test peer reachability, managing up to 10 concurrent requests with a 10-second timeout. These components replace the previous implementation to support the updated AutoNATv2 specification.

protocols/autonat/src/v2/client/handler · high confidence

Introduce AutoNATv2 protocol implementation

The AutoNAT protocol has been updated to version 2, introducing a new client and server implementation in the \protocols/autonat/src/v2\ directory. This change adds new modules for handling the protocol's behavior and handlers, along with a dedicated protocol layer that manages message encoding and decoding using \prost\_codec\ and defines specific request and response structures like \DialRequest\ and \DialResponse\. Users interacting with this protocol will now engage with the v2 interface, which includes updated message formats and validation logic for addresses and data lengths.

protocols/autonat/src/v2 · high confidence

Introduce AutoNATv2 server implementation

The AutoNAT server protocol has been upgraded to version 2, introducing a new \Behaviour\ and associated \ConnectionHandler\ components in \protocols/autonat/src/v2/server\. This change implements the core logic for handling incoming dial requests and performing dial-back verification, utilizing \futures\_bounded\ for managing concurrent operations and \futures-timer\ for stream timeouts. Users interacting with this protocol will now engage with the v2 server behavior, which replaces the previous implementation.

protocols/autonat/src/v2/client, protocols/autonat/src/v2/server · high confidence

Introduce Direct Connection Upgrade through Relay (DCUtR) protocol

This change adds the DCUtR protocol implementation, enabling libp2p nodes to establish direct connections with each other via a relay node when NAT or firewall restrictions prevent direct connectivity. The new \protocols/dcutr\ crate provides a \NetworkBehaviour\ that manages the hole-punching lifecycle, including tracking relayed and direct connections, exchanging address candidates, and handling protocol violations. Users can now integrate this behavior to automatically upgrade relayed connections to direct ones, improving performance and reducing relay load.

protocols/dcutr/src · high confidence

Introduce RwStreamSink to bridge Stream/Sink and AsyncRead/AsyncWrite

The \rw-stream-sink\ crate is now available, providing the \RwStreamSink\ type that wraps a \Stream\ and \Sink\ producing byte buffers to implement \AsyncRead\ and \AsyncWrite\. This allows users to treat stream-based transports as standard async I/O streams, with specific behavior to skip empty stream items during reads and map \Sink::close\ to \AsyncWrite::shutdown\. The initial release (v0.5.0) raises the Minimum Supported Rust Version (MSRV) to 1.88.0.

misc/rw-stream-sink · high confidence

Introduce SwarmBuilder for simplified network configuration

The libp2p facade now provides a \SwarmBuilder\ API that allows users to construct a \Swarm\ using a fluent, phase-based builder pattern. This new entry point in \libp2p/src/builder.rs\ replaces manual assembly by guiding users through configuring the async runtime (e.g., Tokio), transports (TCP, QUIC, WebSocket), security protocols (Noise, TLS), and network behaviors in a single chain. The change also includes updated tutorials and re-exports to support this new construction method.

libp2p/src · high confidence

Introduce WebRTC stream handling components for WASM support

Added new source files in the \misc/webrtc-utils/src/stream\ directory to support WebRTC data channels in WASM environments. This includes \drop\_listener.rs\, which manages graceful stream closure and reset signaling; \framed\_dc.rs\, which implements a framed data channel using \prost\_codec\ with specific buffer size limits to prevent packet errors; and \state.rs\, which defines the state machine for handling read/write closure flags (FIN, STOP\_SENDING, RESET). These components form the core stream management layer for the new WebRTC WASM capability.

misc/webrtc-utils/src/stream · high confidence

Introduce WebRTC transport utilities for libp2p connections

Added the \misc/webrtc-utils\ crate, providing core utilities for WebRTC-based libp2p transports. This includes SDP generation for session descriptions, certificate fingerprint handling (SHA-256), and a Noise protocol implementation for secure key exchange. The crate also defines a protobuf-based message framing system for data channels and implements a \Stream\ type that wraps WebRTC data channels to behave as standard async I/O streams, supporting graceful half-closure and message size limits.

misc/webrtc-utils/src · high confidence

Introduce boxed module for type-erased stream muxing

Added a new \boxed\ module providing \StreamMuxerBox\ and \SubstreamBox\ to allow type-erased, dynamically dispatched stream muxers. This enables users to store heterogeneous muxer implementations in a single collection or pass them through APIs that require a concrete, unified type, while ensuring substreams implement \AsyncRead\ and \AsyncWrite\.

core/src/muxing · high confidence

Introduce libp2p perf protocol for network bandwidth testing

The \protocols/perf\ module now implements the libp2p performance protocol, enabling users to measure network throughput between peers. This new capability provides client and server behaviors that execute data transfer runs, reporting intermediate and final results including upload/download durations and bandwidth in human-readable formats (e.g., Gbit/s). The implementation supports iperf-style intermittent progress updates during long-running transfers and is built on the \libp2p-request-response\ framework.

protocols/perf/src · high confidence

Introduce libp2p performance benchmarking protocol

Added a new client-side implementation for the libp2p performance protocol, including the \Behaviour\ and \Handler\ components in the \protocols/perf/src/client\ directory. This feature enables users to initiate and monitor performance runs (such as iperf-style intermittent results) against remote peers, with the client behaviour managing peer connectivity and the handler managing the underlying substream protocol negotiation and data exchange.

protocols/perf/src/client · high confidence

Introduce libp2p-allow-block-list connection management module

A new \libp2p-allow-block-list\ module is added to manage peer allow and block lists. It provides \Behaviour\ types for \AllowedPeers\ and \BlockedPeers\ that integrate with the libp2p swarm to deny connections based on these lists. The module exposes getters for the current sets of allowed or blocked peers and methods to add or remove peers, returning a boolean to indicate if a change was actually performed. When a peer is disallowed or blocked, active connections to that peer are immediately closed.

misc/allow-block-list · high confidence

Introduce libp2p-metrics crate for OpenMetrics observability

The \misc/metrics\ crate is introduced to record libp2p Swarm and protocol events and expose them as metrics in the OpenMetrics format. It provides a \Metrics\ struct that aggregates counters, gauges, and histograms for the Swarm (connection lifecycle, dial attempts, listener events), Identify (peer protocols, addresses), Kademlia (query results, durations), Gossipsub (message counts), Ping (RTT, failures), Relay (circuit and reservation events), and DCUtR (upgrade success/failure). It also includes a \BandwidthTransport\ wrapper to track bytes transferred per transport protocol stack. Users can register these metrics with a \prometheus-client\ registry to monitor network behavior and performance.

misc/metrics · high confidence

Introduce libp2p-peer-store for local peer address management

A new \libp2p-peer-store\ crate has been added to provide a local peer address book. It includes a \Behaviour\ that integrates with the libp2p swarm to automatically track peer addresses via \FromSwarm::NewExternalAddrOfPeer\ events and supply them during dialing. The crate also provides a \MemoryStore\ implementation backed by an LRU cache, which supports storing custom peer data, limiting the number of peers, and optionally removing addresses discovered through the swarm when dial attempts fail.

misc/peer-store · high confidence

Introduce libp2p-stream for generic stream-oriented protocols

This release introduces the new \libp2p-stream\ crate, providing a generic \NetworkBehaviour\ for stream-oriented protocols. Users can now manage stream lifecycle via a shared \Control\ handle, supporting both inbound stream acceptance (\Control::accept\) and outbound stream opening (\Control::open\_stream\). The implementation includes automatic connection handling, backpressure mechanisms for concurrent stream requests, and garbage collection of deregistered inbound protocols. The crate also defines specific error types for stream operations, such as \OpenStreamError\ for unsupported protocols or I/O failures, and requires a minimum Rust version of 1.88.0.

protocols/stream · high confidence

Introduce libp2p-tls transport with post-quantum key exchange and AWS-LC provider

The \transports/tls\ crate now implements the libp2p TLS specification, providing a new TLS transport layer. It uses the AWS-LC crypto provider and defaults to the X25519MLKEM768 post-quantum key-exchange group. The implementation includes certificate generation, parsing, and verification logic specific to the libp2p protocol, along with an upgrade mechanism integrating with \libp2p-core\'s connection upgrade traits. TLS key logging is enabled via the \SSLKEYLOGFILE\ environment variable for debugging.

transports/tls · high confidence

Introduce optional partial message support for large gossipsub payloads

The gossipsub protocol now includes an optional extension that allows large messages to be split into parts and reconstructed by peers. This feature is gated behind the \partial-messages\ feature flag; when enabled, applications can implement the \Partial\ trait to define custom strategies for splitting and merging message data. The extension handles the underlying peer-to-peer exchange of partial metadata and data chunks, enabling efficient transmission of large payloads over the gossipsub network.

protocols/gossipsub/src/extensions · high confidence

Introduce rust-libp2p-server with Kademlia, Relay, and AutoNAT support

A new standalone \rust-libp2p-server\ binary is added to the \misc/server\ directory, providing a configurable libp2p node implementation. The server supports the Kademlia DHT, Circuit Relay v2, and AutoNAT protocols, with optional toggles to enable Kademlia and AutoNAT via command-line flags. It reads configuration from an IPFS-style JSON file, exposes Prometheus metrics on \0.0.0.0:8888\ (configurable path), and utilizes \axum\ for the HTTP metrics endpoint. The build process uses \cargo-chef\ for optimized Docker layer caching and targets Rust 1.88.0.

misc/server · high confidence

Introduce signed envelopes and peer records with cross-implementation compatibility

The core library now supports the libp2p signed envelope specification (RFC0002) and peer routing records (RFC0003). This adds the \SignedEnvelope\ type for wrapping arbitrary payloads with cryptographic signatures and the \PeerRecord\ type for distributing authenticated peer addresses. To ensure interoperability with Go and JavaScript libp2p implementations, the system uses standard domain separation and payload types, while retaining legacy formats for backward compatibility with existing Rust deployments. The underlying data structures are serialized using \prost\-generated Protobuf definitions.

core/src · high confidence

Introduce swarm-derive crate for NetworkBehaviour code generation

The \swarm-derive\ crate is added, providing the \\#\[derive(NetworkBehaviour)\]\ macro that automatically generates the \NetworkBehaviour\ trait implementation for user-defined structs. This macro supports custom output event types via the \\#\[behaviour(to\_swarm = "...")\]\ attribute, automatically generates a combined \OutEvent\ enum when no custom type is specified, and includes \Debug\ implementations for generated events. It also introduces a \prelude\ configuration option to allow users to specify custom paths for standard types like \Multiaddr\ and \PeerId\.

swarm-derive/src · high confidence

Introduction of AutoNATv2 with improved reachability detection and DoS protection

The AutoNAT protocol module has been restructured to support two distinct versions: the existing v1 and the new v2. The v2 implementation, located in the \v2\ module, addresses key limitations of v1 by requiring the server to dial back over a newly allocated port, which significantly reduces false positives in reachability detection (particularly for hole-punched connections). Additionally, v2 introduces a nonce-based challenge mechanism to protect against Denial of Service attacks by ensuring the client expends more resources than the server. Users can now opt into the more robust v2 behavior via the \v2\ feature flag, while v1 remains available for backward compatibility but is marked for eventual deprecation.

protocols/autonat/src · high confidence

New AutoNAT example demonstrating client-server address discovery

The \examples/autonat\ directory now contains a complete example showcasing the AutoNAT and identify protocols. It includes a client binary (\autonat\_client\) that uses the identify protocol to determine external addresses and sends dial-back requests to a server, and a server binary (\autonat\_server\) that supports these protocols. The example is built using \SwarmBuilder\, \tokio\, and the \noise\ and \yamux\ transport layers, providing a reference implementation for establishing direct connections and exchanging external address information.

examples/autonat · high confidence

New AutoNATv2 example with Docker support and OTLP tracing

The examples/autonatv2 directory now provides a runnable demonstration of the AutoNATv2 protocol, including dedicated client and server binaries. The server binary supports optional OpenTelemetry OTLP tracing (enabled via the 'jaeger' feature) to export spans to a Jaeger collector, replacing the previous Jaeger-specific implementation. Dockerfiles and a docker-compose configuration are included to easily spin up the server alongside a Jaeger all-in-one container for distributed tracing.

examples/autonatv2 · high confidence

New CI scripts for changelog management, version validation, and linting

Added several new scripts to the \scripts/\ directory to support CI workflows: \add-changelog-header.sh\ automatically prepends version headers to crate changelogs; \ensure-version-bump-and-changelog.sh\ validates that source changes are accompanied by changelog entries and that version bumps are valid relative to the latest published crate version; \fix-unreachable-pub.py\ processes clippy output to automatically restrict \pub\ items to \pub(crate)\ where they are unreachable; \build-interop-image.sh\ handles Docker image builds with optional S3 cache integration; and \list-external-contributors.sh\ generates a list of non-maintainer contributors for release notes.

scripts · high confidence

New DCUtR example demonstrating direct connection upgrade through relay

Added a new example in \examples/dcutr\ that implements the Direct Connection Upgrade through Relay (DCUtR) protocol, allowing peers behind NATs to establish direct connections via hole punching. The example includes a \README\ with usage instructions and a \main.rs\ that configures a libp2p swarm with relay client, ping, identify, and DCUtR behaviors, supporting both listen and dial modes to connect through a relay server.

examples/dcutr · high confidence

New IPFS Kademlia example for querying peers and inserting PK records

The \examples/ipfs-kad\ directory now provides a runnable Rust example demonstrating how to interact with the Kademlia DHT on the IPFS network. Users can run the example to find the closest peers to a specific peer ID or insert a public key (PK) record into the DHT. The example uses \tokio\ for async runtime, \libp2p\'s \SwarmBuilder\ for configuration, and connects to standard IPFS bootnodes.

examples/ipfs-kad · high confidence

New IPFS private network example using Tokio and SwarmBuilder

Added a new example in \examples/ipfs-private\ that demonstrates a minimal libp2p node capable of interacting with IPFS. The example uses the Tokio runtime (migrating from async-std) and the new \SwarmBuilder\ API to establish connections using gossipsub for pubsub messaging, ping for connectivity testing, and identify for peer discovery. It supports pre-shared key (PSK) encryption via an IPFS swarm key file and allows users to dial specific multiaddresses provided as command-line arguments.

examples/ipfs-private · high confidence

New JSON and CBOR codec modules for request-response

The request-response protocol now includes dedicated \json\ and \cbor\ modules that provide pre-built behaviours using \serde\_json\ and \cbor4ii\ respectively. These modules allow users to send and receive messages by simply deriving \Serialize\ and \Deserialize\, eliminating the need to write custom codec implementations. Both codecs enforce configurable size limits (defaulting to 1 MiB for requests and 10 MiB for responses) to prevent resource exhaustion.

protocols/request-response/src · high confidence

New WebRTC example for browser-to-server communication

Added a new \browser-webrtc\ example that demonstrates connecting a WebAssembly (WASM) browser client to a Rust libp2p server using the WebRTC transport. The example includes a server component (using \axum\) that serves the client assets and exposes the WebRTC listening address, and a client component (using \libp2p-webrtc-websys\) that dials the server, performs periodic pings, and displays the round-trip time (RTT) in the browser DOM. It also introduces a \tracing-wasm\ logger for debugging in WASM environments.

examples/browser-webrtc · high confidence

New WebTransport transport for WASM environments

This release introduces a new WebTransport transport implementation for WASM environments, enabling libp2p connectivity over the WebTransport protocol in browsers. The change adds the \webtransport-websys\ crate, which provides bindings to the browser's WebTransport API, handles connection and stream management via \web-sys\, and supports both CA-signed and self-signed TLS certificates through certificate hash validation. It also raises the Minimum Supported Rust Version (MSRV) to 1.88.0.

transports/websocket-websys, transports/webtransport-websys · high confidence

New chat example using libp2p, gossipsub, and mDNS

Added a new chat application example in the \examples/chat\ directory that demonstrates real-time decentralized communication. The example uses the libp2p library with the gossipsub protocol for message propagation and mDNS for local peer discovery. It is built on the tokio runtime and includes a README with usage instructions for running multiple peers.

examples/chat · high confidence

New distributed key-value store example using libp2p

A new example application demonstrating a distributed key-value store built with libp2p, Kademlia, and mDNS has been added. Users can run the example to store and retrieve key-value pairs or manage provider records across multiple peers on a local network. The implementation uses the new SwarmBuilder API, sets Kademlia to Server mode, and includes basic CLI interaction for PUT, GET, PUT\_PROVIDER, and GET\_PROVIDERS commands.

examples/distributed-key-value-store · high confidence

New handler combinator utilities for protocol selection and transformation

The swarm handler module introduces several new \ConnectionHandler\ implementations to simplify protocol composition and event handling. \MultiHandler\ allows combining multiple protocol handlers into a single handler indexed by a key, while \ConnectionHandlerSelect\ enables selecting between two protocols on a single connection. Additionally, \MapInEvent\ and \MapOutEvent\ provide wrappers to transform input and output events respectively, and \Either\ handler support allows combining two handlers into one. These changes enhance the flexibility of the swarm layer by providing reusable components for complex protocol interactions.

swarm/src/handler · high confidence

New identity module with multi-algorithm key support

The \identity/src\ directory now contains a new \libp2p-identity\ crate that provides a unified interface for managing node network identity keys. It introduces a generic \Keypair\ type that wraps specific implementations for Ed25519, Secp256k1, RSA, and ECDSA (secp256r1) keys, allowing users to generate, sign, and verify messages using any of these algorithms. The module exposes \PublicKey\ and \PrivateKey\ protobuf definitions for serialization, implements \PeerId\ generation from public keys, and provides feature-gated modules for each key type to keep the binary size minimal when only specific algorithms are needed.

identity/src · high confidence

New interop test infrastructure with dedicated Dockerfiles and transport configurations

The interop-tests directory now includes dedicated Dockerfiles for Chromium (WASM) and native environments, enabling isolated builds and execution of interop tests. The Chromium Dockerfile installs specific tooling (wasm-pack, wasm-opt) and uses selenium/standalone-chrome:125.0 to run tests, while the native Dockerfile builds for the host architecture. Configuration files (chromium-ping-version.json, native-ping-version.json) define supported transports (webtransport, webrtc-direct, ws, tcp, quic-v1), secure channels (noise, tls), and muxers (mplex, yamux) for each environment, allowing users to run interop tests against specific transport combinations in a containerized manner.

interop-tests · high confidence

New keygen CLI tool for generating and exporting libp2p key material

A new command-line utility has been added to the misc/keygen directory to generate, validate, and export libp2p key material. Users can now generate random Ed25519 keypairs (with optional base58 prefix filtering for specific Peer IDs) or import existing keys from an IPFS-style JSON config file. The tool supports outputting results in either human-readable text or structured JSON format, facilitating integration with other systems that require libp2p identity management.

misc/keygen · high confidence

New libp2p performance benchmarking tool

A new command-line tool (\perf\) has been added to allow users to run performance benchmarks between libp2p nodes. The tool supports both client and server modes, allowing users to measure upload and download throughput over TCP or QUIC transports. It outputs results in JSON format, including total time and byte counts, and integrates tracing for observability.

protocols/perf/src/bin · high confidence

New memory-based connection limiting behavior

The \memory-connection-limits\ crate now provides a \NetworkBehaviour\ that enforces connection limits based on process memory usage. Users can configure thresholds using either absolute bytes (\with\_max\_bytes\) or a percentage of total physical memory (\with\_max\_percentage\). When the configured limit is exceeded, new inbound and outbound connections are denied, emitting specific swarm events that allow applications to identify when a connection was rejected due to memory constraints. This feature requires a minimum Rust version of 1.88.0.

misc/memory-connection-limits · high confidence

New metrics example with OpenTelemetry tracing and Axum HTTP server

The \examples/metrics\ directory now provides a complete, runnable example for collecting libp2p metrics and OpenTelemetry spans. It introduces an HTTP metrics endpoint powered by Axum 0.7, exposing Prometheus-compatible metrics via \/metrics\. The example also integrates OpenTelemetry to export trace spans to a Jaeger collector (provided via \docker-compose.yml\), allowing users to visualize network behavior. Key implementation details include the use of \SwarmBuilder\ for swarm construction, \with\_bandwidth\_metrics\ for transport-level tracking, and \tracing::info\ for structured logging.

examples/metrics · high confidence

New peer iterators for Kademlia queries

Added \ClosestPeersIter\ and \FixedPeersIter\ to manage peer discovery and query progress in Kademlia. \ClosestPeersIter\ dynamically tracks peers sorted by distance to a target, supporting configurable parallelism and result counts, while \FixedPeersIter\ handles a static set of peers with simple success/failure tracking. These components replace previous inline logic, providing a cleaner, testable interface for query state management.

protocols/kad/src/query/peers · high confidence

New ping example using Tokio and SwarmBuilder

A new ping example has been added to demonstrate libp2p usage. It showcases creating a network of nodes that establish connections, negotiate the ping protocol, and ping each other. The example is built with Tokio and utilizes the new SwarmBuilder API, providing a reference implementation for basic peer-to-peer communication.

examples/ping · high confidence

New relay-server example added to examples/ directory

A new relay-server example has been introduced in the examples/ directory, demonstrating how to create a libp2p relay node that routes messages between peers. The example uses Tokio as the async runtime, supports both TCP and QUIC listeners, and leverages the new SwarmBuilder API for configuration. Users can run the relay node by specifying a port and a secret key seed to generate a deterministic peer ID.

examples/relay-server · high confidence

New swarm-test library for simplified network testing

A new \swarm-test\ crate has been introduced to provide testing utilities for libp2p swarms. It includes a \SwarmExt\ trait that simplifies setting up ephemeral swarms with memory or TCP transports, establishing connections between swarms, and waiting for specific network events. Additionally, a \drive\ function is provided to concurrently poll multiple swarms until a specified number of events are emitted, ensuring that swarms continue to make progress even after emitting expected events, which prevents starvation in test scenarios.

swarm-test/src · high confidence

New utility structs for managing swarm address state and behaviour composition

This change introduces several new utility structs in the swarm behaviour module to simplify address tracking and behaviour composition. \ExternalAddresses\ and \ListenAddresses\ now provide dedicated, efficient tracking for confirmed external and local listen addresses respectively, responding to swarm events to maintain accurate sets. \PeerAddresses\ manages a cache of known external addresses for peers, automatically removing addresses on dial failures to improve connection reliability. Additionally, \Toggle\ allows a \NetworkBehaviour\ to be conditionally enabled or disabled, and \Either\ enables combining two distinct \NetworkBehaviour\ implementations into a single composite behaviour, both implementing the \NetworkBehaviour\ trait to integrate seamlessly with the swarm.

swarm/src/behaviour · high confidence

Ping protocol implementation for rust-libp2p

The \protocols/ping\ crate introduces the \/ipfs/ping/1.0.0\ protocol, providing a \Behaviour\ that implements \NetworkBehaviour\ to periodically send outbound pings and respond to inbound ping requests. Users can configure ping intervals and timeouts via the \Config\ struct, and monitor connection health through \Event\ emissions that report round-trip times or failures (such as timeouts, unsupported protocol, or other errors). The implementation relies on \libp2p-swarm\ for connection handling and \web-time\ for timekeeping, ensuring compatibility with WASM environments.

protocols/ping · high confidence

Relay client transport and handler implementation

The relay client now includes a dedicated transport and connection handler implementation located in \protocols/relay/src/priv\_client\. This change introduces the core logic for establishing and managing relayed connections, including support for listening on and dialing \/p2p-circuit\ addresses. The new \Handler\ manages reservation states, inflight circuit requests, and stream timeouts using \futures\_bounded\, while the \Transport\ coordinates with the swarm to handle listener and dial events for relayed multiaddresses.

_protocols/relay/src/priv\client · high confidence

Rendezvous protocol implementation added

The \protocols/rendezvous\ crate has been introduced, providing a full implementation of the libp2p Rendezvous protocol for peer discovery and registration. This change adds the client and server \NetworkBehaviour\ implementations, a \prost\-based codec for serializing protocol messages, and the corresponding protobuf definitions. Users can now register their external addresses in specific namespaces and discover other peers by querying rendezvous nodes.

protocols/gossipsub/src, protocols/rendezvous · high confidence

Removals

Removal of initial libp2p transport interface definitions

The initial set of core transport interfaces, including \Socket\, \Conn\, \Handler\, \Mux\, and \Transport\, has been removed from the \libp2p-transport\ crate. This deletion clears the foundational trait definitions that were previously used to define logical wires, connection management, and protocol multiplexing, indicating a shift away from this initial API design in favor of a new implementation approach.

libp2p-transport · high confidence

Removal of the top-level libp2p library facade

The top-level \libp2p\ crate (src/lib.rs) has been removed. Users can no longer import the entire libp2p suite via a single dependency; instead, they must depend on and import specific sub-crates (e.g., \libp2p-core\, \libp2p-swarm\) directly.

src · high confidence

Security

pnet transport: Redact pre-shared key in debug output and add key export method

The pnet transport now hides the raw pre-shared key in \Debug\ output, showing only a fingerprint instead, which prevents accidental key leakage in logs. It also adds a \PreSharedKey::to\_key\_file\ method to explicitly export the unredacted key when needed.

transports/pnet · high confidence

Architecture

Repository restructured into a monorepo with standardized configuration files

The project has been reorganized into a central monorepo structure, introducing dedicated directories for core components (\core/\), transport protocols (\transports/\), multiplexers (\muxers/\), the swarm layer (\swarm/\), application protocols (\protocols/\), and utilities (\misc/\). This structural change is accompanied by the addition of standardized configuration files including \rustfmt.toml\ (configured for Rust 2024 edition), \clippy.toml\ (disallowing unbounded channels), \deny.toml\ (for license and advisory checks), \.editorconfig\, and a root \CHANGELOG.md\ that delegates to individual crate changelogs. The repository also now includes \CONTRIBUTING.md\, \SECURITY.md\, and \FUNDING.json\ to formalize development workflows and community support.

(repo-wide) · high confidence

Behavioural changes

AutoNAT protocol definitions updated to use prost and introduce v2 message structures

The AutoNAT protocol's generated code has been migrated to use the \prost\ library for serialization, replacing the previous implementation. This change introduces the AutoNATv2 message schema, which adds support for dial data requests/responses and dial-back mechanisms via new \DialDataRequest\, \DialDataResponse\, \DialBack\, and \DialBackResponse\ message types, alongside updated \DialRequest\ and \DialResponse\ structures. The AutoNATv1 definitions remain available but are also regenerated using \prost\.

protocols/autonat/src/v1/generated, protocols/autonat/src/v2/generated · high confidence

AutoNAT v1 protocol implementation with prost serialization

The AutoNAT module in \protocols/autonat/src/v1\ now implements the AutoNAT v1 behavior and protocol logic, introducing a new \Behaviour\ struct that manages NAT detection probes and status changes. The protocol serialization has been migrated to use \prost\ for encoding \DialRequest\ and \DialResponse\ messages, replacing previous serialization methods. This change provides the core networking behavior for determining public or private NAT status through outbound and inbound probe events.

protocols/autonat/src/v1 · high confidence

AutoNATv1 server now rejects inbound dial requests from unconnected peers

The AutoNATv1 server implementation has been updated to enforce a connection requirement for inbound dial-back probes. If a remote peer sends a request to be dialed back but is not currently connected to the local node, the server will immediately reject the request with a 'DialRefused' error instead of attempting the dial. This change prevents unnecessary dialing attempts and reduces noise from peers that are not actively part of the local connection set.

protocols/autonat/src/v1/behaviour · high confidence

Circuit Relay v2 protocol implementation

The relay protocol has been upgraded from v1 to v2, introducing a new transport and behavior implementation that supports the latest circuit relay specification. This change brings updated protocol names (\/libp2p/circuit/relay/0.2.0/hop\ and \/libp2p/circuit/relay/0.2.0/stop\), revised configuration defaults (e.g., 128 max reservations, 16 max circuits), and improved error handling and rate limiting for both relay servers and clients.

protocols/relay/src · high confidence

Connection limits module introduces bypass peers and mutable configuration

The \libp2p-connection-limits\ module now allows users to specify specific Peer IDs that bypass connection limits entirely, meaning connections from these peers are not counted toward any limits. Additionally, the \ConnectionLimits\ struct is now mutable via a new \limits\_mut()\ method, enabling runtime adjustment of limit values without recreating the behavior. The module also corrects connection tracking logic to ensure connections denied by other behaviors are not counted as established, and adjusts pending connection counters on listen/dial failures.

misc/connection-limits · high confidence

File-sharing example migrated to tokio and updated to modern libp2p APIs

The file-sharing example has been refactored to use the tokio runtime instead of async-std, and now leverages the new SwarmBuilder API for network initialization. It also adopts the cbor codec for request-response communication and explicitly configures Kademlia in Server mode with an idle connection timeout, ensuring the example compiles and runs correctly with the latest library changes.

examples/file-sharing · high confidence

Floodsub protocol implementation rewritten for new swarm architecture

The Floodsub protocol has been completely rewritten to integrate with the new \libp2p-swarm\ architecture. The implementation now uses \prost-codec\ for message serialization instead of the previous protobuf crate, and the core behavior logic has been migrated to the \NetworkBehaviour\ trait (exposed as \Behaviour\), replacing the older handler-based model. This change aligns the protocol with the modern connection and event management patterns in the swarm, ensuring compatibility with the updated transport and peer management systems.

protocols/floodsub/src · high confidence

Generalized RecordStore trait with GATs for flexible record iteration

The \RecordStore\ trait in the Kademlia protocol has been refactored to use Generic Associated Types (GATs) for its iterator methods (\records\ and \provided\). This change allows implementations to return iterators that borrow from the store itself, enabling more efficient and flexible access to stored records and provider records without requiring owned copies. The trait now defines associated types \RecordsIter\ and \ProvidedIter\ that implement \Iterator\, supporting both regular value-records and provider records as described in the Kademlia specification.

protocols/kad/src/record · high confidence

Identify protocol switches to prost and uses futures-timer for WASM compatibility

The identify protocol implementation has migrated back to the \prost\ library for protobuf serialization (reverting the previous \quick-protobuf\ change) and now uses \futures-timer\ instead of \tokio\'s timer for stream timeouts. This ensures the bounded \Delay\ works correctly on \wasm32\ targets, preventing runtime panics in browsers where \tokio\'s timer driver is unavailable. Additionally, the minimum supported Rust version (MSRV) has been raised to 1.88.0.

protocols/identify · high confidence

Introduce phased SwarmBuilder API for libp2p configuration

The libp2p builder has been refactored into a type-state, phase-based API (\SwarmBuilder\) that guides users through a strict configuration sequence: Identity → Provider (Tokio/Wasm) → TCP → QUIC/WebSocket → DNS → Relay → Bandwidth Metrics → Behaviour → Build. This new structure introduces dedicated phases for each component (e.g., \TcpPhase\, \QuicPhase\, \WebsocketPhase\, \RelayPhase\, \BandwidthMetricsPhase\) and enforces compile-time checks to ensure transports and features are added in a valid order. Users can now explicitly configure DNS settings (\with\_dns\_config\), set connection timeouts (\with\_connection\_timeout\), and toggle bandwidth metrics (\with\_bandwidth\_metrics\) within specific phases, replacing the previous flat builder pattern with a more robust, step-by-step construction process.

libp2p/src/builder/phase · high confidence

Introduces builder phase types and upgrade selection logic

The \libp2p/src/builder\ module now exposes the internal phase types (\phase.rs\) and new \SelectMuxerUpgrade\ and \SelectSecurityUpgrade\ structs. These additions allow the builder to combine multiple multiplexer and security upgrades into a single transport stack, with the first upgrade taking priority during protocol negotiation. This change supports the new \SwarmBuilder\ architecture by providing the underlying logic for selecting and chaining connection upgrades.

libp2p/src/builder · high confidence

Kademlia DHT protocol implementation refactored and stabilized

The Kademlia implementation in \protocols/kad/src\ has been restructured into distinct modules (addresses, behaviour, bootstrap, handler, jobs, kbucket, protocol, query, record) to improve maintainability and clarity. This change introduces a new \Addresses\ type to manage peer multiaddresses, refines the \Behaviour\ to better handle connection states and routing table updates, and adds a dedicated \bootstrap\ module to manage periodic and automatic bootstrap intervals with throttling. The \handler\ module now enforces a limit of 32 inbound substreams and improves protocol confirmation logic, while the \jobs\ module clarifies the distinction between record publication and replication tasks. These changes refine the existing Kademlia DHT behavior without altering the core protocol specification.

protocols/kad/src · high confidence

Kademlia KBuckets implementation refactored and stabilized

The internal implementation of the Kademlia DHT's KBuckets has been restructured into dedicated modules (bucket, entry, key) to improve code organization and maintainability. This change introduces a more robust handling of node statuses (Connected/Disconnected) and pending insertions, ensuring that peer connectivity is tracked accurately within the routing table. Users benefit from a more stable and predictable DHT behavior as the underlying data structures for managing peer proximity and bucket capacity are now clearer and less prone to edge-case errors.

protocols/kad/src/kbucket · medium confidence

Migrate Floodsub protocol to prost for serialization

The Floodsub protocol's generated serialization code has been switched from quick-protobuf to prost. This change updates the underlying message encoding library used for the protocol's RPC messages, which may affect performance characteristics and binary compatibility of the serialized data.

protocols/floodsub/src/generated · high confidence

Mplex multiplexer updated to require Rust 1.88.0

The mplex multiplexer crate now requires a Minimum Supported Rust Version (MSRV) of 1.88.0. This change is part of the broader migration to the Rust 2024 edition and updates the development environment requirements for users integrating this library.

muxers/mplex · high confidence

Multistream-select protocol negotiation reimplementation

The \misc/multistream-select\ crate has been rewritten from scratch to implement the multistream-select protocol negotiation logic. This new version introduces a \Version::V1Lazy\ mode that allows dialers to perform 0-RTT negotiation by optimistically settling on a single protocol and sending application data immediately, while maintaining full interoperability with standard V1 listeners. The implementation also changes how EOF is handled during negotiation, treating it as a failed negotiation rather than an I/O error to allow for graceful stream closing. Additionally, the crate now requires a minimum Rust version of 1.88.0.

misc/multistream-select · high confidence

New QUIC transport implementation based on Quinn

The QUIC transport in \transports/quic/src\ has been rewritten to use the \quinn\ library, replacing the previous implementation. This change introduces a new configuration API (\Config\) for managing connection parameters such as idle timeouts, stream limits, and MTU discovery, and adds support for hole punching to improve connectivity behind NATs. The transport now supports both QUIC version 1 and the legacy draft-29 (controlled via a deprecated config flag), and provides runtime-specific providers (e.g., for Tokio) to handle async operations.

transports/quic/src · high confidence

Noise transport reimplementation with WebTransport support

The noise transport has been rewritten from scratch, introducing a new \Config\ API that defaults to the XX handshake pattern and adds support for the WebTransport certhashes extension via \with\_webtransport\_certhashes\. The implementation now uses \prost\ for serializing handshake payloads (defined in \payload.proto\) and integrates \x25519-dalek\ for Diffie-Hellman key exchange, replacing the previous \snow\-based framing with a custom \Output\ type that handles async I/O buffering.

transports/noise/src · high confidence

Plaintext transport reverts to prost and raises MSRV to 1.88.0

The plaintext transport has reverted its protobuf serialization from quick-protobuf back to prost, restoring the use of the standard prost codec for encoding the handshake Exchange message. This change is accompanied by a minimum supported Rust version (MSRV) increase to 1.88.0. Users relying on the plaintext transport for testing or insecure connections will now depend on prost and must ensure their Rust toolchain meets the new MSRV requirement.

transports/plaintext · high confidence

QUIC transport rewritten to use Quinn and libp2p-tls

The QUIC transport implementation has been replaced with a new version based on the Quinn library and libp2p-tls. This change introduces new internal modules for managing the connection handshake (extracting the peer ID from TLS certificates) and handling individual streams (wrapping Quinn's send/receive streams in AsyncRead/AsyncWrite interfaces).

transports/quic/src/connection · high confidence

Redesigned transport API with unified polling and new combinator types

The transport subsystem has been redesigned to replace the previous listener-based model with a unified \poll\ method on the \Transport\ trait, allowing all transport events (including incoming connections) to be handled through a single stream. This change introduces new combinator types to the \core/src/transport\ module, including \AndThen\ for chaining asynchronous operations, \Boxed\ for type-erased transport handling, \OrTransport\ for fallback dialing with logging, and \OptionalTransport\ for conditional transport enabling. Existing utilities like \Map\, \MapErr\, \Timeout\, and \DummyTransport\ have also been updated to conform to the new interface, ensuring consistent error handling and future management across the transport layer.

core/src/transport · high confidence

Refactored Noise protocol I/O with new framing and handshake structures

The Noise transport's I/O layer has been restructured into dedicated \framed.rs\ and \handshake.rs\ modules. The new \Codec\ implementation in \framed.rs\ handles length-delimited encoding and decoding for both handshake and transport states, utilizing \prost\ for serialization and \asynchronous\_codec\ for framing. The \handshake.rs\ module now encapsulates the handshake state machine, managing identity verification, signature validation, and the integration of WebTransport certificate hashes via a new \Extensions\ structure. This change consolidates the message framing logic and explicitly supports the XX handshake pattern while preparing the infrastructure for future extension handling.

transports/noise/src/io · high confidence

Refactored connection upgrade module with new internal components

The \core/src/upgrade\ module has been restructured to serve as an internal implementation detail for connection upgrades. This change introduces several new components: \apply.rs\ centralizes the logic for applying upgrades to inbound and outbound streams, distinguishing between dialer and listener roles; \select.rs\ provides a \SelectUpgrade\ combinator to prioritize and chain multiple protocol upgrades; \either.rs\ implements \UpgradeInfo\ and upgrade traits for \Either\ types to support alternative upgrade paths; \denied.rs\ and \pending.rs\ offer \DeniedUpgrade\ and \PendingUpgrade\ types for protocols that are explicitly unsupported or suspended; \ready.rs\ adds \ReadyUpgrade\ for protocols that require no negotiation and immediately yield the stream; and \error.rs\ defines a unified \UpgradeError\ enum to distinguish between multistream selection failures and post-negotiation handshake errors. These changes collectively refine how protocol upgrades are negotiated, applied, and error-handled within the core transport layer.

core/src/upgrade · high confidence

Refined connection error reporting and protocol change tracking

The connection management layer now provides more granular error reporting and protocol state tracking. New error types distinguish between pending inbound and outbound connection failures, specifically separating transport errors, aborted attempts, wrong peer IDs, and connections resolved to the local peer ID. Established connections now report specific errors like I/O failures and keep-alive timeouts. Additionally, a new \SupportedProtocols\ component tracks protocol additions and removals, enabling the swarm to accurately report changes in supported protocols to handlers.

swarm/src/connection · high confidence

Refined request-response protocol upgrade handling

The request-response handler now uses a dedicated \Protocol\ struct to manage inbound and outbound substream upgrades, replacing the previous upgrade infrastructure. This change introduces a \ProtocolSupport\ enum to explicitly define whether a protocol supports inbound requests, outbound requests, or both, allowing for more precise control over protocol capabilities. The upgrade logic is simplified to directly handle \Stream\ objects, ensuring that protocol negotiation is decoupled from the broader swarm upgrade system.

protocols/request-response/src/handler · high confidence

Regenerate protocol buffers using prost

The generated code for the DCUTR, Kademlia (kad), and Relay protocols has been regenerated using the prost library instead of the previous serializer. This migration updates the internal serialization and deserialization logic for protocol messages, which may affect performance characteristics and binary compatibility for these specific protocol implementations.

protocols/dcutr/src/generated, protocols/kad/src/generated, protocols/relay/src/generated · high confidence

Relay protocol handler and rate limiting logic restructured

The relay protocol's connection handling and access control have been reorganized into dedicated modules. The new \handler.rs\ file centralizes the logic for managing inbound reservation and circuit requests, stream upgrades, and connection lifecycle events, replacing the previous inline or scattered implementation. Additionally, a new \rate\_limiter.rs\ module introduces a token-bucket-based rate limiter that can restrict relay access per peer ID or IP address, helping to prevent resource exhaustion. These changes improve the maintainability of the relay service and provide better control over connection limits and abuse prevention.

protocols/relay/src/behaviour · high confidence

Relay protocol implementation refactored to use new stream and codec abstractions

The relay protocol implementation has been rewritten to use the new \libp2p\_swarm::Stream\ type instead of the deprecated \NegotiatedSubstream\, and has migrated from \quick-protobuf\ to \prost\_codec\ for message serialization. This change introduces dedicated modules for handling inbound and outbound hop and stop substreams, ensuring that circuit requests now correctly enforce resource limits (duration and bytes) and that errors during reservation or connection attempts are properly propagated to the transport layer. Users will see more robust error reporting for relay operations and compatibility with the updated swarm stream API.

protocols/relay/src/protocol · high confidence

Rendezvous examples updated to use SwarmBuilder and tracing

The rendezvous example binaries (discover, identify, register) have been rewritten to use the new \SwarmBuilder\ API for constructing the swarm and \tracing\ for logging. This updates the examples to reflect current library best practices, ensuring they compile with the specified feature set and providing better visibility into connection and registration events.

examples/rendezvous/src/bin · high confidence

Swarm connection management and dialing logic restructured

The swarm module's internal connection handling has been reorganized to improve modularity and dialing performance. The \NetworkBehaviour\ trait now uses a new \ConnectionHandler\ interface and \ToSwarm\ event system, replacing the previous \inject\\\ callback pattern. Dialing logic is now handled by dedicated components: \ConcurrentDial\ manages parallel connection attempts with configurable concurrency, while \SmartDial\ implements Happy Eyeballs-style ranking (prioritizing QUIC over TCP, IPv6 over IPv4) to optimize connection establishment. The \Connection\ struct and its associated pool have been refactored to manage substream negotiation and idle timeouts more explicitly, and the \Swarm\ now drives connections via the \Stream\ trait exclusively.

swarm/src · high confidence

TCP transport now supports wildcard IP addresses for port reuse

The TCP transport implementation has been updated to expand wildcard IP addresses (0.0.0.0 or ::) when registering listening sockets for port reuse. This ensures that connections can correctly reuse the local port of a listener even when the listener was bound to a wildcard address, improving NAT traversal capabilities and connection consistency.

transports/tcp/src · high confidence

UPnP port mapping reliability and event clarity improvements

The UPnP protocol implementation now provides more reliable port mapping and clearer event data for users. It skips creating new port mappings when an active mapping is already present, preventing redundant requests. Failed port mappings now use exponential backoff (up to 5 retries with delays from 30s to 480s) instead of continuous retry loops, reducing excessive retries. The \Event::NewExternalAddr\ and \Event::ExpiredExternalAddr\ variants now include both local and external addresses, allowing users to correlate which local listen address was mapped to which external address. Additionally, panics caused by conflating port-level mapping state with per-request tracking, as well as panics during shutdown or when the gateway is dropped, have been fixed.

protocols/upnp · high confidence

Unix domain socket transport refactored to use tokio and the new Transport API

The \transports/uds\ crate has been updated to version 0.44.0, raising the Minimum Supported Rust Version (MSRV) to 1.88.0 and renaming the \Config\ struct to follow the project's naming conventions. The transport implementation now exclusively uses the \tokio\ runtime, removing support for \async-std\, and implements the refactored \Transport\ trait (introduced in v0.41.0) which utilizes \poll\-based listener management and \ListenerId\ for event handling.

transports/uds · high confidence

Updated libp2p tutorials to use SwarmBuilder and modern async patterns

The ping and hole-punching tutorials have been rewritten to reflect current libp2p APIs. The ping tutorial now uses the \SwarmBuilder\ pattern for constructing the swarm, employs \tokio\ for asynchronous execution, and includes \tracing\ for logging. The hole-punching tutorial has been added to demonstrate connecting peers behind NATs using the Circuit Relay and DCUtR protocols.

libp2p/src/tutorials · high confidence

WebSocket transport reimplementation with SNI support and MSRV bump

The WebSocket transport has been reimplemented to support \/tls/sni/\<hostname\>/ws\ multiaddrs, allowing TLS connections to verify server certificates against the hostname specified in the address. The minimum supported Rust version (MSRV) has been raised to 1.88.0. Additionally, the transport now returns \Error::InvalidMultiaddr\ when attempting to dial \/dnsaddr\ addresses, and the deprecated \WsConfig\ type alias has been removed in favor of \Config\.

transports/websocket · high confidence

The mDNS discovery logic in \protocols/mdns/src/behaviour/iface/query.rs\ has been updated to skip address translation when the observed source address is a link-local IPv6 address. This prevents incorrect address mapping for peers discovered on the local network segment, ensuring that link-local addresses are preserved as-is rather than being processed through the general translation mechanism.

protocols/mdns/src/behaviour/iface · high confidence

mDNS discovery behaviour rewritten with async runtime abstraction

The mDNS discovery implementation has been refactored to support multiple async runtimes (such as Tokio) via a new \Provider\ trait, allowing users to choose between runtimes like \async-io\ and \tokio\. This change introduces a new \Behaviour\ struct that manages interface state and peer discovery tasks asynchronously, replacing the previous synchronous or tightly-coupled design. Users will now interact with the mDNS protocol through this new behaviour, which automatically discovers peers on the local network and emits discovery events, while also exposing a \discovered\_nodes\ iterator for querying known peers.

protocols/mdns/src · high confidence

mDNS implementation refactored to support multiple network interfaces and runtime abstraction

The mDNS discovery logic has been restructured to support multiple network interfaces, creating a separate \InterfaceState\ instance for each interface to ensure correct address binding and multicast joining. The implementation now abstracts socket and timer operations behind runtime-specific traits, allowing the mDNS crate to work with different async runtimes (such as Tokio) via feature flags. This change improves reliability on multi-homed systems and decouples the mDNS behavior from a specific async runtime.

protocols/mdns/src/behaviour · high confidence

prost-codec: Migrate to prost 0.14 and replace UviBytes framing with unsigned-varint encoding

The \misc/prost-codec\ library has been updated to use \prost\ 0.14 and replaced the previous \UviBytes\-based framing with manual unsigned-varint encoding/decoding for improved performance. This change introduces new helper functions (\decode\_field\_tag\, \consume\_message\, \consume\_message\_prefix\) for parsing protobuf wire format without allocation, raises the MSRV to 1.88.0, and improves error handling by using \\#\[error(transparent)\]\ on the \Error\ type and adding \From\<Error\> for io::Error\ conversion. The codec now derives \Debug\ and \Clone\, and includes comprehensive tests including QuickCheck-based roundtrip property tests.

misc/prost-codec · high confidence

yamux muxer upgraded to v0.14 with auto-tuned flow control and removed rand dependency

The yamux multiplexer implementation has been updated to use the yamux crate v0.14, which removes the runtime dependency on the \rand\ crate. This version enables auto-tuning for the Yamux stream receive window by default, allowing high-latency or high-bandwidth connections to better exhaust available bandwidth while preserving small buffers for low-latency connections. The minimum supported Rust version (MSRV) has also been raised to 1.88.0.

muxers/yamux · high confidence

Test coverage

Add WebTransport integration tests for WASM environments; Added Kademlia behaviour tests; Added QUIC transport tests for tokio; Added UI tests for derive macro attribute validation; Added WebTransport tests for WASM environments; Added benchmark for mplex split\_send\_size configuration; Added benchmarking suite for PeerId operations; Added comprehensive test suite for GossipSub behaviour; Added encoding benchmark for quick-protobuf-codec; Added integration test for the libp2p performance protocol; Added integration tests for AutoNAT client, server, and v2 behaviors; Added integration tests for Direct Connection Upgrade through Relay (DCUtR); Added integration tests for Keypair and PeerId serialization; Added integration tests for Noise transport handshake and WebTransport certificate hash validation; Added integration tests for PNet transport connectivity; Added integration tests for circuit relay reservation and lifecycle behavior; Added integration tests for request-response error reporting and peer address handling; Added integration tests for the Identify protocol behavior; Added integration tests for the Rendezvous protocol; Added integration tests for the libp2p-stream protocol; Added mDNS discovery tests for the Tokio runtime; Added property-based tests for plaintext transport message exchange; Added smoke and concurrency tests for the WebRTC transport; Added smoke test for TLS transport integration; Added smoke tests for Gossipsub multi-hop message propagation; Added test for encoding large messages; Added test for transport upgrade pipeline; Added test utilities for memory connection limits; Added tests for Kademlia client/server mode behavior; Added tests for memory-based connection limits; Added tests for swarm connection closure, listener management, and derive macro; Added yamux compliance tests using the new test harness; New test harness for StreamMuxer implementations.

Dependencies

1771 commits updating dependencies (74 manifests)

A dependency / build maintenance change in (dependencies) — 1771 commits (173 fixs), 74 files.

(dependencies) · high confidence · unverified

DNS transport updated to Hickory v0.26 with MSRV 1.88.0

The DNS transport crate has been updated to use Hickory DNS dependencies version 0.26, which changes the \ResolveError\ type to alias hickory's \NetError\ and modifies the \Resolver\ trait's lookup methods to return \Lookup\. The minimum supported Rust version (MSRV) has been raised to 1.88.0, and the \\#\[async\_trait\]\ requirement on the \Resolver\ trait has been removed in favor of native async methods.

transports/dns · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 75.

Lenses

  • Code Health 89
  • Architecture 99
  • Maturity 72
  • Readiness 80
  • Security 69
  • Domain Modelling 100
  • Event Sourcing 100

Changes since last survey

  • 300 commits — 243 feature/other, 57 fixes

By area

  • (root) — 143 commits
  • protocols/gossipsub — 51 commits
  • .github/workflows — 23 commits
  • protocols/relay — 7 commits
  • libp2p/src — 5 commits
  • protocols/kad — 5 commits
  • protocols/upnp — 5 commits
  • protocols/autonat — 4 commits
  • wasm-tests/webtransport-tests — 4 commits
  • protocols/request-response — 3 commits
  • swarm/src — 3 commits
  • transports/quic — 3 commits
  • transports/tcp — 3 commits
  • transports/tls — 3 commits
  • .github/mergify.yml — 2 commits
  • misc/metrics — 2 commits
  • misc/peer-store — 2 commits
  • protocols/mdns — 2 commits
  • protocols/rendezvous — 2 commits
  • transports/pnet — 2 commits

Notable commits

  • fix: chore(*): fix clippy 1.95.0-beta.3 lints
  • fix: chore(ci): fix cargo deny to address RUSTSEC-2025-0134
  • fix: chore(ci): fix intra doc links job
  • fix: chore(ci): fix transport interop tests
  • fix: chore(memory-connection-limits): fix tests
  • fix: chore(webrtc): bump crate version, fix changelog
  • fix: chore: fix clippy beta lints
  • fix: chore: fix clippy lints
  • fix: chore: fix clippy(beta) error
  • fix: chore: update and fix CHANGELOG.md entries
  • fix: fix(autonat): dial first address in multi-address DialRequest
  • fix: fix(ci): mergify script
  • fix: fix(floodsub): remove rand 0.7 dependency
  • fix: fix(gossipsub): Always construct mesh
  • fix: fix(gossipsub): Changed unsubscribe_backoff to expect Duration
  • fix: fix(gossipsub): Count forwarded messages in metrics
  • fix: fix(gossipsub): Do not handle IHAVE for peers supporting partials
  • fix: fix(gossipsub): Don't forward full messages to peers requesting partials
  • fix: fix(gossipsub): Fix underflow when shuffling peers after prunning.
  • fix: fix(gossipsub): Remove penalty for duplicate publish messages
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

libp2p/rust-libp2p was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 13 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 7171dce2f90c05ba7892d4ba926abb1881db27c7 — the exact code this score is about.
  • Scored under rubric-2026.09.10 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-7a6aa1c33003.