cmd/torrent: add -ipv4/-ipv6 options

This commit is contained in:
Yaroslav Kolomiiets 2020-04-16 13:17:10 +01:00 committed by Matt Joiner
parent 48bea90f0a
commit dad28e674e
1 changed files with 6 additions and 0 deletions

View File

@ -141,6 +141,8 @@ var flags = struct {
Dht bool
TcpPeers bool
UtpPeers bool
Ipv4 bool
Ipv6 bool
tagflag.StartPos
Torrent []string `arity:"+" help:"torrent file path or magnet uri"`
}{
@ -150,6 +152,8 @@ var flags = struct {
Dht: true,
TcpPeers: true,
UtpPeers: true,
Ipv4: true,
Ipv6: true,
}
func stdoutAndStderrAreSameFile() bool {
@ -204,6 +208,8 @@ func downloadErr(args []string, parent *tagflag.Parser) error {
clientConfig := torrent.NewDefaultClientConfig()
clientConfig.DisableTCP = !flags.TcpPeers
clientConfig.DisableUTP = !flags.UtpPeers
clientConfig.DisableIPv4 = !flags.Ipv4
clientConfig.DisableIPv6 = !flags.Ipv6
clientConfig.DisableAcceptRateLimiting = true
clientConfig.NoDHT = !flags.Dht
clientConfig.Debug = flags.Debug