session

package
v0.0.0-...-dafe3aa Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockState

type BlockState struct {
	Offset      uint32
	Length      uint32
	State       int
	RequestedAt time.Time
}

type PieceWork

type PieceWork struct {
	Index          uint32
	Length         int64
	Hash           [20]byte
	Buffer         []byte
	Blocks         []BlockState
	TotalBlocks    int
	ReceivedBlocks int
}

type TorrentSession

type TorrentSession struct {
	MetaInfo       *metainfo.MetaInfo
	OurPeerID      [20]byte
	ListenPort     uint16
	DownloadDir    string
	OurBitfield    peer.Bitfield
	ConnectedPeers map[[20]byte]*peer.Client
	TrackerRequest tracker.TrackerRequest

	PieceWorkQueue chan *PieceWork
	Results        chan *peer.PieceBlock

	ActivePieces map[uint32]*PieceWork
	// contains filtered or unexported fields
}

func New

func New(metaInfo *metainfo.MetaInfo, listenPort uint16, downloadDir string) (*TorrentSession, error)

func (*TorrentSession) Run

func (s *TorrentSession) Run() error

Jump to

Keyboard shortcuts

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