From 58e0d344dcb2e462cab0547d0f8a8c6e430a28fe Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 6 Jul 2016 03:31:56 +0200 Subject: Add extenion comments --- meta/torrent.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'meta') diff --git a/meta/torrent.go b/meta/torrent.go index 20496be..b40936d 100644 --- a/meta/torrent.go +++ b/meta/torrent.go @@ -1,5 +1,7 @@ package meta +// see also: https://en.wikipedia.org/wiki/Torrent_file + import ( "crypto/sha1" "errors" @@ -28,7 +30,8 @@ type Info struct { Name string `bencode:"name"` PieceLength int `bencode:"piece length"` Pieces []byte `bencode:"pieces"` - Private bool `bencode:"private"` + Private bool `bencode:"private"` // BEP-0027 + RootHash []byte `bencode:"root hash"` // BEP-0030 } func (i Info) TotalLength() int { @@ -165,17 +168,20 @@ func (i Info) String() string { return s } +type Nodes map[string]int // Host:Port + type Torrent struct { Announce string `bencode:"announce"` - AnnounceList [][]string `bencode:"announce-list,optional"` + AnnounceList [][]string `bencode:"announce-list,optional"` // BEP-0012 Comment string `bencode:"comment,optional"` CreatedBy string `bencode:"created by,optional"` CreationDate time.Time `bencode:"creation date,optional"` Encoding string `bencode:"encoding,optional"` - HTTPSeeds []string `bencode:"httpseeds,optional"` + HTTPSeeds []string `bencode:"httpseeds,optional"` // BEP-0017 Info Info `bencode:"info"` URLList string `bencode:"url-list,optional"` InfoHash []byte `bencode:"-"` + Nodes Nodes `bencode:"nodes"` // BEP-0005 } func (t Torrent) String() string { -- cgit v1.2.3