I’m trying to use the chat-with-rendezvous example https://github.com/libp2p/go-libp2p/tree/master/examples/chat-with-rendezvous, however, when I try to connect to a host from another network, I get i/o timeout error.
As advised by others, I used NatPortMap and added ModeServer to DHT option
host, err := libp2p.New(
libp2p.Identity(prvKey),
libp2p.ListenAddrs([]multiaddr.Multiaddr(config.ListenAddresses)...),
libp2p.NATPortMap(),
)
kademliaDHT, err := dht.New(
ctx,
host,
dht.Mode(dht.ModeServer))
peerChan, err := routingDiscovery.FindPeers(
ctx,
config.RendezvousString,
discovery.Limit(100),
)
The logs show that the search for nodes sees the ip the node needs, but the connection fails - timeout error
How can this be fixed?