0.45.1
- Update
libp2p-swarm-deriveto version0.35.0, see PR 5545
0.45.0
- Implement refactored
Transport. See PR 4568 - Move
address_translationinto swarm and intolibp2p-identify. See PR 4568
0.44.3
- Optimize internal connection
fn poll. New implementation now scales much better with number of listen protocols active. No changes to public API introduced. See PR 5026 - Add peer_id to
FromSwarm::ListenFailure. See PR 4818. - Use
web-timeinstead ofinstant. See PR 5347. - Add
#[track_caller]on allspawnwrappers. See PR 5465. - Add ConnectionError to FromSwarm::ConnectionClosed. See PR 5485.
0.44.2
- Allow
NetworkBehaviours to share addresses of peers. This is enabled via the newToSwarm::NewExternalAddrOfPeerevent. The address is broadcast to all behaviours viaFromSwarm::NewExternalAddrOfPeer. Protocols that want to collect these addresses can use the newPeerAddressesutility. See PR 4371.
0.44.1
- Implement
Clone&Copyfor `FromSwarm. This makes it easier to forward these events when wrapping other behaviours. See PR 4825.
0.44.0
- Add
#[non_exhaustive]toFromSwarm,ToSwarm,SwarmEvent,ConnectionHandlerEvent,ConnectionEvent. See PR 4581. - Remove
handlerfield fromConnectionClosed. If you need to transfer state from aConnectionHandlerto itsNetworkBehaviourwhen a connection closes, useConnectionHandler::poll_close. See PR 4076. - Remove deprecated
PollParametersfromNetworkBehaviour::pollfunction. See PR 4490. - Remove deprecated
ConnectionHandlerEvent::CloseandConnectionHandler::Error.ConnectionHandlers should not close connections directly as the connection might still be in use by other handlers. See PR 4755. - Add
PeerCondition::DisconnectedAndNotDialingvariant, combining pre-existing conditions. This is the new default. A new dialing attempt is iniated only if the peer is both considered disconnected and there is currently no ongoing dialing attempt. See PR 4225. - Remove deprecated
keep_alive_timeoutinOneShotHandlerConfig. See PR 4677. - Don't close entire connection upon
DialUpgradeErrors withinOneShotHandler. Instead, the error is reported asErr(e)viaConnectionHandler::ToBehaviour. See PR 4715. - Log
PeerIdofSwarmeven when constructed with newSwarmBuilder. See PR 4671. - Add
SwarmEvent::{NewExternalAddrCandidate,ExternalAddrConfirmed,ExternalAddrExpired}variants. See PR 4721. - Remove deprecated symbols. See PR 4737.
0.43.7
- Deprecate
ConnectionHandlerEvent::Close. See issue 3591 for details. See PR 4714.
0.43.6
- Deprecate
libp2p::swarm::SwarmBuilder. Most users should uselibp2p::SwarmBuilder. In some special cases, users may need to useSwarm::newandConfiginstead of the newlibp2p::SwarmBuilder. See PR 4120. - Make the
Debugimplementation ofStreamProtocolmore concise. See PR 4631. - Fix overflow in
KeepAlivecomputation that could occur panic atDelay::newifSwarmBuilder::idle_connection_timeoutis configured too large. See PR 4644. - Deprecate
KeepAlive::Until. Individual protocols should not keep connections alive for longer than necessary. Users should useswarm::Config::idle_connection_timeoutinstead. See PR 4656. - Deprecate
keep_alive_timeoutinOneShotHandlerConfig. See PR 4680.
0.43.5
- Fix overflow in
KeepAlivecomputation that could occur ifSwarmBuilder::idle_connection_timeoutis configured withu64::MAX. See PR 4559.
0.43.4
Implement
Debugfor event structs. See PR 4426.Improve error message when
DialPeerConditionprevents a dial. See PR 4409.Introduce
SwarmBuilder::idle_conncetion_timeoutand deprecatekeep_alive::Behaviouras a result. See PR 4161.
0.43.3
- Implement
DisplayforConnectionId. See PR 4278.
0.43.2
- Display the cause of a
ListenError::Denied. See PR 4232
0.43.1
- Do not announce external address candidate before address translation, unless translation does not apply. This will prevent ephemeral TCP addresses being announced as external address candidates. See PR 4158.
0.43.0
Allow
NetworkBehavioursto create and remove listeners. See PR 3292.Raise MSRV to 1.65. See PR 3715.
Introduce
StreamProtocoltype. This type enforces invariants on protocol names, such as leading forward slashes and correct UTF8 encoding. See PR 3746.Return a bool from
ExternalAddresses::on_swarm_eventandListenAddresses::on_swarm_eventindicating whether any state was changed. See PR 3865.Remove deprecated banning API from
Swarm. Users should migrate tolibp2p::allow_block_list. See PR 3886.Remove
ConnectionHandlerUpgrErr::Timervariant. This variant was never constructed and thus dead code. See PR 3605.Remove deprecated
IntoConnectionHandlerand all its implementations. This also removes theNetworkBehaviour::new_handlerandNetworkBehaviour::addresses_of_peermethods. See changelog for0.42on how to migrate. See PR 3884.Remove
ConnectionHandlerUpgrErr::Timervariant. This variant was never constructed and thus dead code. See PR 3605.Flatten
ConnectionHandlerUpgrErrand rename toStreamUpgradeError. See PR 3882.Remove deprecated
ConnectionLimits. Users should migrate tolibp2p::connection_limits::Behaviour. See PR 3885.Allow
ConnectionHandlers to report and learn about the supported protocols on a connection. The newly introduced API elements are:ConnectionHandlerEvent::ReportRemoteProtocolsConnectionEvent::LocalProtocolsChangeConnectionEvent::RemoteProtocolsChange
See PR 3651.
Deprecate the
NegotiatedSubstreamtype and replace it withStream. See PR 3912.Rename
NetworkBehaviour::OutEventtoNetworkBehaviour::ToSwarm,ConnectionHandler::InEventtoConnectionHandler::FromBehaviour,ConnectionHandler::OutEventtoConnectionHandler::ToBehaviour. See PR 3848.Remove deprecated
NetworkBehaviourActiontype. See PR 3919.Expose
ConnectionIdonSwarmEvent::{ConnectionEstablished,ConnectionClosed,IncomingConnection,IncomingConnectionError,OutgoingConnectionError,Dialing}. Also emitSwarmEvent::Dialingfor dials with unknownPeerId. See PR 3927.Rename
ConnectionHandlerEvent::CustomtoConnectionHandlerEvent::NotifyBehaviour. See PR 3955.Remove
DialError::InvalidPeerIdvariant. With the move tomultiaddrv0.18.0peer IDs in/p2pare type safe and thus usage of the contained peer ID can not result in a parsing error. See PR 4037.Remove deprecated items. See PR 3956.
Add ability to
downcast_refConnectionDenied errors. See PR 4020.
0.42.2
- Add
ConnectionEvent::{is_outbound,is_inbound}. See PR 3625.
0.42.1
Deprecate
ConnectionLimitsin favor oflibp2p::connection_limits. See PR 3386.Introduce
ConnectionId::new_uncheckedto allow for more sophisticated, manual tests ofNetworkBehaviour. See PR 3652.Deprecate
Swarm::ban_peer_idin favor of the newlibp2p::allow_block_listmodule. See PR 3590.Rename
NetworkBehaviourActiontoToSwarm. A deprecated type-alias is provided to ease the transition. The new name is meant to better indicate the message-passing relationship betweenSwarmandNetworkBehaviour. See PR 3658.
0.42.0
Allow
NetworkBehaviours to manage connections. We deprecateNetworkBehaviour::new_handlerandNetworkBehaviour::addresses_of_peerin favor of four new callbacks:NetworkBehaviour::handle_pending_inbound_connectionNetworkBehaviour::handle_pending_outbound_connectionNetworkBehaviour::handle_established_inbound_connectionNetworkBehaviour::handle_established_outbound_connection
Please note that due to limitations in the Rust compiler, implementations of
new_handlerandaddresses_of_peerare not flagged as deprecated. Nevertheless, they will be removed in the future.All four are fallible and returning an error from any of them will abort the given connection. This allows you to create dedicated
NetworkBehaviours that only concern themselves with managing connections. For example:- checking the
PeerIdof a newly established connection against an allow/block list - only allowing X connection upgrades at any one time
- denying incoming or outgoing connections from a certain IP range
- only allowing N connections to or from the same peer
See PR 3254.
Remove
handlerfield fromNetworkBehaviourAction::Dial. Instead of constructing the handler early, you can now access theConnectionIdof the future connection onDialOpts.ConnectionIds areCopyand will be used throughout the entire lifetime of the connection to report events. This allows you to send events to a very specific connection, much like you previously could directly set state in the handler.Removing the
handlerfield also reduces the type parameters ofNetworkBehaviourActionfrom three to two. The third one used to be defaulted to theInEventof theConnectionHandler. You now have to manually specify that where you previously had to specify theConnectionHandler. This very likely will trigger convoluted compile errors about traits not being implemented.Within
NetworkBehaviourAction::poll, the easiest way to migrate is to do this (in the example oflibp2p-floodsub):--- a/protocols/floodsub/src/layer.rs +++ b/protocols/floodsub/src/layer.rs @@ -472,7 +465,7 @@ impl NetworkBehaviour for Floodsub { &mut self, _: &mut Context<'_>, _: &mut impl PollParameters, - ) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ConnectionHandler>> { + ) -> Poll<NetworkBehaviourAction<Self::OutEvent, THandlerInEvent<Self>>> {In other words:
Search Replace NetworkBehaviourAction<Self::OutEvent, Self::ConnectionHandler>NetworkBehaviourAction<Self::OutEvent, THandlerInEvent<Self>>If you reference
NetworkBehaviourActionsomewhere else as well, you may have to fill in the type ofConnectionHandler::InEventmanually as the 2nd parameter.See PR 3328.
Update to
libp2p-corev0.39.0.Removed deprecated Swarm constructors. For transition notes see 0.41.0. See PR 3170.
Deprecate functions on
PollParametersin preparation forPollParametersto be removed entirely eventually. See PR 3153.Add
estblished_intoSwarmEvent::ConnectionEstablished. See PR 3134.Remove deprecated
inject_*methods fromNetworkBehaviourandConnectionHandler. Make the implementation ofon_swarm_eventandon_connection_handler_eventboth mandatory. See PR 3264 and PR 3364.Update to
libp2p-swarm-derivev0.32.0.Replace
SwarmBuilder::connection_event_buffer_sizewithSwarmBuilder::per_connection_event_buffer_size. The configured value now applies per connection. The default values remains 7. If you have previously setconnection_event_buffer_sizeyou should re-evaluate what a good size for a per connection buffer is. See PR 3188.Remove
DialError::ConnectionIovariant. This was never constructed. See PR 3374.Introduce
ListenErrorand use it withinSwarmEvent::IncomingConnectionError. See PR 3375.Remove
PendingConnectionError,PendingInboundConnectionErrorandPendingOutboundConnectionErrorfrom the public API. They are no longer referenced anywhere with the addition ofListenError. See PR 3497.Remove
ConnectionId::new. Manually creatingConnectionIds is now unsupported. See PR 3327.Deprecate methods
Swarm::with_executor,Swarm::with_*_executor,Swarm::without_executor. Introduce similar methods inSwarmBuilder. See PR 3588.Gracefully disable oneshot handler on dial upgrade errors. See PR 3577.
0.41.1
- Update to
libp2p-swarm-derivev0.31.0.
0.41.0
Update to
libp2p-corev0.38.0.Add new
on_connection_eventmethod toConnectionHandlerthat accepts aConnectionEventenum and updateinject_*methods to callon_connection_eventwith the respectiveConnectionEventvariant and deprecateinject_*. To migrate, users should replace theConnectionHandler::inject_*calls with a single implementation ofConnectionHandler::on_connection_eventtreating eachConnectionEventvariant in the same way its correspondinginject_*call was treated. See PR 3085.Add new
on_behaviour_eventmethod with the same signature asinject_event, make the default implementation ofinject_eventcallon_behaviour_eventand deprecate it. To migrate, users should replace theConnectionHandler::inject_eventcall withConnectionHandler::on_behaviour_event. See PR 3085.Add new
on_swarm_eventmethod toNetworkBehaviourthat accepts aFromSwarmenum and updateinject_*methods to callon_swarm_eventwith the respectiveFromSwarmvariant and deprecateinject_*. To migrate, users should replace theNetworkBehaviour::inject_*calls with a single implementation ofNetworkBehaviour::on_swarm_eventtreating eachFromSwarmvariant in the same way its correspondinginject_*call was treated. See PR 3011.Add new
on_connection_handler_eventmethod with the same signature asinject_event, make the default implementation ofinject_eventcallon_connection_handler_eventand deprecate it. To migrate, users should replace theNetworkBehaviour::inject_eventcall withNetworkBehaviour::on_connection_handler_event. See PR 3011.Export
NetworkBehaviourderive aslibp2p_swarm::NetworkBehaviour. This follows the convention of other popular libraries.serdefor example exports theSerializetrait and macro asserde::Serialize. See PR 3055.Feature-gate
NetworkBehaviourmacro behindmacrosfeature flag. See PR 3055.Make executor in Swarm constructor explicit. See PR 3097.
Supported executors:
Tokio
Previously
let swarm = SwarmBuilder::new(transport, behaviour, peer_id) .executor(Box::new(|fut| { tokio::spawn(fut); })) .build();Now
let swarm = Swarm::with_tokio_executor(transport, behaviour, peer_id);Async Std
Previously
let swarm = SwarmBuilder::new(transport, behaviour, peer_id) .executor(Box::new(|fut| { async_std::task::spawn(fut); })) .build();Now
let swarm = Swarm::with_async_std_executor(transport, behaviour, peer_id);ThreadPool (see Issue 3107)
In most cases ThreadPool can be replaced by executors or spawning on the local task.
Previously
let swarm = Swarm::new(transport, behaviour, peer_id);Now
let swarm = Swarm::with_threadpool_executor(transport, behaviour, peer_id);Without
Spawns the tasks on the current task, this may result in bad performance so try to use an executor where possible. Previously this was just a fallback when no executor was specified and constructing a
ThreadPoolfailed.New
let swarm = Swarm::without_executor(transport, behaviour, peer_id);
Deprecated APIs:
Swarm::newSwarmBuilder::newSwarmBuilder::executor
Update
rust-versionto reflect the actual MSRV: 1.62.0. See PR 3090.
0.40.1
Bump rand to 0.8 and quickcheck to 1. See PR 2857.
Update to
libp2p-corev0.37.0.Introduce
libp2p_swarm::keep_alive::ConnectionHandlerin favor of removingkeep_alivefromlibp2p_swarm::dummy::ConnectionHandler.dummy::ConnectionHandlernow literally does not do anything. In the same spirit, introducelibp2p_swarm::keep_alive::Behaviourandlibp2p_swarm::dummy::Behaviour. See PR 2859.
- Pass actual
PeerIdof dial toNetworkBehaviour::inject_dial_failureonDialError::ConnectionLimit. See PR 2928.
0.39.0
Remove deprecated
NetworkBehaviourEventProcess. See libp2p-swarm v0.38.0 changelog entry for migration path.Update to
libp2p-corev0.36.0.Enforce backpressure on incoming streams via
StreamMuxerinterface. In case we hit the configured limit of maximum number of inbound streams, we will stop polling theStreamMuxerfor new inbound streams. Depending on the muxer implementation in use, this may lead to instant dropping of inbound streams. See PR 2861.
0.38.0
Deprecate
NetworkBehaviourEventProcess. When derivingNetworkBehaviouron a customstructusers should either bring their ownOutEventvia#[behaviour(out_event = "MyBehaviourEvent")]or, when not specified, have the derive macro generate one for the user.See
NetworkBehaviourdocumentation and PR 2784 for details.Previously
#[derive(NetworkBehaviour)] #[behaviour(event_process = true)] struct MyBehaviour { gossipsub: Gossipsub, mdns: Mdns, } impl NetworkBehaviourEventProcess<Gossipsub> for MyBehaviour { fn inject_event(&mut self, message: GossipsubEvent) { todo!("Handle event") } } impl NetworkBehaviourEventProcess<MdnsEvent> for MyBehaviour { fn inject_event(&mut self, message: MdnsEvent) { todo!("Handle event") } }Now
#[derive(NetworkBehaviour)] #[behaviour(out_event = "MyBehaviourEvent")] struct MyBehaviour { gossipsub: Gossipsub, mdns: Mdns, } enum MyBehaviourEvent { Gossipsub(GossipsubEvent), Mdns(MdnsEvent), } impl From<GossipsubEvent> for MyBehaviourEvent { fn from(event: GossipsubEvent) -> Self { MyBehaviourEvent::Gossipsub(event) } } impl From<MdnsEvent> for MyBehaviourEvent { fn from(event: MdnsEvent) -> Self { MyBehaviourEvent::Mdns(event) } } match swarm.next().await.unwrap() { SwarmEvent::Behaviour(MyBehaviourEvent::Gossipsub(event)) => { todo!("Handle event") } SwarmEvent::Behaviour(MyBehaviourEvent::Mdns(event)) => { todo!("Handle event") } }When deriving
NetworkBehaviouron a customstructwhere the user does not specify their ownOutEventvia#[behaviour(out_event = "MyBehaviourEvent")]and where the user does not enable#[behaviour(event_process = true)], then the derive macro generates anOutEventdefinition for the user.See
NetworkBehaviourdocumentation and PR 2792 for details.Update dial address concurrency factor to
8, thus dialing up to 8 addresses concurrently for a single connection attempt. SeeSwarm::dial_concurrency_factorand PR 2741.Update to
libp2p-corev0.35.0.
0.37.0
Update to
libp2p-corev0.34.0.Extend log message when exceeding inbound negotiating streams with peer ID and limit. See PR 2716.
Remove
connection::ListenersStreamand poll theTransportdirectly. See PR 2652.
0.36.1
- Limit negotiating inbound substreams per connection. See PR 2697.
0.36.0
Don't require
Transportto beClone. See PR 2529.Update to
libp2p-corev0.33.0.Make
behaviour::eithermodule private. See PR 2610Rename
IncomingInfo::to_connected_pointtoIncomingInfo::create_connected_point. See PR 2620.Rename
TProtoHandlertoTConnectionHandler,ToggleProtoHandlertoToggleConnectionHandler,ToggleIntoProtoHandlertoToggleIntoConnectionHandler. See PR 2640.
0.35.0
- Add impl
IntoIteratorforMultiHandler. See PR 2572. - Remove
Sendbound fromNetworkBehaviour. See PR 2535.
0.34.0 [2022-02-22]
Rename
ProtocolsHandlertoConnectionHandler. Upgrade should be as simple as renaming all occurrences ofProtocolsHandlertoConnectionHandlerwith your favorite text manipulation tool across your codebase. See PR 2527.Fold
libp2p-core'sNetworkintoSwarm. See PR 2492.Update to
libp2p-corev0.32.0.Disconnect pending connections with
Swarm::disconnect. See PR 2517.Report aborted connections via
SwarmEvent::OutgoingConnectionError. See PR 2517.
0.33.0 [2022-01-27]
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::addressoninject_address_change(see PR 2362).Move
swarm::Toggletoswarm::behaviour::Toggle(see PR 2375).Add
Swarm::connected_peers(see PR 2378).Implement
swarm::NetworkBehaviouroneither::Either(see PR 2370).Allow overriding dial concurrency factor per dial via
DialOpts::override_dial_concurrency_factor. See PR 2404.Report negotiated and expected
PeerIdas well as remote address inDialError::WrongPeerId(see PR 2428).Allow overriding role when dialing through
override_roleoption onDialOpts. This option is needed for NAT and firewall hole punching. See PR 2363.Merge NetworkBehaviour's inject_* paired methods (see PR 2445).
0.32.0 [2021-11-16]
Use
instantandfutures-timerinstead ofwasm-timer(see PR 2245).Enable advanced dialing requests both on
Swarm::dialand 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 thatDialOptsimplementsFrom<PeerId>.Previously
swarm.dial_addr(addr)nowswarm.dial(DialOpts::unknown_peer_id().address(addr).build())orswarm.dial(addr)given thatDialOptsimplementsFrom<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.
0.31.0 [2021-11-01]
Make default features of
libp2p-coreoptional. PR 2181Update dependencies.
Provide default implementations for all functions of
NetworkBehaviour, except fornew_handler,inject_eventandpoll. This should make it easier to create new implementations. See PR 2150.Remove
Swarmtype alias and renameExpandedSwarmtoSwarm. 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
ProtocolsHandleroneither::Eitherrepresenting either of twoProtocolsHandlerimplementations (see PR 2192).Require implementation to provide handler in
NetworkBehaviourAction::DialPeerandNetworkBehaviourAction::DialAddress. Note that the handler is returned to theNetworkBehaviouron connection failure and connection closing. Thus it can be used to carry state, which otherwise would have to be tracked in theNetworkBehaviouritself. 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 theNetworkBehaviouron 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_failureand callNetworkBehaviour::inject_dial_failureonDialPeerConditionevaluating to false. To emulate the previous behaviour, return early withininject_dial_failureonDialError::DialPeerConditionFalse. See PR 2191.Make
NetworkBehaviourActiongeneric overNetworkBehaviour::OutEventandNetworkBehaviour::ProtocolsHandler. In most cases, change your generic type parameters toNetworkBehaviourAction<Self::OutEvent, Self::ProtocolsHandler>. See PR 2191.Return
boolinstead 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::UnreachableAddrandSwarmEvent::UnknownPeerUnreachableAddrevent.In
NetworkBehaviour::inject_connection_establishedprovide errors of all thus far failed addresses.On unknown peer dial failures, call
NetworkBehaviour::inject_dial_failurewith a peer ID ofNone.Remove
NetworkBehaviour::inject_addr_reach_failure. Information is now provided viaNetworkBehaviour::inject_connection_establishedandNetworkBehaviour::inject_dial_failure.
0.30.0 [2021-07-12]
Update dependencies.
Drive
ExpandedSwarmviaStreamtrait only.Change
Streamimplementation ofExpandedSwarmto return allSwarmEventsinstead of only theNetworkBehaviour's events.Remove
ExpandedSwarm::next_event. Users can use<ExpandedSwarm as StreamExt>::nextinstead.Remove
ExpandedSwarm::next. Users can use<ExpandedSwarm as StreamExt>::filter_mapinstead.
See PR 2100 for details.
Add
ExpandedSwarm::disconnect_peer_idandNetworkBehaviourAction::CloseConnectionto close connections to a specific peer via anExpandedSwarmorNetworkBehaviour. See PR 2110 for details.Expose the
ListenerIdinSwarmEvents that are associated with a listener.See PR 2123 for details.
0.29.0 [2021-04-13]
Remove
DerefandDerefMutimplementations previously dereferencing to theNetworkBehaviouronSwarm. Instead one can access theNetworkBehaviourviaSwarm::behaviourandSwarm::behaviour_mut. Methods onSwarmcan now be accessed directly, e.g. viamy_swarm.local_peer_id(). You may use the command below to transform fully qualified method calls onSwarmto 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
NetworkBehaviourcallbacks, more concretely introducing newfn inject_new_listenerandfn inject_expired_external_addrand havefn inject_{new,expired}_listen_addrprovide aListenerIdPR 2011.
0.28.0 [2021-03-17]
New error variant
DialError::InvalidAddressSwarm::dial_addr()now returns aDialErroron 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-kadand others. There is aSwarm-scoped configuration for this version available since 1858.
0.27.2 [2021-02-04]
- Have
ToggleProtoHandlerignore listen upgrade errors when disabled. PR 1945.
0.27.1 [2021-01-27]
Make
OneShotHandlersmax_dial_negotiatelimit configurable. PR 1936.Fix handling of DialPeerCondition::Always. PR 1937.
0.27.0 [2021-01-12]
- Update dependencies.
0.26.0 [2020-12-17]
Update
libp2p-core.Remove
NotifyHandler::Allthus removing the requirement for events send from aNetworkBehaviourto aProtocolsHandlerto beClone. PR 1880.
0.25.1 [2020-11-26]
- Add
ExpandedSwarm::is_connected. PR 1862.
0.25.0 [2020-11-25]
Permit a configuration override for the substream upgrade protocol to use for all (outbound) substreams. PR 1858.
Changed parameters for connection limits from
usizetou32. 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.
0.24.0 [2020-11-09]
- Update dependencies.
0.23.0 [2020-10-16]
Require a
Boxedtransport to be given to theSwarmorSwarmBuilderto avoid unnecessary double-boxing of transports and simplify API bounds. PR 1794Respect 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
FuturesUnorderedfor both pending inbound and pending outbound upgrades. As a result only those upgrades are polled that are ready to progress.Implementors of
InboundUpgradeandOutboundUpgradeneed to ensure to wake up the underlying task once they are ready to make progress as they won't be polled otherwise.
0.22.0 [2020-09-09]
Bump
libp2p-coredependency.Adds
ProtocolsHandler::InboundOpenInfotype which mirrors the existingOutboundOpenInfotype. A value of this type is passed as an extra argument toProtocolsHandler::inject_fully_negotiated_inboundandProtocolsHandler::inject_listen_upgrade_error.SubstreamProtocolnow has a second type parameter corresponding to inbound or outbound information, a value of which is part ofSubstreamProtocolnow. ConsequentlyProtocolsHandlerEvent::OutboundSubstreamRequestno longer has a separateinfofield.
0.21.0 [2020-08-18]
Add missing delegation calls in some
ProtocolsHandlerwrappers. See PR 1710.Add as_ref and as_mut functions to Toggle PR 1684.
The
causeofSwarmEvent::ConnectionClosedis now anOption, andNoneindicates an active connection close not caused by an error.DialError::Bannedhas been added and is returned fromSwarm::dialif the peer is banned, thereby also invoking theNetworkBehaviour::inject_dial_failurecallback.Update the
libp2p-coredependency to0.21, fixing 1584.Fix connections being kept alive by
OneShotHandlerwhen not handling any requests PR 1698.
0.20.1 [2020-07-08]
Documentation updates.
Ignore addresses returned by
NetworkBehaviour::addresses_of_peerthat theSwarmconsiders 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.
0.20.0 [2020-07-01]
Updated the
libp2p-coredependency.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_changeandNetworkBehaviour::inject_address_changeto notify of a change in the address of an existing connection.
0.19.1 [2020-06-18]
- Bugfix: Fix MultiHandler panicking when empty (PR 1598).