torrent

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnouncePolicy

type AnnouncePolicy interface {
	SupportHttpAnnounce() bool
	SupportUdpAnnounce() bool
	SupportAnnounceList() bool
	ShouldAnnounceToAllTier() bool
	ShouldAnnounceToAllTrackersInTier() bool
}

type AnnouncingFunction

type AnnouncingFunction = func(TrackerAnnounceRequest)

type Factory

type Factory interface {
	// CreateTorrent create a Torrent. announceList might have been shuffled
	CreateTorrent(meta metainfo.MetaInfo, announcePolicy AnnouncePolicy) (Torrent, error)
}

type FactoryImpl

type FactoryImpl struct {
}

func (FactoryImpl) CreateTorrent

func (f FactoryImpl) CreateTorrent(meta metainfo.MetaInfo, announcePolicy AnnouncePolicy) (Torrent, error)

type Peers

type Peers interface {
	Seeders() int32
	Leechers() int32
}

type Torrent

type Torrent interface {
	InfoHash() libtorrent.InfoHash
	Name() string
	GetPeers() Peers

	// AnnounceStop unconditionally send Stop event to all tracker currently in use
	AnnounceStop(announcingFunction AnnouncingFunction)
	// AnnounceToReadyTrackers announce to all tracker that are ready to receive an announce
	AnnounceToReadyTrackers(announcingFunction AnnouncingFunction)
	// HandleAnnounceSuccess delegate the handling of the response to the trackers
	HandleAnnounceSuccess(response TrackerAnnounceResponse)
	// HandleAnnounceError delegate the handling of the response to the trackers
	HandleAnnounceError(response TrackerAnnounceResponseError)
}

type TrackerAnnounceRequest

type TrackerAnnounceRequest struct {
	InfoHash   libtorrent.InfoHash
	Event      libtracker.AnnounceEvent
	Url        url.URL
	Uploaded   int64
	Downloaded int64
	Left       int64
	Corrupt    int64
	Private    bool
}

type TrackerAnnounceResponse

type TrackerAnnounceResponse struct {
	Request  TrackerAnnounceRequest
	Interval time.Duration
	Seeders  int32
	Leechers int32
}

type TrackerAnnounceResponseError

type TrackerAnnounceResponseError struct {
	Error   error
	Request TrackerAnnounceRequest
}

Jump to

Keyboard shortcuts

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