QSP-25 Only Enable Relay if Flag Provided (#6386)

* only add relay if flag is on
* Merge branch 'master' into qsp-25
* Merge refs/heads/master into qsp-25
* Merge refs/heads/master into qsp-25
This commit is contained in:
Raul Jordan 2020-06-24 14:30:40 -05:00 committed by GitHub
parent a9c1d25a35
commit ac77a5c054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,6 @@ func (s *Service) buildOptions(ip net.IP, priKey *ecdsa.PrivateKey) []libp2p.Opt
}
options := []libp2p.Option{
privKeyOption(priKey),
libp2p.EnableRelay(),
libp2p.ListenAddrs(listen),
libp2p.UserAgent(version.GetBuildData()),
libp2p.ConnectionGater(s),
@ -46,6 +45,7 @@ func (s *Service) buildOptions(ip net.IP, priKey *ecdsa.PrivateKey) []libp2p.Opt
}
if cfg.RelayNodeAddr != "" {
options = append(options, libp2p.AddrsFactory(withRelayAddrs(cfg.RelayNodeAddr)))
options = append(options, libp2p.EnableRelay())
}
if cfg.HostAddress != "" {
options = append(options, libp2p.AddrsFactory(func(addrs []ma.Multiaddr) []ma.Multiaddr {