From 0dda4011052bcb05d250ed64f72c45899cb8df3d Mon Sep 17 00:00:00 2001 From: Brannon King Date: Fri, 30 Jul 2021 14:11:10 -0400 Subject: [PATCH] [lbry] switched upnp param to its opposite --- config.go | 2 +- server.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 0216fe18..4e064e51 100644 --- a/config.go +++ b/config.go @@ -170,7 +170,7 @@ type config struct { TrickleInterval time.Duration `long:"trickleinterval" description:"Minimum time between attempts to send new inventory to a connected peer"` TxIndex bool `long:"txindex" description:"Maintain a full hash-based transaction index which makes all transactions available via the getrawtransaction RPC"` UserAgentComments []string `long:"uacomment" description:"Comment to add to the user agent -- See BIP 14 for more information."` - Upnp bool `long:"upnp" description:"Use UPnP to map our listening port outside of NAT"` + NoUpnp bool `long:"noupnp" description:"Don't use UPnP to map our listening port outside of NAT"` ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` Whitelists []string `long:"whitelist" description:"Add an IP network or IP that will not be banned. (eg. 192.168.1.0/24 or ::1)"` lookup func(string) ([]net.IP, error) diff --git a/server.go b/server.go index 5a55a2d4..a09776e5 100644 --- a/server.go +++ b/server.go @@ -3053,11 +3053,16 @@ func initListeners(amgr *addrmgr.AddrManager, listenAddrs []string, services wir } } } else { - if cfg.Upnp { + if !cfg.NoUpnp && !cfg.RegressionTest && !cfg.SimNet { var err error nat, err = Discover() if err != nil { - srvrLog.Warnf("Can't discover upnp: %v", err) + srvrLog.Infof("Can't discover UPnP-enabled device: %v", err) + } else { + address, err := nat.GetExternalAddress() + if err == nil && address != nil { + srvrLog.Infof("UPnP successfully registered on %s", address.String()) + } } // nil nat here is fine, just means no upnp on network. }