Support disabling webtorrent
This commit is contained in:
parent
cf6d161256
commit
67c9021e97
|
@ -144,23 +144,31 @@ var flags = struct {
|
|||
PieceStates bool
|
||||
Quiet bool `help:"discard client logging"`
|
||||
Dht bool
|
||||
TcpPeers bool
|
||||
UtpPeers bool
|
||||
Ipv4 bool
|
||||
Ipv6 bool
|
||||
Pex bool
|
||||
|
||||
TcpPeers bool
|
||||
UtpPeers bool
|
||||
Webtorrent bool
|
||||
|
||||
Ipv4 bool
|
||||
Ipv6 bool
|
||||
Pex bool
|
||||
|
||||
tagflag.StartPos
|
||||
|
||||
Torrent []string `arity:"+" help:"torrent file path or magnet uri"`
|
||||
}{
|
||||
UploadRate: -1,
|
||||
DownloadRate: -1,
|
||||
Progress: true,
|
||||
Dht: true,
|
||||
TcpPeers: true,
|
||||
UtpPeers: true,
|
||||
Ipv4: true,
|
||||
Ipv6: true,
|
||||
Pex: true,
|
||||
|
||||
TcpPeers: true,
|
||||
UtpPeers: true,
|
||||
Webtorrent: true,
|
||||
|
||||
Ipv4: true,
|
||||
Ipv6: true,
|
||||
Pex: true,
|
||||
}
|
||||
|
||||
func stdoutAndStderrAreSameFile() bool {
|
||||
|
@ -224,6 +232,7 @@ func downloadErr(args []string, parent *tagflag.Parser) error {
|
|||
clientConfig.PublicIp4 = flags.PublicIP
|
||||
clientConfig.PublicIp6 = flags.PublicIP
|
||||
clientConfig.DisablePEX = !flags.Pex
|
||||
clientConfig.DisableWebtorrent = !flags.Webtorrent
|
||||
if flags.PackedBlocklist != "" {
|
||||
blocklist, err := iplist.MMapPackedFile(flags.PackedBlocklist)
|
||||
if err != nil {
|
||||
|
|
|
@ -130,6 +130,8 @@ type ClientConfig struct {
|
|||
DefaultRequestStrategy RequestStrategyMaker
|
||||
|
||||
Extensions PeerExtensionBits
|
||||
|
||||
DisableWebtorrent bool
|
||||
}
|
||||
|
||||
func (cfg *ClientConfig) SetListenAddr(addr string) *ClientConfig {
|
||||
|
|
1
file.go
1
file.go
|
@ -96,7 +96,6 @@ func (f *File) DisplayPath() string {
|
|||
return f.t.info.Name
|
||||
}
|
||||
return strings.Join(fip, "/")
|
||||
|
||||
}
|
||||
|
||||
// The download status of a piece that comprises part of a File.
|
||||
|
|
|
@ -1383,6 +1383,9 @@ func (t *Torrent) startScrapingTracker(_url string) {
|
|||
sl := func() torrentTrackerAnnouncer {
|
||||
switch u.Scheme {
|
||||
case "ws", "wss":
|
||||
if t.cl.config.DisableWebtorrent {
|
||||
return nil
|
||||
}
|
||||
return t.startWebsocketAnnouncer(*u)
|
||||
}
|
||||
if u.Scheme == "udp4" && (t.cl.config.DisableIPv4Peers || t.cl.config.DisableIPv4) {
|
||||
|
|
Loading…
Reference in New Issue