announcer

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnounceError added in v0.9.0

type AnnounceError struct {
	Err     error
	Message string
	Unknown bool
}

AnnounceError the error that comes from the Tracker itself.

func (*AnnounceError) ErrorWithType added in v0.10.0

func (e *AnnounceError) ErrorWithType() string

ErrorWithType returns the error string that is prefixed with type name.

type DHTAnnouncer

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

DHTAnnouncer runs a function periodically to announce the Torrent to DHT network.

func NewDHTAnnouncer

func NewDHTAnnouncer() *DHTAnnouncer

NewDHTAnnouncer returns a new DHTAnnouncer.

func (*DHTAnnouncer) Close

func (a *DHTAnnouncer) Close()

Close the announcer.

func (*DHTAnnouncer) NeedMorePeers

func (a *DHTAnnouncer) NeedMorePeers(val bool)

NeedMorePeers signals the announcer goroutine to fetch more peers from DHT.

func (*DHTAnnouncer) Run

func (a *DHTAnnouncer) Run(announceFunc func(), interval, minInterval time.Duration, l logger.Logger)

Run the announcer. Invoke with go statement.

type PeriodicalAnnouncer

type PeriodicalAnnouncer struct {
	Tracker tracker.Tracker

	HasAnnounced bool
	// contains filtered or unexported fields
}

PeriodicalAnnouncer announces the Torrent to the Tracker periodically.

func NewPeriodicalAnnouncer

func NewPeriodicalAnnouncer(trk tracker.Tracker, numWant int, minInterval time.Duration, getTorrent func() tracker.Torrent, completedC chan struct{}, newPeers chan []*net.TCPAddr, l logger.Logger) *PeriodicalAnnouncer

NewPeriodicalAnnouncer returns a new PeriodicalAnnouncer.

func (*PeriodicalAnnouncer) Close

func (a *PeriodicalAnnouncer) Close()

Close the announcer.

func (*PeriodicalAnnouncer) NeedMorePeers

func (a *PeriodicalAnnouncer) NeedMorePeers(val bool)

NeedMorePeers signals the announcer goroutine about the need of more peers.

func (*PeriodicalAnnouncer) Run

func (a *PeriodicalAnnouncer) Run()

Run the announcer goroutine. Invoke with go statement.

func (*PeriodicalAnnouncer) Stats

func (a *PeriodicalAnnouncer) Stats() Stats

Stats about the tracker and the announce operation.

type Stats

type Stats struct {
	Status       Status
	Error        *AnnounceError
	Warning      string
	Seeders      int
	Leechers     int
	LastAnnounce time.Time
	NextAnnounce time.Time
}

Stats about the announcer.

type Status

type Status int

Status of the announcer.

const (
	// NotContactedYet with the tracker.
	NotContactedYet Status = iota
	// Contacting the tracker.
	Contacting
	// Working as expected.
	Working
	// NotWorking as expected.
	NotWorking
)

type StopAnnouncer

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

StopAnnouncer is used to send a stop event to the Tracker.

func NewStopAnnouncer

func NewStopAnnouncer(trackers []tracker.Tracker, tra tracker.Torrent, timeout time.Duration, resultC chan struct{}, l logger.Logger) *StopAnnouncer

NewStopAnnouncer returns a new StopAnnouncer.

func (*StopAnnouncer) Close

func (a *StopAnnouncer) Close()

Close the announcer.

func (*StopAnnouncer) Run

func (a *StopAnnouncer) Run()

Run the announcer.

Jump to

Keyboard shortcuts

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