torrent2

package
v0.0.0-...-4af7ccb Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnounceHistory

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

type AnnounceProps

type AnnounceProps struct {
	SupportAnnounceList   bool
	SupportHttpAnnounce   bool
	SupportUdpAnnounce    bool
	AnnounceToAllTiers    bool
	AnnounceToAllTrackers bool
}

type AnnounceQueue

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

func NewAnnounceQueue

func NewAnnounceQueue() *AnnounceQueue

func (*AnnounceQueue) DiscardFutureEnqueueAndDestroy

func (q *AnnounceQueue) DiscardFutureEnqueueAndDestroy()

func (*AnnounceQueue) Enqueue

func (q *AnnounceQueue) Enqueue(req *announces.AnnounceRequest)

func (*AnnounceQueue) Request

func (q *AnnounceQueue) Request() <-chan *announces.AnnounceRequest

type Peers

type Peers interface {
	Seeders() int32
	Leechers() int32
	AddPeer(update SwarmUpdateRequest)
	Reset()
}

type Speeds

type Speeds interface {
	UploadSpeed() (bps int64)
	SetUploadSpeed(bps int64)
	Reset()
}

type Stats

type Stats interface {
	Uploaded() int64
	Downloaded() int64
	Left() int64
	Corrupted() int64
	AddUploaded(int64)
	AddDownloaded(int64)
	Reset()
}

Stats stores the torrent current uploaded, downloaded, left and corrupted stats. Implementation MUST be thread-safe

type SwarmUpdateRequest

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

type Torrent

type Torrent interface {
	Start(props AnnounceProps, announceQueue *AnnounceQueue, dispatcher bandwidth.SpeedDispatcher)
	Stop(ctx context.Context)
	InfoHash() torrent.InfoHash
	Path() string
	ChangePath(path string)
	MoveTo(directory string) error
	// AddDataFor add interval second worth of upload to Stats.Uploaded
	AddDataFor(interval time.Duration)
}

func FromFile

func FromFile(filePath string) (Torrent, error)

type Tracker

type Tracker interface {
	Url() url.URL
	CanAnnounce(now time.Time) bool
	IsWorking() bool
	Succeed(announceHistory AnnounceHistory)
	Failed(announceHistory AnnounceHistory, backoffRatio int, retryInterval int)
	Reset()
}

Jump to

Keyboard shortcuts

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