Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressFamily ¶
type AddressFamily uint8
AddressFamily is the address family of an IP address.
const ( IPv4 AddressFamily = iota IPv6 )
AddressFamily constants.
type AnnounceRequest ¶
type AnnounceRequest struct { Event string InfoHash InfoHash Compact bool EventProvided bool NumWantProvided bool IPProvided bool NumWant uint32 Left uint64 Downloaded uint64 Uploaded uint64 NoPeerId bool Expiry int64 IsIPv6 bool Peer }
AnnounceRequest represents the parsed parameters from an announce request.
type AnnounceResponse ¶
type AnnounceResponse struct { Compact bool Complete uint32 Incomplete uint32 Interval time.Duration MinInterval time.Duration IPv4Peers []Peer IPv6Peers []Peer }
AnnounceResponse represents the parameters used to create an announce response.
type ClientError ¶
type ClientError string
ClientError represents an error that should be exposed to the client over the BitTorrent protocol implementation.
func (ClientError) Error ¶
func (c ClientError) Error() string
Error implements the error interface for ClientError.
type ClientID ¶
type ClientID [6]byte
ClientID represents the part of a PeerID that identifies a Peer's client software.
func NewClientID ¶
NewClientID parses a ClientID from a PeerID.
type InfoHash ¶
type InfoHash [20]byte
InfoHash represents an infohash.
func InfoHashFromBytes ¶
InfoHashFromBytes creates an InfoHash from a byte slice.
It panics if b is not 20 bytes long.
func InfoHashFromString ¶
InfoHashFromString creates an InfoHash from a string.
It panics if s is not 20 bytes long.
type Peer ¶
Peer represents the connection details of a peer that is returned in an announce response.
func (Peer) EqualEndpoint ¶
EqualEndpoint reports whether p and x have the same endpoint.
type PeerID ¶
type PeerID [20]byte
PeerID represents a peer ID.
func PeerIDFromBytes ¶
PeerIDFromBytes creates a PeerID from a byte slice.
It panics if b is not 20 bytes long.
func PeerIDFromString ¶
PeerIDFromString creates a PeerID from a string.
It panics if s is not 20 bytes long.
type ScrapeResponse ¶
type ScrapeResponse struct {
Files []Scrape
}
ScrapeResponse represents the parameters used to create a scrape response.
The Scrapes must be in the same order as the InfoHashes in the corresponding ScrapeRequest.