client.go | 4 +++- config.go | 2 ++ diff --git a/client.go b/client.go index 9e0c92743cb77b72d1b787725233057c11ba8465..59d6e61cc90cd8286a2d6a8f4b5d79185fb388a8 100644 --- a/client.go +++ b/client.go @@ -409,7 +409,9 @@ } } } - go cl.forwardPort() + if !cfg.NoDefaultPortForwarding { + go cl.forwardPort() + } if !cfg.NoDHT { for _, s := range sockets { if pc, ok := s.(net.PacketConn); ok { diff --git a/config.go b/config.go index bf84daae230a3b16c749bca067bda9894d618073..66ed9aa8c29200d1e075dda5ba2db3239029993c 100644 --- a/config.go +++ b/config.go @@ -42,6 +42,7 @@ } type ClientDhtConfig struct { // Don't create a DHT. + // cfg.NoDHT aka cfg.DisableDHT NoDHT bool `long:"disable-dht"` DhtStartingNodes func(network string) dht.StartingNodesGetter // Called for each anacrolix/dht Server created for the Client. @@ -64,6 +65,7 @@ // The address to listen for new uTP and TCP BitTorrent protocol connections. DHT shares a UDP // socket with uTP unless configured otherwise. ListenHost func(network string) string ListenPort int + // cfg.NoDefaultPortForwarding aka cfg.DisableUpnp NoDefaultPortForwarding bool UpnpID string DisablePEX bool `long:"disable-pex"`