Type Definition libp2p_tcp::tokio::Transport
source · pub type Transport = Transport<Tcp>;
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("/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}");