From: Yaroslav Kolomiiets Date: Thu, 16 Apr 2020 12:17:10 +0000 (+0100) Subject: cmd/torrent: add -ipv4/-ipv6 options X-Git-Tag: v1.16.0~67 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=dad28e674e2b11e4091618876a4575b6c87013bd;p=btrtrc.git cmd/torrent: add -ipv4/-ipv6 options --- diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 4ec5a849..a346cdfb 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -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