-
Patch reporting on banned peers and their non-banned and banned connections (see PR 2350).
-
Update dependencies.
-
Migrate to Rust edition 2021 (see PR 2339).
-
Update
Connection::address
oninject_address_change
(see PR 2362). -
Move
swarm::Toggle
toswarm::behaviour::Toggle
(see PR 2375). -
Add
Swarm::connected_peers
(see PR 2378). -
Implement
swarm::NetworkBehaviour
oneither::Either
(see PR 2370). -
Allow overriding dial concurrency factor per dial via
DialOpts::override_dial_concurrency_factor
. See PR 2404. -
Report negotiated and expected
PeerId
as well as remote address inDialError::WrongPeerId
(see PR 2428). -
Allow overriding role when dialing through
override_role
option onDialOpts
. This option is needed for NAT and firewall hole punching. See PR 2363.
-
Use
instant
andfutures-timer
instead ofwasm-timer
(see PR 2245). -
Enable advanced dialing requests both on
Swarm::dial
and viaNetworkBehaviourAction::Dial
. Users can now trigger a dial with a specific set of addresses, optionally extended viaNetworkBehaviour::addresses_of_peer
.Changes required to maintain status quo:
-
Previously
swarm.dial(peer_id)
nowswarm.dial(DialOpts::peer_id(peer_id).build())
orswarm.dial(peer_id)
given thatDialOpts
implementsFrom<PeerId>
. -
Previously
swarm.dial_addr(addr)
nowswarm.dial(DialOpts::unknown_peer_id().address(addr).build())
orswarm.dial(addr)
given thatDialOpts
implementsFrom<Multiaddr>
. -
Previously
NetworkBehaviourAction::DialPeer { peer_id, condition, handler }
nowNetworkBehaviourAction::Dial { opts: DialOpts::peer_id(peer_id) .condition(condition) .build(), handler, }
-
Previously
NetworkBehaviourAction::DialAddress { address, handler }
nowNetworkBehaviourAction::Dial { opts: DialOpts::unknown_peer_id() .address(address) .build(), handler, }
See PR 2317.
-
-
Make default features of
libp2p-core
optional. PR 2181 -
Update dependencies.
-
Provide default implementations for all functions of
NetworkBehaviour
, except fornew_handler
,inject_event
andpoll
. This should make it easier to create new implementations. See PR 2150. -
Remove
Swarm
type alias and renameExpandedSwarm
toSwarm
. Reduce direct trait parameters onSwarm
(previouslyExpandedSwarm
), deriving parameters through associated types onTBehaviour
. See PR 2182. -
Require
ProtocolsHandler::{InEvent,OutEvent,Error}
to implementDebug
(see PR 2183). -
Implement
ProtocolsHandler
oneither::Either
representing either of twoProtocolsHandler
implementations (see PR 2192). -
Require implementation to provide handler in
NetworkBehaviourAction::DialPeer
andNetworkBehaviourAction::DialAddress
. Note that the handler is returned to theNetworkBehaviour
on connection failure and connection closing. Thus it can be used to carry state, which otherwise would have to be tracked in theNetworkBehaviour
itself. E.g. a message destined to an unconnected peer can be included in the handler, and thus directly send on connection success or extracted by theNetworkBehaviour
on connection failure (see PR 2191). -
Include handler in
NetworkBehaviour::inject_dial_failure
,NetworkBehaviour::inject_connection_closed
,NetworkBehaviour::inject_listen_failure
(see PR 2191). -
Include error in
NetworkBehaviour::inject_dial_failure
and callNetworkBehaviour::inject_dial_failure
onDialPeerCondition
evaluating to false. To emulate the previous behaviour, return early withininject_dial_failure
onDialError::DialPeerConditionFalse
. See PR 2191. -
Make
NetworkBehaviourAction
generic overNetworkBehaviour::OutEvent
andNetworkBehaviour::ProtocolsHandler
. In most cases, change your generic type parameters toNetworkBehaviourAction<Self::OutEvent, Self::ProtocolsHandler>
. See PR 2191. -
Return
bool
instead ofResult<(), ()>
forSwarm::remove_listener
(see PR 2261). -
Concurrently dial address candidates within a single dial attempt (see PR 2248) configured via
Swarm::dial_concurrency_factor
.-
On success of a single address, report errors of the thus far failed dials via
SwarmEvent::ConnectionEstablished::outgoing
. -
On failure of all addresses, report errors via the new
SwarmEvent::OutgoingConnectionError
. -
Remove
SwarmEvent::UnreachableAddr
andSwarmEvent::UnknownPeerUnreachableAddr
event. -
In
NetworkBehaviour::inject_connection_established
provide errors of all thus far failed addresses. -
On unknown peer dial failures, call
NetworkBehaviour::inject_dial_failure
with a peer ID ofNone
. -
Remove
NetworkBehaviour::inject_addr_reach_failure
. Information is now provided viaNetworkBehaviour::inject_connection_established
andNetworkBehaviour::inject_dial_failure
.
-
-
Update dependencies.
-
Drive
ExpandedSwarm
viaStream
trait only.-
Change
Stream
implementation ofExpandedSwarm
to return allSwarmEvents
instead of only theNetworkBehaviour
's events. -
Remove
ExpandedSwarm::next_event
. Users can use<ExpandedSwarm as StreamExt>::next
instead. -
Remove
ExpandedSwarm::next
. Users can use<ExpandedSwarm as StreamExt>::filter_map
instead.
See PR 2100 for details.
-
-
Add
ExpandedSwarm::disconnect_peer_id
andNetworkBehaviourAction::CloseConnection
to close connections to a specific peer via anExpandedSwarm
orNetworkBehaviour
. See PR 2110 for details. -
Expose the
ListenerId
inSwarmEvent
s that are associated with a listener.See PR 2123 for details.
-
Remove
Deref
andDerefMut
implementations previously dereferencing to theNetworkBehaviour
onSwarm
. Instead one can access theNetworkBehaviour
viaSwarm::behaviour
andSwarm::behaviour_mut
. Methods onSwarm
can now be accessed directly, e.g. viamy_swarm.local_peer_id()
. You may use the command below to transform fully qualified method calls onSwarm
to simple method calls PR 1995.# Go from e.g. `Swarm::local_peer_id(&my_swarm)` to `my_swarm.local_peer_id()`. grep -RiIl --include \*.rs --exclude-dir target . --exclude-dir .git | xargs sed -i "s/\(libp2p::\)*Swarm::\([a-z_]*\)(&mut \([a-z_0-9]*\), /\3.\2(/g"
-
Extend
NetworkBehaviour
callbacks, more concretely introducing newfn inject_new_listener
andfn inject_expired_external_addr
and havefn inject_{new,expired}_listen_addr
provide aListenerId
PR 2011.
-
New error variant
DialError::InvalidAddress
-
Swarm::dial_addr()
now returns aDialError
on error. -
Remove the option for a substream-specific multistream select protocol override. The override at this granularity is no longer deemed useful, in particular because it can usually not be configured for existing protocols like
libp2p-kad
and others. There is aSwarm
-scoped configuration for this version available since 1858.
- Have
ToggleProtoHandler
ignore listen upgrade errors when disabled. PR 1945.
-
Make
OneShotHandler
smax_dial_negotiate
limit configurable. PR 1936. -
Fix handling of DialPeerCondition::Always. PR 1937.
- Update dependencies.
-
Update
libp2p-core
. -
Remove
NotifyHandler::All
thus removing the requirement for events send from aNetworkBehaviour
to aProtocolsHandler
to beClone
. PR 1880.
- Add
ExpandedSwarm::is_connected
. PR 1862.
-
Permit a configuration override for the substream upgrade protocol to use for all (outbound) substreams. PR 1858.
-
Changed parameters for connection limits from
usize
tou32
. Connection limits are now configured viaSwarmBuilder::connection_limits()
. -
Update
libp2p-core
. -
Expose configurable scores for external addresses, as well as the ability to remove them and to add addresses that are retained "forever" (or until explicitly removed). PR 1842.
- Update dependencies.
-
Require a
Boxed
transport to be given to theSwarm
orSwarmBuilder
to avoid unnecessary double-boxing of transports and simplify API bounds. PR 1794 -
Respect inbound timeouts and upgrade versions in the
MultiHandler
. PR 1786. -
Instead of iterating each inbound and outbound substream upgrade looking for one to make progress, use a
FuturesUnordered
for both pending inbound and pending outbound upgrades. As a result only those upgrades are polled that are ready to progress.Implementors of
InboundUpgrade
andOutboundUpgrade
need to ensure to wake up the underlying task once they are ready to make progress as they won't be polled otherwise.
-
Bump
libp2p-core
dependency. -
Adds
ProtocolsHandler::InboundOpenInfo
type which mirrors the existingOutboundOpenInfo
type. A value of this type is passed as an extra argument toProtocolsHandler::inject_fully_negotiated_inbound
andProtocolsHandler::inject_listen_upgrade_error
. -
SubstreamProtocol
now has a second type parameter corresponding to inbound or outbound information, a value of which is part ofSubstreamProtocol
now. ConsequentlyProtocolsHandlerEvent::OutboundSubstreamRequest
no longer has a separateinfo
field.
-
Add missing delegation calls in some
ProtocolsHandler
wrappers. See PR 1710. -
Add as_ref and as_mut functions to Toggle PR 1684.
-
The
cause
ofSwarmEvent::ConnectionClosed
is now anOption
, andNone
indicates an active connection close not caused by an error. -
DialError::Banned
has been added and is returned fromSwarm::dial
if the peer is banned, thereby also invoking theNetworkBehaviour::inject_dial_failure
callback. -
Update the
libp2p-core
dependency to0.21
, fixing 1584. -
Fix connections being kept alive by
OneShotHandler
when not handling any requests PR 1698.
-
Documentation updates.
-
Ignore addresses returned by
NetworkBehaviour::addresses_of_peer
that theSwarm
considers to be listening addresses of the local node. This avoids futile dialing attempts of a node to itself, which can otherwise even happen in genuine situations, e.g. after the local node changed its network identity and a behaviour makes a dialing attempt to a former identity using the same addresses.
-
Updated the
libp2p-core
dependency. -
Add
ProtocolsHandler::inject_listen_upgrade_error
, the inbound analogue ofProtocolsHandler::inject_dial_upgrade_error
, with an empty default implementation. No implementation is required to retain existing behaviour. -
Add
ProtocolsHandler::inject_address_change
andNetworkBehaviour::inject_address_change
to notify of a change in the address of an existing connection.
- Bugfix: Fix MultiHandler panicking when empty (PR 1598).