doc.go | 15 +-------------- example_test.go | 17 +++++++++++++++++ diff --git a/doc.go b/doc.go index f8670a967d500d3e918a138fa1017dde5286a14e..d6b42e789bdea7f913dd8396abaf8d1835e0f099 100644 --- a/doc.go +++ b/doc.go @@ -1,16 +1,3 @@ -/* -Package torrent implements a torrent client. - -Simple example: +// Package torrent implements a torrent client. - c, _ := torrent.NewClient(&torrent.Config{}) - defer c.Close() - t, _ := c.AddMagnet("magnet:?xt=urn:btih:ZOCMZQIPFFW7OLLMIC5HUB6BPCSDEOQU") - <-t.GotInfo - t.DownloadAll() - c.WaitAll() - log.Print("ermahgerd, torrent downloaded") - - -*/ package torrent diff --git a/example_test.go b/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..02655e9596aa7e3ee8da2f3285fd7ea4182205dd --- /dev/null +++ b/example_test.go @@ -0,0 +1,17 @@ +package torrent_test + +import ( + "log" + + "github.com/anacrolix/torrent" +) + +func Example() { + c, _ := torrent.NewClient(&torrent.Config{}) + defer c.Close() + t, _ := c.AddMagnet("magnet:?xt=urn:btih:ZOCMZQIPFFW7OLLMIC5HUB6BPCSDEOQU") + <-t.GotInfo() + t.DownloadAll() + c.WaitAll() + log.Print("ermahgerd, torrent downloaded") +}