From f3e1c96de95a9f6715f2bc8e61e445e6ea9809cf Mon Sep 17 00:00:00 2001 From: Brannon King Date: Fri, 30 Jul 2021 14:11:10 -0400 Subject: [PATCH] [lbry] config: enable upnp by default --- config.go | 2 ++ server.go | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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. }