udpt

package module
v0.0.0-...-4b69b6b Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CONNECT  []byte = []byte{0, 0, 0, 0}
	ANNOUNCE []byte = []byte{0, 0, 0, 1}
	SCRAPE   []byte = []byte{0, 0, 0, 2}
	ERROR    []byte = []byte{0, 0, 0, 3}
)
View Source
var (
	NONE      []byte = []byte{0, 0, 0, 0}
	COMPLETED []byte = []byte{0, 0, 0, 1}
	STARTED   []byte = []byte{0, 0, 0, 2}
	STOPPED   []byte = []byte{0, 0, 0, 3}
)
View Source
var MAGIC []byte = []byte{0, 0, 4, 23, 39, 16, 25, 128}

Functions

func AnnouncementReply

func AnnouncementReply(msg Message, torrent_list map[string][]Peer) []byte

func ConnectionReply

func ConnectionReply(msg Message, connId uint64) []byte

func ErrorReply

func ErrorReply(msg Message, errorMessage string) []byte

func GetMessage

func GetMessage(connection *net.UDPConn, messageChannel chan<- Message, errorChannel chan<- error)

func ScrapingReply

func ScrapingReply(msg Message, torrent_list map[string][]Peer) []byte

Types

type Message

type Message struct {
	Length int
	Addr   *net.UDPAddr
	Flags  int
	// contains filtered or unexported fields
}

func (Message) Action

func (m Message) Action() []byte

func (Message) AllInfoHash

func (m Message) AllInfoHash() []Torrent

func (Message) ConnectionId

func (m Message) ConnectionId() uint64

func (Message) Contents

func (m Message) Contents() []byte

func (Message) Downloaded

func (m Message) Downloaded() []byte

func (Message) Event

func (m Message) Event() []byte

func (Message) IPAddr

func (m Message) IPAddr() ([]byte, error)

func (Message) InfoHash

func (m Message) InfoHash() []byte

func (Message) Key

func (m Message) Key() []byte

func (Message) Left

func (m Message) Left() []byte

func (Message) Magic

func (m Message) Magic() []byte

func (Message) NumWant

func (m Message) NumWant() []byte

func (Message) PeerId

func (m Message) PeerId() []byte

func (Message) Port

func (m Message) Port() []byte

func (Message) TransactionId

func (m Message) TransactionId() []byte

func (Message) Uploaded

func (m Message) Uploaded() []byte

type NoIPAddrError

type NoIPAddrError struct{}

func (NoIPAddrError) Error

func (e NoIPAddrError) Error() string

type Peer

type Peer struct {
	Addr   *net.UDPAddr
	ConnId uint64
	Left   uint64
}

func (*Peer) Initialize

func (p *Peer) Initialize(addr *net.UDPAddr)

type Torrent

type Torrent struct {
	InfoHash []byte
}

Jump to

Keyboard shortcuts

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