- In some situations,
multistream-select
will now assume that protocol negotiation immediately succeeds. If it turns out that it failed, an error is generated when reading or writing from/to the stream. - Replaced
listen_addr
withlocal_addr
in events related to incoming connections. The address no longer has to match a previously-reported address. - Listeners now have an identifier and can be stopped.
- Added
NetworkBehaviour::inject_listener_error
andNetworkBehaviour::inject_listener_closed
. For diagnostic purposes, listeners can now report errors on incoming connections, such as when callingaccept(2)
fails. - Fixed tasks sometimes not being notified when a network event happens in
libp2p-mplex
. - Fixed a memory leak in
libp2p-kad
. - Added
Toggle::is_enabled()
. - Removed
IdentifyTransport
.
libp2p-kad
: Completed the core functionality of the record storage API, thereby extending theRecordStore
for provider records. All records expire by default and are subject to regular republication and caching as per the Kademlia spec(s). Expiration and publication intervals are configurable through theKademliaConfig
.libp2p-kad
: The routing table now never stores peers without a known (listen) address. In particular, on receiving a new inbound connection, the Kademlia behaviour now emitsKademliaEvent::UnroutablePeer
to indicate that in order for the peer to be added to the routing table and hence considered a reachable node in the DHT, a listen address of the peer must be discovered and reported viaKademlia::add_address
. This is usually achieved through the use of theIdentify
protocol on the same connection(s).libp2p-kad
: Documentation updates.- Extracted the
swarm
andprotocols_handler
-related contents fromlibp2p-core
to a newlibp2p-swarm
crate. - Renamed
RawSwarm
toNetwork
. - Added
Floodsub::publish_any
. - Replaced unbounded channels with bounded ones at the boundary between the
Network
(formerlyRawSwarm
) andNodeHandler
. The node handlers will now wait if the main task is busy, instead of continuing to push events to the channel. - Fixed the
address_translation
function ignoring/dns
addresses.
PollParameters
is now a trait instead of a struct.- The
Swarm
can now be customized with connection information. - Fixed write-only substreams now delivering data properly.
- Fixed the TCP listener accidentally shutting down if an incoming socket was closed too quickly.
- Improved the heuristics for determining external multiaddresses based on reports.
- Various fixes to Kademlia iterative queries and the WebSockets transport.
EitherOutput
now implementsStream
andSink
if their variants also implement these traits.libp2p::websocket::error::Error
now implementsSync
.
- Major fixes and performance improvements to libp2p-kad.
- Initial prototype for record storage in libp2p-kad.
- Rewrote the implementation of WebSockets. It now properly supports WebSockets Secure (WSS).
- Removed
BrowserWsConfig
. Please uselibp2p::wasm_ext::ExtTransport
instead. - Added a
Path
parameter tomultiaddr::Protocol::WS
andWSS
. The string representation when a path is present is respectivelyx-parity-ws/<path>
andx-parity-wss/<path>
where<path>
is percent-encoded. - Fixed an issue with
libp2p-tcp
where the wrong listened address was returned, if the actual address was loopback. - Added
core::upgrade::OptionalUpgrade
. - Added some utility functions in
core::identity::secp256k1
. - It is now possible to inject an artificial connection in the
RawSwarm
.
- Fixed a vulnerability in ED25519 signatures verification in libp2p-core.
- Crate now successfully runs from within the browser when compiled to WASM.
- Modified the constructors of
NoiseConfig
to accept any type of public key. The Noise handshake has consequently been modified. - Changed the
StreamMuxer
trait to have anError
associated type. - The
Swarm
now ranks externally-visible multiaddresses by how often they have been reported, ensuring that weird or malicious reports don't affect connectivity too much. - Added
IntoProtocolsHandler::inbound_protocol
. Must return the same value as whatProtocolsHandler::listen_protocol
would return. IntoProtocolsHandler::into_handler
now takes a second parameter with the&ConnectedPoint
to the node we are connected to.- Replaced the
secp256k1
crate withlibsecp256k1
. - Fixed
Kademlia::add_providing
taking aPeerId
instead of aMultihash
. - Fixed various bugs in the implementation of
Kademlia
. - Added
OneSubstreamMuxer
. - Added the
libp2p-wasm-ext
crate. - Added
multiaddr::from_url
. - Added
OptionalTransport
.
- Fixed a vulnerability in ED25519 signatures verification in libp2p-core.
- Fixed the inactive connections shutdown mechanism not working.
Transport::listen_on
must now return aStream
that producesListenEvent
s. This makes it possible to notify about listened addresses at a later point in time.Transport::listen_on
no longer returns an address we're listening on. This is done throughListenEvent
s. All otherlisten_on
methods have been updated accordingly.- Added
NetworkBehaviour::inject_new_listen_addr
,NetworkBehaviour::inject_expired_listen_addr
andNetworkBehaviour::inject_new_external_addr
. ProtocolsHandler::listen_protocol
andProtocolsHandlerEvent::OutboundSubstreamRequest
must now return aSubstreamProtocol
struct containing a timeout for the upgrade.Ping::new
now requires aPingConfig
, which can be created withPingConfig::new
.- Removed
Transport::nat_traversal
in favour of a stand-aloneaddress_translation
function inlibp2p-core
. - Reworked the API of
Multiaddr
. - Removed the
ToMultiaddr
trait in favour ofTryFrom
. - Added
Swarm::ban_peer_id
andSwarm::unban_peer_id
. - The
TPeerId
generic parameter ofRawSwarm
is nowTConnInfo
and must now implement aConnectionInfo
trait. - Reworked the
PingEvent
. - Renamed
KeepAlive::Forever
toYes
andKeepAlive::Now
toNo
.
- Replaced
NetworkBehaviour::inject_dial_failure
withinject_dial_failure
andinject_addr_reach_failure
. The former is called when we have finished trying to dial a node without success, while the latter is called when we have failed to reach a specific address. - Fixed Kademlia storing a different hash than the reference implementation.
- Lots of bugfixes in Kademlia.
- Modified the
InboundUpgrade
andOutboundUpgrade
trait to take aNegotiated<TSocket>
instead ofTSocket
. PollParameters::external_addresses
now returnsMultiaddr
es as reference instead of by value.- Added
Swarm::external_addresses
. - Added a
core::swarm::toggle::Toggle
that allows having a disabledNetworkBehaviour
.
- Moved the
SecioKeypair
struct incore/identity
and renamed it toKeypair
. - mplex now supports half-closed substreams.
- Renamed
StreamMuxer::shutdown()
toclose()
. - Closing a muxer with the
close()
method (formerlyshutdown
) now "destroys" all the existing substreams. Afterclose()
as been called, they all return either EOF or an error. - The
shutdown_substream()
method now closes only the writing side of the substream, and you can continue reading from it until EOF or until you delete it. This was actually already more or less the case before, but it wasn't properly reflected in the API or the documentation. poll_inbound()
andpoll_outbound()
no longer return anOption
, asNone
was the same as returning an error.- Removed the
NodeClosed
events and renamedNodeError
toNodeClosed
. From the API's point of view, a connection now always closes with an error. - Added the
NodeHandlerWrapperError
enum that describes an error generated by the protocols handlers grouped together. It is eitherUselessTimeout
orHandler
. This allows properly reporting closing a connection because it is useless. - Removed
NodeHandler::inject_inbound_closed
,NodeHandler::inject_outbound_closed
,NodeHandler::shutdown
, andProtocolsHandler::shutdown
. The handler is now dropped when a shutdown process starts. This should greatly simplify writing a handler. StreamMuxer::close
now impliesflush_all
.- Removed the
Shutdown
enum fromstream_muxer
. - Removed
ProtocolsHandler::fuse()
. - Reworked some API of
core/nodes/node.rs
andcore/nodes/handled_node.rs
. - The core now works even outside of a tokio context.
- Fixed periodic pinging not working.
- Fixed wrong version of libp2p-noise.
- The
multiaddr!
macro has been moved to themultiaddr
crate and is now reexported under the namebuild_multiaddr!
. - Modified the functions in
upgrade::transfer
to be more convenient to use. - Now properly sending external addresses in the identify protocol.
- Fixed duplicate addresses being reported in identify and Kademlia.
- Fixed infinite looping in the functions in
upgrade::transfer
. - Fixed infinite loop on graceful node shutdown with the
ProtocolsHandlerSelect
. - Fixed various issues with nodes dialing each other simultaneously.
- Added the
StreamMuxer::is_remote_acknowledged()
method. - Added a
BandwidthLogging
transport wrapper that logs the bandwidth consumption. - The addresses to try dialing when dialing a node is now refreshed by the
Swarm
when necessary. - Lots of modifications to the semi-private structs in
core/nodes
. - Added
IdentifyEvent::SendBack
, when we send back our information. - Rewrote the
MemoryTransport
to be similar to theTcpConfig
.
- Added
NetworkBehaviour::inject_replaced
that is called whenever we replace a connection with a different connection to the same peer. - Fixed various issues with Kademlia.
- Removed the
topology
module and everything it contained, including theTopology
trait. - Added
libp2p-noise
that supports Noise handshakes, as an alternative tolibp2p-secio
. - Updated
ring
to version 0.14. - Creating a
Swarm
now expects thePeerId
of the local node, instead of aTopology
. - Added
NetworkBehaviour::addresses_of_peer
that returns the addresses aNetworkBehaviour
knows about a given peer. This exists as a replacement for the topology. - The
Kademlia
andMdns
behaviours now report and store the list of addresses they discover. - You must now call
Floodsub::add_node_to_partial_view()
andFloodsub::remove_node_from_partial_view
to add/remove nodes from the list of nodes that floodsub must send messages to. - Added
NetworkBehaviour::inject_dial_failure
that is called when we fail to dial an address. ProtocolsHandler::connection_keep_alive()
now returns aKeepAlive
enum that provides more fine grained control.- The
NodeHandlerWrapper
no longer has a 5 seconds inactivity timeout. This is now handled entirely byProtocolsHandler::connection_keep_alive()
. - Now properly denying connections incoming from the same
PeerId
as ours. - Added a
SwarmBuilder
. Theincoming_limit
method lets you configure the number of simultaneous incoming connections. - Removed
FloodsubHandler
,PingListenHandler
andPeriodicPingHandler
. - The structs in
core::nodes
are now generic over thePeerId
. - Added
SecioKeypair::ed25519_raw_key()
. - Fix improper connection shutdown in
ProtocolsHandler
.
- Fixed improper dependencies versions causing deriving
NetworkBehaviour
to generate an error.
- Added the
IntoNodeHandler
andIntoProtocolsHandler
traits, allowing node handlers and protocol handlers to know thePeerId
of the node they are interacting with.
- The
Transport
trait now has anError
associated type instead of always usingstd::io::Error
. - Merged
PeriodicPing
andPingListen
into onePing
behaviour. Floodsub
now generatesFloodsubEvent
s instead of direct floodsub messages.- Added
ProtocolsHandler::connection_keep_alive
. If all the handlers returnfalse
, then the connection to the remote node will automatically be gracefully closed after a few seconds. - The crate now successfuly compiles for the
wasm32-unknown-unknown
target. - Updated
ring
to version 0.13. - Updated
secp256k1
to version 0.12. - The enum returned by
RawSwarm::peer()
can now returnLocalNode
. This makes it impossible to accidentally attempt to dial the local node. - Removed
Transport::map_err_dial
. - Removed the
Result
from some connection-related methods in theRawSwarm
, as they could never error. - If a node doesn't respond to pings, we now generate an error on the connection instead of trying to gracefully close it.