[lbry] switched upnp param to its opposite

This commit is contained in:
Brannon King 2021-07-30 14:11:10 -04:00 committed by Roy Lee
parent a8205851ab
commit 0dda401105
2 changed files with 8 additions and 3 deletions

View file

@ -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"` 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"` 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."` 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"` 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)"` 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) lookup func(string) ([]net.IP, error)

View file

@ -3053,11 +3053,16 @@ func initListeners(amgr *addrmgr.AddrManager, listenAddrs []string, services wir
} }
} }
} else { } else {
if cfg.Upnp { if !cfg.NoUpnp && !cfg.RegressionTest && !cfg.SimNet {
var err error var err error
nat, err = Discover() nat, err = Discover()
if err != nil { 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. // nil nat here is fine, just means no upnp on network.
} }