Add option to disable webseeds
This commit is contained in:
parent
997384a394
commit
72bd4f362e
|
@ -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
|
||||
|
|
|
@ -132,6 +132,7 @@ type ClientConfig struct {
|
|||
Extensions PeerExtensionBits
|
||||
|
||||
DisableWebtorrent bool
|
||||
DisableWebseeds bool
|
||||
}
|
||||
|
||||
func (cfg *ClientConfig) SetListenAddr(addr string) *ClientConfig {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue