Documentation
¶
Index ¶
- Constants
- Variables
- func AnnounceOptionEventCompleted(ar *AnnounceRequest)
- func AnnounceOptionEventStarted(ar *AnnounceRequest)
- func AnnounceOptionEventStopped(ar *AnnounceRequest)
- func AnnounceOptionKey(ar *AnnounceRequest)
- func AnnounceOptionSeeding(ar *AnnounceRequest)
- type Action
- type Announce
- type AnnounceEvent
- type AnnounceOption
- type AnnounceRequest
- type AnnounceResponse
- type AnnounceResponseHeader
- type ConnectionRequest
- type ConnectionResponse
- type HttpResponse
- type Peer
- type Peers
- type RequestHeader
- type ResponseHeader
Constants ¶
View Source
const (
ErrMissingInfoHash = errorsx.String("missing info hash")
)
Variables ¶
View Source
var (
ErrBadScheme = errors.New("unknown scheme")
)
Functions ¶
func AnnounceOptionEventCompleted ¶
func AnnounceOptionEventCompleted(ar *AnnounceRequest)
func AnnounceOptionEventStarted ¶
func AnnounceOptionEventStarted(ar *AnnounceRequest)
func AnnounceOptionEventStopped ¶
func AnnounceOptionEventStopped(ar *AnnounceRequest)
func AnnounceOptionKey ¶
func AnnounceOptionKey(ar *AnnounceRequest)
func AnnounceOptionSeeding ¶
func AnnounceOptionSeeding(ar *AnnounceRequest)
Types ¶
type Announce ¶
type Announce struct {
TrackerUrl string
// UdpNetwork string
UserAgent string
// If the port is zero, it's assumed to be the same as the Request.Port.
ClientIp4 krpc.NodeAddr
// If the port is zero, it's assumed to be the same as the Request.Port.
ClientIp6 krpc.NodeAddr
Dialer netx.Dialer
}
func (Announce) Do ¶
func (me Announce) Do(ctx context.Context, req AnnounceRequest) (res AnnounceResponse, err error)
func (Announce) ForTracker ¶
type AnnounceEvent ¶
type AnnounceEvent int32
const ( None AnnounceEvent = iota Completed // The local peer just completed the torrent. Started // The local peer has just resumed this torrent. Stopped // The local peer is leaving the swarm. )
func (AnnounceEvent) String ¶
func (e AnnounceEvent) String() string
type AnnounceOption ¶
type AnnounceOption func(*AnnounceRequest)
func AnnounceOptionDownloaded ¶
func AnnounceOptionDownloaded(n int64) AnnounceOption
func AnnounceOptionRemaining ¶
func AnnounceOptionRemaining(n int64) AnnounceOption
func AnnounceOptionUploaded ¶
func AnnounceOptionUploaded(n int64) AnnounceOption
type AnnounceRequest ¶
type AnnounceRequest struct {
InfoHash [20]byte
PeerId [20]byte
Downloaded int64
Left int64 // math.MaxInt64 will be used by default
Uploaded int64
// Apparently this is optional. None can be used for announces done at
// regular intervals.
Event AnnounceEvent
IPAddress uint32
Key int32
NumWant int32 // How many peer addresses are desired. -1 for default.
Port