]> Sergey Matveev's repositories - btrtrc.git/commitdiff
cmd/torrent: Add download -pex flag
authorMatt Joiner <anacrolix@gmail.com>
Sun, 3 May 2020 08:42:03 +0000 (18:42 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 3 May 2020 08:42:03 +0000 (18:42 +1000)
For testing with https://github.com/anacrolix/torrent/issues/402.

cmd/torrent/main.go

index 02e5899725c7615f5a1fdcdb9c55642f958fabdf..221f6a0129d21275bbdc20c875a695d09465f84f 100644 (file)
@@ -148,6 +148,7 @@ var flags = struct {
        UtpPeers        bool
        Ipv4            bool
        Ipv6            bool
+       Pex             bool
        tagflag.StartPos
        Torrent []string `arity:"+" help:"torrent file path or magnet uri"`
 }{
@@ -159,6 +160,7 @@ var flags = struct {
        UtpPeers:     true,
        Ipv4:         true,
        Ipv6:         true,
+       Pex:          true,
 }
 
 func stdoutAndStderrAreSameFile() bool {
@@ -221,6 +223,7 @@ func downloadErr(args []string, parent *tagflag.Parser) error {
        clientConfig.Seed = flags.Seed
        clientConfig.PublicIp4 = flags.PublicIP
        clientConfig.PublicIp6 = flags.PublicIP
+       clientConfig.DisablePEX = !flags.Pex
        if flags.PackedBlocklist != "" {
                blocklist, err := iplist.MMapPackedFile(flags.PackedBlocklist)
                if err != nil {