]> Sergey Matveev's repositories - btrtrc.git/commitdiff
cmd/torrent: Add download -tcpPeers and -utpPeers
authorMatt Joiner <anacrolix@gmail.com>
Sat, 11 Apr 2020 03:03:41 +0000 (13:03 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sat, 11 Apr 2020 03:03:41 +0000 (13:03 +1000)
cmd/torrent/main.go

index 5e423d02f0578d45e256ebd1174847cf5220efa9..f40d6b8e7bdfe0263c7ef32321b1d4082b527414 100644 (file)
@@ -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