]> Sergey Matveev's repositories - btrtrc.git/commitdiff
add BEP references to documentation of the metadata fields
authorYaroslav Kolomiiets <yarikos@gmail.com>
Thu, 30 Apr 2020 19:23:20 +0000 (20:23 +0100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 3 May 2020 04:06:24 +0000 (14:06 +1000)
metainfo/fileinfo.go
metainfo/info.go
metainfo/metainfo.go

index 58073a1bbf715a07877fbc8bd0cf517cde7319fa..5aea9727f5f9d0c2c8fc2193df37302909c0da00 100644 (file)
@@ -4,8 +4,8 @@ import "strings"
 
 // Information specific to a single file inside the MetaInfo structure.
 type FileInfo struct {
-       Length   int64    `bencode:"length"`
-       Path     []string `bencode:"path"`
+       Length   int64    `bencode:"length"` // BEP3
+       Path     []string `bencode:"path"`   // BEP3
        PathUTF8 []string `bencode:"path.utf-8,omitempty"`
 }
 
index 5322313077f045de75c170d65e99d20a0bb1d236..3190dfb018c971d431e4aece486ae83ea71b107a 100644 (file)
@@ -14,14 +14,14 @@ import (
 
 // The info dictionary.
 type Info struct {
-       PieceLength int64  `bencode:"piece length"`
-       Pieces      []byte `bencode:"pieces"`
-       Name        string `bencode:"name"`
-       Length      int64  `bencode:"length,omitempty"`
-       Private     *bool  `bencode:"private,omitempty"`
+       PieceLength int64  `bencode:"piece length"`      // BEP3
+       Pieces      []byte `bencode:"pieces"`            // BEP3
+       Name        string `bencode:"name"`              // BEP3
+       Length      int64  `bencode:"length,omitempty"`  // BEP3, mutually exclusive with Files
+       Private     *bool  `bencode:"private,omitempty"` // BEP27
        // TODO: Document this field.
        Source string     `bencode:"source,omitempty"`
-       Files  []FileInfo `bencode:"files,omitempty"`
+       Files  []FileInfo `bencode:"files,omitempty"` // BEP3, mutually exclusive with Length
 }
 
 // This is a helper that sets Files and Pieces from a root path and its
index 9f628fe0bda1dd50a6f8920789f0e87358d0b6af..5e84b012259464e8aeb3f989830fa662e6c503c6 100644 (file)
@@ -9,15 +9,15 @@ import (
 )
 
 type MetaInfo struct {
-       InfoBytes    bencode.Bytes `bencode:"info,omitempty"`
-       Announce     string        `bencode:"announce,omitempty"`
-       AnnounceList AnnounceList  `bencode:"announce-list,omitempty"`
-       Nodes        []Node        `bencode:"nodes,omitempty"`
+       InfoBytes    bencode.Bytes `bencode:"info,omitempty"`          // BEP 3
+       Announce     string        `bencode:"announce,omitempty"`      // BEP 3
+       AnnounceList AnnounceList  `bencode:"announce-list,omitempty"` // BEP 12
+       Nodes        []Node        `bencode:"nodes,omitempty"`         // BEP 5
        CreationDate int64         `bencode:"creation date,omitempty,ignore_unmarshal_type_error"`
        Comment      string        `bencode:"comment,omitempty"`
        CreatedBy    string        `bencode:"created by,omitempty"`
        Encoding     string        `bencode:"encoding,omitempty"`
-       UrlList      UrlList       `bencode:"url-list,omitempty"`
+       UrlList      UrlList       `bencode:"url-list,omitempty"` // BEP 19
 }
 
 // Load a MetaInfo from an io.Reader. Returns a non-nil error in case of