github.com/anacrolix/torrent@v1.61.0/tracker/udp/announce.go (about)

     1  package udp
     2  
     3  import (
     4  	"encoding"
     5  
     6  	"github.com/anacrolix/dht/v2/krpc"
     7  	"github.com/anacrolix/torrent/tracker/shared"
     8  	"github.com/anacrolix/torrent/types"
     9  	"github.com/anacrolix/torrent/types/infohash"
    10  )
    11  
    12  // Marshalled as binary by the UDP client, so be careful making changes.
    13  type AnnounceRequest struct {
    14  	InfoHash   infohash.T
    15  	PeerId     types.PeerID
    16  	Downloaded int64
    17  	Left       int64 // If less than 0, math.MaxInt64 will be used for HTTP trackers instead.
    18  	Uploaded   int64
    19  	// Apparently this is optional. None can be used for announces done at
    20  	// regular intervals.
    21  	Event     AnnounceEvent
    22  	IPAddress uint32
    23  	Key       int32
    24  	NumWant   int32 // How many peer addresses are desired. -1 for default.
    25  	Port      uint16
    26  } // 82 bytes
    27  
    28  type AnnounceEvent = shared.AnnounceEvent
    29  
    30  type AnnounceResponsePeers interface {
    31  	encoding.BinaryUnmarshaler
    32  	NodeAddrs() []krpc.NodeAddr
    33  }