return
}
+type stringAddr string
+
+var _ net.Addr = stringAddr("")
+
+func (stringAddr) Network() string { return "" }
+func (me stringAddr) String() string { return string(me) }
+
// The trackers will be merged with the existing ones. If the Info isn't yet known, it will be set.
// spec.DisallowDataDownload/Upload will be read and applied
// The display name is replaced if the new spec provides one. Note that any `Storage` is ignored.
for _, url := range spec.Webseeds {
t.addWebSeed(url)
}
+ for _, peerAddr := range spec.PeerAddrs {
+ t.addPeer(PeerInfo{
+ Addr: stringAddr(peerAddr),
+ Source: PeerSourceDirect,
+ Trusted: true,
+ })
+ }
if spec.ChunkSize != 0 {
t.setChunkSize(pp.Integer(spec.ChunkSize))
}
PeerSourceDhtGetPeers = "Hg" // Peers we found by searching a DHT.
PeerSourceDhtAnnouncePeer = "Ha" // Peers that were announced to us by a DHT.
PeerSourcePex = "X"
+ // The peer was given directly, such as through a magnet link.
+ PeerSourceDirect = "M"
)
type peer struct {
DisplayName string
Webseeds []string
DhtNodes []string
+ PeerAddrs []string
// The combination of the "xs" and "as" fields in magnet links, for now.
Sources []string
InfoHash: m.InfoHash,
Webseeds: m.Params["ws"],
Sources: append(m.Params["xs"], m.Params["as"]...),
- // TODO: What's the parameter for DHT nodes or bootstrap peers in a magnet link?
+ PeerAddrs: m.Params["x.pe"], // BEP 9
+ // TODO: What's the parameter for DHT nodes?
}
return
}