Circuit-Relay Question


I am working on an application to learn more about libp2p. Its a very dumbed down file sharing application that allows users to find a file or folder by its hash. It works if both peers are behind the same network or one of them is not behind a NAT. The issue for occurs if both are behind different NAT’s and from some research and documentation I found that I need to enable the circuit relay.

My question is how can 2 peers create a stream to each other if they have to rely on the relay peer? I read about the relay.OptActive and relay.OptHop option yet don’t know how to go beyond that.

Here is a basic repo that’s similar to the chat-with-rendezvous example.
Start the relay node in a network that is accessible by anyone. Then start the peer behind 2 different networks. They do find each other with the RoutingDiscovery, but I can’t establish a stream between them.

Example Repo: