trackerServer

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MPL-2.0 Imports: 15 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnounceAddr

type AnnounceAddr = netip.AddrPort

type AnnounceHandler

type AnnounceHandler struct {
	AnnounceTracker AnnounceTracker

	UpstreamTrackers       []Client
	UpstreamTrackerUrls    []string
	UpstreamAnnouncePeerId [20]byte
	UpstreamAnnounceGate   UpstreamAnnounceGater
	// contains filtered or unexported fields
}

func (*AnnounceHandler) Serve

type AnnounceRequest

type AnnounceRequest = tracker.AnnounceRequest

type AnnounceTracker

type AnnounceTracker interface {
	TrackAnnounce(ctx context.Context, req udp.AnnounceRequest, addr AnnounceAddr) error
	Scrape(ctx context.Context, infoHashes []InfoHash) ([]udp.ScrapeInfohashResult, error)
	GetPeers(
		ctx context.Context,
		infoHash InfoHash,
		opts GetPeersOpts,
		remote AnnounceAddr,
	) ServerAnnounceResult
}

type Client

type Client = tracker.Client

type GetPeersOpts

type GetPeersOpts struct {
	// Negative numbers are not allowed.
	MaxCount generics.Option[uint]
}

This is reserved for stuff like filtering by IP version, avoiding an announcer's IP or key, limiting return count, etc.

type InfoHash

type InfoHash = infohash.T

type Peer

type Peer = tracker.Peer

type PeerInfo

type PeerInfo struct {
	AnnounceAddr
}

type ServerAnnounceResult

type ServerAnnounceResult struct {
	Err      error
	Peers    []PeerInfo
	Interval generics.Option[int32]
	Leechers generics.Option[int32]
	Seeders  generics.Option[int32]
}

type UpstreamAnnounceGater

type UpstreamAnnounceGater interface {
	Start(ctx context.Context, tracker string, infoHash InfoHash,

		timeout time.Duration,
	) (bool, error)
	Completed(
		ctx context.Context, tracker string, infoHash InfoHash,

		interval int32,
	) error
}

Jump to

Keyboard shortcuts

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