diff --git a/config.go b/config.go index 748a626d..adee6f78 100644 --- a/config.go +++ b/config.go @@ -66,6 +66,7 @@ const ( sampleConfigFilename = "sample-lbcd.conf" defaultTxIndex = false defaultAddrIndex = false + defaultUpnp = true ) var ( @@ -439,6 +440,7 @@ func loadConfig() (*config, []string, error) { Generate: defaultGenerate, TxIndex: defaultTxIndex, AddrIndex: defaultAddrIndex, + Upnp: defaultUpnp, } // Service options which are only added on Windows. diff --git a/server.go b/server.go index 84cb0be2..8a6ea6c5 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.Upnp && !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. }