Implementation of the libp2p circuit relay specification.
Example
# use MemoryTransport;
# use ;
# use Swarm;
# use ;
# use YamuxConfig;
# use PlainText2Config;
# use TryInto;
# use FromStr;
#
# let local_key = generate_ed25519;
# let local_public_key = local_key.public;
# let local_peer_id = local_public_key.clone.into_peer_id;
# let plaintext = PlainText2Config ;
#
let = new_transport_and_behaviour;
let transport = relay_transport
.upgrade
.authenticate
.multiplex
.boxed;
let mut swarm = new;
let relay_addr = from_str.unwrap
.with
.with;
let dst_addr = relay_addr.clone.with;
// Listen for incoming connections via relay node (1234).
listen_on.unwrap;
// Dial node (5678) via relay node (1234).
dial_addr.unwrap;
Terminology
Entities
-
Source: The node initiating a connection via a relay to a destination.
-
Relay: The node being asked by a source to relay to a destination.
-
Destination: The node contacted by the source via the relay.
Messages
-
Outgoing relay request: The request sent by a source to a relay.
-
Incoming relay request: The request received by a relay from a source.
-
Outgoing destination request: The request sent by a relay to a destination.
-
Incoming destination request: The request received by a destination from a relay.