9 type AnnounceRequest struct {
18 NumWant int32 // How many peer addresses are desired. -1 for default.
22 type AnnounceResponse struct {
23 Interval int32 // Minimum seconds the local peer should wait before next announce.
29 type AnnounceEvent int32
37 None AnnounceEvent = iota
38 Completed // The local peer just completed the torrent.
39 Started // The local peer has just resumed this torrent.
40 Stopped // The local peer is leaving the swarm.
43 type Client interface {
44 // Returns ErrNotConnected if Connect needs to be called.
45 Announce(*AnnounceRequest) (AnnounceResponse, error)
50 ErrNotConnected = errors.New("not connected")
51 ErrBadScheme = errors.New("unknown scheme")
53 schemes = make(map[string]func(*url.URL) Client)
56 func RegisterClientScheme(scheme string, newFunc func(*url.URL) Client) {
57 schemes[scheme] = newFunc
60 func New(url *url.URL) (cl Client, err error) {
61 newFunc, ok := schemes[url.Scheme]