net/portmapper: check disable flags

Signed-off-by: julianknodt <julianknodt@gmail.com>
This commit is contained in:
julianknodt
2021-08-04 16:51:10 -07:00
committed by Brad Fitzpatrick
parent 777b711d96
commit 85304d7392
3 changed files with 33 additions and 14 deletions
+2 -2
View File
@@ -154,7 +154,7 @@ func addAnyPortMapping(
// The provided ctx is not retained in the returned upnpClient, but
// its associated HTTP client is (if set via goupnp.WithHTTPClient).
func getUPnPClient(ctx context.Context, logf logger.Logf, gw netaddr.IP, meta uPnPDiscoResponse) (client upnpClient, err error) {
if controlknobs.DisableUPnP() {
if controlknobs.DisableUPnP() || DisableUPnP {
return nil, nil
}
@@ -236,7 +236,7 @@ func (c *Client) getUPnPPortMapping(
internal netaddr.IPPort,
prevPort uint16,
) (external netaddr.IPPort, ok bool) {
if controlknobs.DisableUPnP() {
if controlknobs.DisableUPnP() || DisableUPnP {
return netaddr.IPPort{}, false
}
now := time.Now()