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