I have some nodes. Each node belongs to other network. Each node has private IP like 192.168.0.2 and stays behind NAT.
Is there any possibility to communicate between Nodes? Actually, I need to transfer files between these independent nodes.
I try to use this project - https://github.com/libp2p/go-libp2p. But libp2p has some limitations:
But I have nodes with private IP address, and they belongs to different network.
Update.
There are such solutions:
The idea is that you have a rendez-vous server, which the nodes 1 and 2 connect to. For that they must know the IP of the rendez-vous server.
It goes as follows: 1) 1 and 2 both send UDP packets to the RS. N1 (NAT box of Node 1) and N2 create an entry in the translation table, which maps the IP of the nodes to the IP/Port of the RS. 2) The RS passes (EIP1,EP1) to Node 2. This is the Tulpe containing the public IP of the NAT box and the public port. The RS sends (EIP2,EP2) to Node 1. 3) Node 1 creates a mapping in the translation table: (IP1,EP1,EIP2,EP2). 4) Node 2 does the same but with (IP2,EP2,EIP1,EP1).
Note: Step 3 and 4 happen, because each Node sends a UDP packet to the just received tuple (IP,Port) and therefore the NAT box adds a new entry. In the worst case, these messages have to be sent more than once.
This trick enables that both nodes get ahold of the public IP’s and have the correct ports.
This provides a good way of establishing peer to peer connections for e.g. Skype.
I hope this helps.
Libp2p has no such limitations.
The chat example which you quoted is programmed in such a way that it cannot support private IP's behind NAT BUT Libp2p support NAT Traversal techniques like Hole Punching, STUN, TURN like protocol and bootstrapping using rendezvous point using DHT for now. This is what you need.
Following examples may be useful to you:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With