-
Notifications
You must be signed in to change notification settings - Fork 145
how to create my own bootstrap peer like DefaultBootstrapPeers in github.com/libp2p/go-libp2p-kad-dht/dht_bootstrap.go:16 #72
Comments
Thanks upperwal@upperwal I have three nodes in Japan, Hong Kong and South Korea.
bootstrap nodeA node in Japan as bootstrap server, the code running on this node like this (from your suggestion code) libp2p_with_dht.go
The result of running the code above in the terminal:
chat_HK nodethe code from https://github.com/libp2p/go-libp2p-examples/tree/master/chat-with-rendezvous chat.go
Execute commands at the terminal
chat_SK nodechat.go is the same as the HK node
|
The above shows that Solutions:
|
Thanks again @upperwal I don't have access to the firewall, so I modified the code above,when I created the host, I added the
But the node chat_HK and the node chat_SK still can't connect Can you help me give me a relay example? Thank you. Thanks again |
@maimai88 Relay dials are enabled by default but you need to connect it to a node which acts as a relay. You can do that by spawning a new node (on a publicly accessible ip:port) and passing Now connect all your nodes (A -> R, B -> R) to this relay node. Now you can dial A -> B and it would use the relay node if it could not dial directly. |
Thanks sir @upperwal Node RNode_JP is a server in Japan that has a separate public IP.I use it as a relay node. deploy code:
Node Adeploy code:
Node B
RunRun 3 nodes separately Run Node R> go run R.go -l 3000
// get result
/ip4/163.44.166.18/tcp/3000/p2p/QmRFNL6GS9wKsyx678gqEmYcxPX2Nqp355YCwzxiGdrKLE Run Node A
Run Node B
get result
PS:If node A and node B are in the same network segment, there is no problem sending data from B to A. Terminal direct output
|
thanks @upperwal I find a relay peer example in go-libp2p-relay . thanks again |
Hi, For benefit of anyone trying to do this with later versions of libp2p, I wasn't able to get the bootstrap host working with version 0.13.0 (github.com/libp2p/go-libp2p v0.13.0) until I added the option ....
....
opts := []libp2p.Option{
libp2p.ListenAddrs(sourceMultiAddr),
libp2p.ForceReachabilityPublic(), // <--- ADD THIS OPTION
//libp2p.NATPortMap(),
//libp2p.DefaultSecurity,
//libp2p.EnableRelay(circuit.OptActive, circuit.OptHop, circuit.OptDiscovery),
libp2p.Identity(prvKey),
}
....
.... Would be amazing if you guys could elaborate on how this option should be used or how to configure a bootstrap to be used privately. Thanks a lot :) |
**how to create my own bootstrap peer like DefaultBootstrapPeers in github.com/libp2p/go-libp2p-kad-dht/dht_bootstrap.go:16 **
In the chat-with-rendezvous example, I tried to use a chat-with-rendezvous instance as a bootstrap. For nodes in other networks, the peer parameter points to it.
Peers in the same network can be interconnected, and different networks can't communicate. If all nodes use the default dht.DefaultBootstrapPeers, different networks can communicate.
@raulk
The text was updated successfully, but these errors were encountered: