diff --git a/config.go b/config.go index 748a626d..7b6b69f1 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 84cb0be2..d0a7ad1c 100644 --- a/server.go +++ b/server.go @@ -3035,11 +3035,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. }