I have been able to successfully traverse my NAT using by adding the libp2p.NATPortMap()
option to the list of libp2p.Option
(see: https://github.com/Leibniz137/go-libp2p-examples/blob/nat/echo-nat/main.go#L53).
With UPnP enabled on my router, this works great, however it picks a random external port to use. I’d like to be able to specify the external port to use, is this possible?
I notice that the libp2p.NATPortMap()
option does not take any arguments and uses the default NATManager (see: https://godoc.org/github.com/libp2p/go-libp2p#NATPortMap).
I am wondering if I can create my own NATManager that will allow me to specify the external port to use on my router? A code example or some pointers would be great!
Thanks