Relay circuit-v2 expiration #4279
-
Hi, I am trying to develop a peer to peer application using rust and libp2p. I have nodes behind NAT and therefore need to use a mechanism such as relays to allow them to communicate. I just read the relay circuit-v2 specs. I have questions about this
let relay_addr = Multiaddr::empty()
.with(Protocol::Ip4(Ipv4Addr::new(127,0,0,1)))
.with(Protocol::Tcp(RELAY_PORT))
.with(Protocol::P2p(relay_peer_id()))
.with(Protocol::P2pCircuit);
self.swarm.listen_on(relay_addr)?; The relay_addr looks like /ip4/192.168.1.19/tcp/62500/p2p/12D3KooWMAXwrRcBdK3hFECY7b69PVW5rfHRa2WQPmbmMezZnEVG/p2p-circuit/ To handle the reservation request event, my code looks like this : loop {
event = self.swarm.select_next_some() => match event {
SwarmEvent::Behaviour(ClientBehaviourEvent::Relay(relay::client::Event::ReservationReqAccepted { relay_peer_id, renewal, limit })) => {
// ....
}
}
} Shouldn't the Thank you ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The reservation will be automatically renewed in the background: rust-libp2p/protocols/relay/src/priv_client/handler.rs Lines 661 to 667 in c86b665 |
Beta Was this translation helpful? Give feedback.
The reservation will be automatically renewed in the background:
rust-libp2p/protocols/relay/src/priv_client/handler.rs
Lines 661 to 667 in c86b665