http

package
v0.0.0-...-9dfd8d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseAnnounceResponse

type BaseAnnounceResponse struct {
	FailureReason  string `bencode:"failure reason"`
	WarningMessage string `bencode:"warning message"`
	Interval       int    `bencode:"interval"`
	MinInterval    int    `bencode:"min interval"`
	Complete       int    `bencode:"complete"`
	Incomplete     int    `bencode:"incomplete"`
}

BaseAnnounceResponse contains the fields present in all announce responses.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for an http tracker.

func NewClient

func NewClient(announceAddress string) (*Client, error)

NewClient returns a new client for the given announce URI.

func (*Client) Announce

Announce announces to the tracker.

func (*Client) OverrideCompact

func (c *Client) OverrideCompact(to bool)

OverrideCompact instructs the Client to override the compact value set in an AnnounceRequest with the given value for all future announces.

type CompactAnnounceResponse

type CompactAnnounceResponse struct {
	BaseAnnounceResponse
	Peers  []byte `bencode:"peers"`
	Peers6 []byte `bencode:"peers6"`
}

CompactAnnounceResponse is a template to parse a compact bencoded announce response into.

type NonCompactAnnounceResponse

type NonCompactAnnounceResponse struct {
	BaseAnnounceResponse
	Peers []Peer `bencode:"peers"`
}

NonCompactAnnounceResponse is a template to parse a non-compact bencoded announce response into.

type Peer

type Peer struct {
	ID   string `bencode:"peer id"`
	IP   string `bencode:"ip"`
	Port uint16 `bencode:"port"`
}

Peer is a template to parse bencoded peer information into.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL