n0-computer / iroh

A toolkit for building distributed applications
https://iroh.computer
Apache License 2.0
2.27k stars 145 forks source link

iroh-net: implement portmapping #910

Closed ramfox closed 1 year ago

ramfox commented 1 year ago

Ref: https://github.com/tailscale/tailscale/blob/main/net/portmapper/portmapper.go

b5 commented 1 year ago

Are we going to land PMP and/or PCP before the v0.5.0 release?

divagant-martian commented 1 year ago

probably one but not both

divagant-martian commented 1 year ago

progress update: Both probes are working but the code needs love. Also, implementing mapping after this looks pretty simple now that most of the work is done and the road is paved

2023-07-12T23:25:47.601149Z DEBUG iroh_net::hp::portmapper: portmap starting
2023-07-12T23:25:47.604372Z TRACE iroh_net::hp::portmapper: tick: msg Some(Probe { result_tx: _ })
2023-07-12T23:25:47.604475Z DEBUG iroh_net::hp::portmapper: Starting portmapping probe
2023-07-12T23:25:47.604513Z DEBUG iroh_net::hp::portmapper::pmp: Starting pmp probe
2023-07-12T23:25:47.604579Z DEBUG iroh_net::hp::portmapper::pcp: Starting pcp probe
2023-07-12T23:25:47.636458Z DEBUG iroh_net::hp::portmapper::pmp: received pmp response Ok(PublicAddress { epoch_time: 1028171, public_ip: <sensored> })
2023-07-12T23:25:47.636590Z TRACE iroh_net::hp::portmapper: tick: pmp probe ready
2023-07-12T23:25:47.675048Z DEBUG iroh_net::hp::portmapper::pcp: received pcp response Response { version: Pcp, opcode: Announce, result_code: Success, lifetime_seconds: 0, epoch_time: 
1028171 }
2023-07-12T23:25:47.675156Z TRACE iroh_net::hp::portmapper: tick: pcp probe ready
2023-07-12T23:25:48.672150Z TRACE iroh_net::hp::portmapper: tick: upnp probe ready
2023-07-12T23:25:48.672275Z TRACE iroh_net::hp::portmapper: tick: probe ready
2023-07-12T23:25:48.672349Z DEBUG iroh_net::hp::portmapper: upnp gateway changed "None" -> "http://192.168.20.1:58089/ctl/IPConn"
2023-07-12T23:25:48.672379Z DEBUG iroh_net::hp::portmapper: probe output portmap={ UPnP: true, PMP: true, PCP: true }
divagant-martian commented 1 year ago

will need to be moved to 0.5.1 indeed