]> Sergey Matveev's repositories - btrtrc.git/blobdiff - metainfo/metainfo.go
Fix error unmarshalling bad metainfo nodes field
[btrtrc.git] / metainfo / metainfo.go
index 7ffa6d5b8f9b6e7637dcd7a4115d562f2c0a318e..fbf48671d484a0e3342f855585a98a91975c42f2 100644 (file)
@@ -10,10 +10,10 @@ import (
 )
 
 type MetaInfo struct {
-       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
+       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,ignore_unmarshal_type_error"` // BEP 5
        // Where's this specified? Mentioned at
        // https://wiki.theory.org/index.php/BitTorrentSpecification: (optional) the creation time of
        // the torrent, in standard UNIX epoch format (integer, seconds since 1-Jan-1970 00:00:00 UTC)
@@ -62,10 +62,8 @@ func (mi MetaInfo) Write(w io.Writer) error {
 
 // Set good default values in preparation for creating a new MetaInfo file.
 func (mi *MetaInfo) SetDefaults() {
-       mi.Comment = ""
        mi.CreatedBy = "github.com/anacrolix/torrent"
        mi.CreationDate = time.Now().Unix()
-       // mi.Info.PieceLength = 256 * 1024
 }
 
 // Creates a Magnet from a MetaInfo. Optional infohash and parsed info can be provided.