From: Matt Joiner Date: Fri, 3 Jan 2020 03:51:18 +0000 (+1100) Subject: cmd/torrent: Make the addr flag a string X-Git-Tag: v1.11.0~1 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=bfbed8ab6de21b9a36f33932411bca8aee84f8f9;p=btrtrc.git cmd/torrent: Make the addr flag a string This avoids tagflag trying to resolve it, and then passing a bad IP for different listen networks. There's also a patch to tagflag so it doesn't do this anymore. --- diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 03582ab6..7cf6a255 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -131,7 +131,7 @@ var flags = struct { Mmap bool `help:"memory-map torrent data"` TestPeer []*net.TCPAddr `help:"addresses of some starting peers"` Seed bool `help:"seed after download is complete"` - Addr *net.TCPAddr `help:"network listen addr"` + Addr string `help:"network listen addr"` UploadRate tagflag.Bytes `help:"max piece bytes to send per second"` DownloadRate tagflag.Bytes `help:"max bytes per second down from peers"` Debug bool @@ -199,8 +199,8 @@ func mainErr() error { if flags.Mmap { clientConfig.DefaultStorage = storage.NewMMap("") } - if flags.Addr != nil { - clientConfig.SetListenAddr(flags.Addr.String()) + if flags.Addr != "" { + clientConfig.SetListenAddr(flags.Addr) } if flags.UploadRate != -1 { clientConfig.UploadRateLimiter = rate.NewLimiter(rate.Limit(flags.UploadRate), 256<<10)