cmd/torrent/main.go | 8 +++++--- config.go | 1 + torrent.go | 3 +++ diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 3c7414f5ccc4cdff7df656c80b5a16ebfa565f08..6b14691d55a79f0d10840741161c66cd0b26a871 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -145,9 +145,10 @@ PieceStates bool 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 e419b412242b13b2266df848a4d40ccdc1a16e0c..ae9b4ea09b1ef6a62f558b88a824244f143f7229 100644 --- a/config.go +++ b/config.go @@ -132,6 +132,7 @@ Extensions PeerExtensionBits DisableWebtorrent bool + DisableWebseeds bool } func (cfg *ClientConfig) SetListenAddr(addr string) *ClientConfig { diff --git a/torrent.go b/torrent.go index c785575c47181b7e240b1b3b4a0ef23499353d27..21859af37905a1619647afab2102396c6bc0f99e 100644 --- a/torrent.go +++ b/torrent.go @@ -2006,6 +2006,9 @@ } } func (t *Torrent) addWebSeed(url string) { + if t.cl.config.DisableWebseeds { + return + } if _, ok := t.webSeeds[url]; ok { return }