From 2e4629abbc8b1c0a827c259141ea44901d1f3237 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 21 May 2014 17:38:09 +1000 Subject: [PATCH] cmd/torrent: Add flags -disableTrackers and -seed --- cmd/torrent/main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 93b02407..59c1d801 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -19,7 +19,9 @@ var ( testPeer = flag.String("testPeer", "", "bootstrap peer address") profAddr = flag.String("profAddr", "", "http serve address") // TODO: Check the default torrent listen port. - listenAddr = flag.String("listenAddr", ":6882", "incoming connection address") + listenAddr = flag.String("listenAddr", ":6882", "incoming connection address") + disableTrackers = flag.Bool("disableTrackers", false, "disable trackers") + seed = flag.Bool("seed", false, "seed after downloading") ) func init() { @@ -40,8 +42,9 @@ func main() { go http.ListenAndServe(*profAddr, nil) } client := torrent.Client{ - DataDir: *downloadDir, - Listener: makeListener(), + DataDir: *downloadDir, + Listener: makeListener(), + DisableTrackers: *disableTrackers, } client.Start() defer client.Stop() @@ -76,6 +79,9 @@ func main() { log.Fatal(err) } } + if *seed { + select {} + } if client.WaitAll() { log.Print("all torrents completed!") } else {