- 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.