From ba9300e27ea7dfb6d84f220c51f11232f3ad34a4 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 8 Jan 2019 15:47:01 +1100 Subject: [PATCH] cmd/torrent: Add -publicIp flag --- cmd/torrent/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 2cdf886e..723a5430 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -19,7 +19,7 @@ import ( "github.com/anacrolix/torrent/iplist" "github.com/anacrolix/torrent/metainfo" "github.com/anacrolix/torrent/storage" - "github.com/dustin/go-humanize" + humanize "github.com/dustin/go-humanize" "github.com/gosuri/uiprogress" "golang.org/x/time/rate" ) @@ -131,6 +131,7 @@ var flags = struct { Debug bool PackedBlocklist string Stats *bool + PublicIP net.IP tagflag.StartPos Torrent []string `arity:"+" help:"torrent file path or magnet uri"` }{ @@ -163,10 +164,13 @@ func exitSignalHandlers(client *torrent.Client) { func main() { log.SetFlags(log.LstdFlags | log.Lshortfile) tagflag.Parse(&flags) + log.Print(flags.PublicIP) defer envpprof.Stop() clientConfig := torrent.NewDefaultClientConfig() clientConfig.Debug = flags.Debug clientConfig.Seed = flags.Seed + clientConfig.PublicIp4 = flags.PublicIP + clientConfig.PublicIp6 = flags.PublicIP if flags.PackedBlocklist != "" { blocklist, err := iplist.MMapPackedFile(flags.PackedBlocklist) if err != nil { -- 2.44.0