Closed NIC619 closed 5 years ago
cc @mhchia
It turns out that it's the problem with how we generate the multi-address for the peer in GetFullAddr
.
After Circuit Relay is enabled, an additional Circuit Relay listener is set up. As a consequence the multi-address returned here is of Circuit Relay type which means the node will have to connect to the peer via circuit relay.
Possible fix:
When adding the peer info to the address book,
(1) use /ip4/…/tcp/…
type multi-address instead
or
(2) add both type(/ip4/…/tcp/…
and Circuit Relay type) of multi-address
We have an address factory that will advertise a relay address only: https://github.com/prysmaticlabs/prysm/blob/master/shared/p2p/addr_factory.go
Does that help?
Thanks @prestonvanloon , that definitely helps! Just out of curiosity, what would be the scenarios you have in mind that requires advertising only relay type multi-addresses?
Our specific scenario is a kubernetes deployment. A peer node can only be reached from the outside world via relay node so this peer only broadcasts the relay multiaddr.
Another scenario might be that you only want to open one port on your firewall, but run 2+ nodes.
What is wrong?
As mentioned in #109 , we ran into peer dialing failure due to libp2p's new default circuit relay.
How can it be fixed?
Look into how circuit relay works and what changes need to made to enable circuit relay.