libp2p::tcp::tokio

Type Alias Transport

pub type Transport = Transport<Tcp>;
Available on crate features tcp and tokio only.
Expand description

A TCP Transport that works with the tokio ecosystem.

§Example

let mut transport = tcp::tokio::Transport::new(tcp::Config::default());
let id = transport.listen_on(ListenerId::next(), "/ip4/127.0.0.1/tcp/0".parse().unwrap()).unwrap();

let addr = future::poll_fn(|cx| Pin::new(&mut transport).poll(cx)).await.into_new_address().unwrap();

println!("Listening on {addr}");

Aliased Type§

struct Transport { /* private fields */ }