udp

package
v0.0.0-...-86555eb Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action uint32
const (
	Connect Action = iota
	Announce
	Scrape
	Error
)

type AnnounceRequestPayload

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

func (*AnnounceRequestPayload) Build

func (payload *AnnounceRequestPayload) Build(connectionID uint64, infoHash [20]uint8, peerID [20]byte, left uint64) (buf []byte)

type AnnounceResponsePayload

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

func (*AnnounceResponsePayload) Marshall

func (payload *AnnounceResponsePayload) Marshall(buf []byte)

type ConnectRequestPayload

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

func (*ConnectRequestPayload) Build

func (payload *ConnectRequestPayload) Build() (buf []byte)

type ConnectResponsePayload

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

func (*ConnectResponsePayload) Marshall

func (payload *ConnectResponsePayload) Marshall(buf []byte)

type Event

type Event uint32
const (
	None Event = iota
	Completed
	Started
	Stopped
)

type Peer

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

func MarshallPeers

func MarshallPeers(buf []byte, peersCount int) (peers []Peer)

func (Peer) IP

func (peer Peer) IP() string

func (Peer) Port

func (peer Peer) Port() uint16

func (Peer) URL

func (peer Peer) URL() string

type ScrapeRequestPayload

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

func (*ScrapeRequestPayload) Build

func (payload *ScrapeRequestPayload) Build(connectionID uint64, infoHash [][20]uint8) (buf []byte)

type Transaction

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

func (Transaction) ID

func (t Transaction) ID() TransactionID

func (*Transaction) New

func (t *Transaction) New() TransactionID

func (*Transaction) Refresh

func (t *Transaction) Refresh()

type TransactionID

type TransactionID uint32

type UDPTrackerProtocol

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

func (*UDPTrackerProtocol) AnnounceToTracker

func (udp *UDPTrackerProtocol) AnnounceToTracker(infoHash [20]byte, peerID []byte, left uint64) ([]Peer, error)

func (*UDPTrackerProtocol) ConnectToTracker

func (udp *UDPTrackerProtocol) ConnectToTracker(possibleURLs []*url.URL) error

func (*UDPTrackerProtocol) ScrapeTracker

func (udp *UDPTrackerProtocol) ScrapeTracker(infoHash [][20]byte) error

type UnEqualActionError

type UnEqualActionError struct {
	Sent     Action
	Received Action
}

func (UnEqualActionError) Error

func (e UnEqualActionError) Error() string

type UnEqualTransactionIDError

type UnEqualTransactionIDError struct {
	Sent     TransactionID
	Received TransactionID
}

func (UnEqualTransactionIDError) Error

Jump to

Keyboard shortcuts

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