diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 3c7414f5..6b14691d 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -145,9 +145,10 @@ var flags = struct { Quiet bool `help:"discard client logging"` Dht bool - TcpPeers bool - UtpPeers bool - Webtorrent bool + TcpPeers bool + UtpPeers bool + Webtorrent bool + DisableWebseeds bool Ipv4 bool Ipv6 bool @@ -221,6 +222,7 @@ func downloadErr(args []string, parent *tagflag.Parser) error { tagflag.ParseArgs(&flags, args, tagflag.Parent(parent)) defer envpprof.Stop() clientConfig := torrent.NewDefaultClientConfig() + clientConfig.DisableWebseeds = flags.DisableWebseeds clientConfig.DisableTCP = !flags.TcpPeers clientConfig.DisableUTP = !flags.UtpPeers clientConfig.DisableIPv4 = !flags.Ipv4 diff --git a/config.go b/config.go index e419b412..ae9b4ea0 100644 --- a/config.go +++ b/config.go @@ -132,6 +132,7 @@ type ClientConfig struct { Extensions PeerExtensionBits DisableWebtorrent bool + DisableWebseeds bool } func (cfg *ClientConfig) SetListenAddr(addr string) *ClientConfig { diff --git a/torrent.go b/torrent.go index c785575c..21859af3 100644 --- a/torrent.go +++ b/torrent.go @@ -2006,6 +2006,9 @@ func (t *Torrent) iterPeers(f func(*peer)) { } func (t *Torrent) addWebSeed(url string) { + if t.cl.config.DisableWebseeds { + return + } if _, ok := t.webSeeds[url]; ok { return }