aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-07-06 03:31:56 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-07-06 03:31:56 +0200
commit58e0d344dcb2e462cab0547d0f8a8c6e430a28fe (patch)
treefe633d8a795d43b68ff01962dd3b9c4c698ef3f8
parente7daf8c15a1b0e3afa06fc8ccc5f1fc9d4c8cbaa (diff)
Add extenion comments
-rw-r--r--dht/magnet.go3
-rw-r--r--meta/torrent.go12
2 files changed, 12 insertions, 3 deletions
diff --git a/dht/magnet.go b/dht/magnet.go
new file mode 100644
index 0000000..411977b
--- /dev/null
+++ b/dht/magnet.go
@@ -0,0 +1,3 @@
+package dht
+
+// see also: https://en.wikipedia.org/wiki/Magnet_URI_scheme
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 {