torrent

package
v0.0.0-...-44f5dd3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	Ip   net.IP `json:"ip"`
	Port uint16 `json:"port"`
}

func UnmarshalPeers

func UnmarshalPeers(peersBinary []byte) ([]Peer, error)

type Torrent

type Torrent struct {
	Announce    string         `json:"announce"`
	InfoHash    [20]byte       `json:"info_hash"`
	PieceHashes [][20]byte     `json:"piece_hashes"`
	PieceLength int            `json:"piece_length"`
	Files       []*TorrentFile `json:"files"`
}

func Parse

func Parse(rawFile []byte) (*Torrent, error)

func (*Torrent) RequestPeers

func (torrent *Torrent) RequestPeers(peerId []byte, port uint16) ([]Peer, error)

func (*Torrent) TotalLength

func (torrent *Torrent) TotalLength() int

type TorrentFile

type TorrentFile struct {
	Path   []string `json:"path"`
	Length int      `json:"length"`
}

type TrackerResponse

type TrackerResponse struct {
	FailureReason string `bencode:"failure reason"`
	Interval      int    `bencode:"interval"`
	Peers         string `bencode:"peers"`
}

Jump to

Keyboard shortcuts

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