--- /dev/null
+package metainfo
+
+// See BEP 47. This is common to both Info and FileInfo.
+type ExtendedFileAttrs struct {
+ Attr string `bencode:"attr,omitempty"`
+ SymlinkPath []string `bencode:"symlink path,omitempty"`
+ Sha1 string `bencode:"sha1,omitempty"`
+}
// Information specific to a single file inside the MetaInfo structure.
type FileInfo struct {
- Length int64 `bencode:"length"` // BEP3
- Path []string `bencode:"path"` // BEP3
+ // BEP3. With BEP 47 this can be optional, but we have no way to describe that without breaking
+ // the API.
+ Length int64 `bencode:"length"`
+ Path []string `bencode:"path"` // BEP3
PathUtf8 []string `bencode:"path.utf-8,omitempty"`
+
+ ExtendedFileAttrs
}
func (fi *FileInfo) DisplayPath(info *Info) string {
Pieces []byte `bencode:"pieces"` // BEP3
Name string `bencode:"name"` // BEP3
NameUtf8 string `bencode:"name.utf-8,omitempty"`
- Length int64 `bencode:"length,omitempty"` // BEP3, mutually exclusive with Files
- Private *bool `bencode:"private,omitempty"` // BEP27
+ Length int64 `bencode:"length,omitempty"` // BEP3, mutually exclusive with Files
+ ExtendedFileAttrs
+ Private *bool `bencode:"private,omitempty"` // BEP27
// TODO: Document this field.
Source string `bencode:"source,omitempty"`
Files []FileInfo `bencode:"files,omitempty"` // BEP3, mutually exclusive with Length