cmd/torrent/main.go | 4 ++++ diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index e102cf83bdc9ca91d87d738c40ebd45dcc121fae..55c68c9f92cb977f90a78e2c48249b1abfcad3b3 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -112,6 +112,7 @@ var opts struct { Mmap bool `help:"memory-map torrent data"` TestPeer []*net.TCPAddr `short:"p" help:"addresses of some starting peers"` Seed bool `help:"seed after download is complete"` + Addr *net.TCPAddr `help:"network listen addr"` tagflag.StartPos Torrent []string `type:"pos" arity:"+" help:"torrent file path or magnet uri"` } @@ -122,6 +123,9 @@ tagflag.Parse(&opts) var clientConfig torrent.Config if opts.Mmap { clientConfig.DefaultStorage = storage.NewMMap("") + } + if opts.Addr != nil { + clientConfig.ListenAddr = opts.Addr.String() } client, err := torrent.NewClient(&clientConfig)