From: Matt Joiner <anacrolix@gmail.com>
Date: Sat, 11 Apr 2020 03:03:41 +0000 (+1000)
Subject: cmd/torrent: Add download -tcpPeers and -utpPeers
X-Git-Tag: v1.16.0~85^2~8
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=3e5c6d3d44060c9bac0bd6d9134c5de9032be766;p=btrtrc.git

cmd/torrent: Add download -tcpPeers and -utpPeers
---

diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go
index 5e423d02..f40d6b8e 100644
--- a/cmd/torrent/main.go
+++ b/cmd/torrent/main.go
@@ -139,6 +139,8 @@ var flags = struct {
 	PieceStates     bool
 	Quiet           bool `help:"discard client logging"`
 	Dht             bool
+	TcpPeers        bool
+	UtpPeers        bool
 	tagflag.StartPos
 	Torrent []string `arity:"+" help:"torrent file path or magnet uri"`
 }{
@@ -198,6 +200,8 @@ func downloadErr(args []string, parent *tagflag.Parser) error {
 	tagflag.ParseArgs(&flags, args, tagflag.Parent(parent))
 	defer envpprof.Stop()
 	clientConfig := torrent.NewDefaultClientConfig()
+	clientConfig.DisableTCP = !flags.TcpPeers
+	clientConfig.DisableUTP = !flags.UtpPeers
 	clientConfig.DisableAcceptRateLimiting = true
 	clientConfig.NoDHT = !flags.Dht
 	clientConfig.Debug = flags.Debug