aboutsummaryrefslogtreecommitdiff
path: root/torrent
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-06-11 00:15:35 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-06-11 00:15:35 +0200
commit67eaf4f695013694ab1824f16f4e93eac2275dcc (patch)
tree05d19679e253d05bb1bf3ee54378de3a70a2c466 /torrent
parentc849746bfbac9d1aa3120d0743c99f5c65fd82d0 (diff)
Add multi-file torrent example, torrent struct stub
Diffstat (limited to 'torrent')
-rw-r--r--torrent/torrent.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/torrent/torrent.go b/torrent/torrent.go
new file mode 100644
index 0000000..f0c4b67
--- /dev/null
+++ b/torrent/torrent.go
@@ -0,0 +1,27 @@
+import "time"
+
+type File struct {
+ Length int `bencode:"length"`
+ MD5Sum []byte `bencode:md5sum,omitempty"`
+ Path string `bencode:"path"`
+}
+
+type Info struct {
+ Length int `bencode:"length"`
+ MD5Sum []byte `bencode:md5sum,omitempty"`
+ Name string `bencode:"name"`
+ PieceLength int `bencode:"piece length"`
+ Pieces []byte `bencode:"pieces"`
+ Files []File `bencode:"files"`
+}
+
+type Torrent struct {
+ Announce string `bencode:"announce"`
+ AnnounceList []string `bencode:"announce-list,omitemtpy"`
+ Comment string `bencode:"comment"`
+ CreatedBy string `bencode:"created by,omitempty"`
+ CreationDate time.Time `bencode:"creation date"`
+ HTTPSeeds []string `bencode:"httpseeds"` // not in draft
+ Info Info `bencode:"info"`
+ URLList string `bencode:"url-list,omitemtpy"` // not in draft
+}