I need to set up a swarm to connect to peers with known peer IDs but that may be behind firewalls. Right now it seems like the “easiest way” to do this is
- Create a gossipsub topic for publishing publicly accessible multiaddr
- Use autonat to discover own multiaddr
- Publish multiaddr on the gossipsub topic
- Receive message from topic and then add peerid/multiaddr to list of kademlia peers
- Dial peers with known publicly accessible multiaddr
This isn’t too complex, but it does feel kind of hacky and makes me think I’m misunderstanding something fundamental. Is there a better method for establishing a connection to a peer with known peerid or does this sound about right?