tracker

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: 235 modules, 459 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

View Source
const (
	None      = shared.None
	Started   = shared.Started
	Stopped   = shared.Stopped
	Completed = shared.Completed
)
View Source
const DefaultTrackerAnnounceTimeout = 15 * time.Second

The code *is* the documentation.

Variables

View Source
var ErrBadScheme = errors.New("unknown scheme")

Functions

This section is empty.

Types

type Announce

type Announce struct {
	TrackerUrl          string
	Request             AnnounceRequest
	HostHeader          string
	HttpProxy           func(*http.Request) (*url.URL, error)
	HttpRequestDirector func(*http.Request) error
	DialContext         func(ctx context.Context, network, addr string) (net.Conn, error)
	ListenPacket        func(network, addr string) (net.PacketConn, error)
	ServerName          string
	// Don't verify HTTPS tracker certificates.
	InsecureSkipVerify bool
	UserAgent          string
	UdpNetwork         string
	// If the port is zero, it's assumed to be the same as the Request.Port.
	ClientIp4 krpc.NodeAddr
	// If the port is zero, it's assumed to be the same as the Request.Port.
	ClientIp6 krpc.NodeAddr
	Context   context.Context
	// Deprecated: Use Slogger.
	Logger  log.Logger
	Slogger *slog.Logger
}

Deprecated. Use tracker.NewClient and friends instead.

func (Announce) Do

func (me Announce) Do() (res AnnounceResponse, err error)

type AnnounceEvent

type AnnounceEvent = shared.AnnounceEvent

type AnnounceOpt added in v1.29.0

type AnnounceOpt = trHttp.AnnounceOpt

type AnnounceRequest

type AnnounceRequest = udp.AnnounceRequest

type AnnounceResponse

type AnnounceResponse = trHttp.AnnounceResponse

type Client added in v1.29.0

type Client interface {
	Announce(context.Context, AnnounceRequest, AnnounceOpt) (AnnounceResponse, error)
	Scrape(ctx context.Context, ihs []infohash.T) (out udp.ScrapeResponse, err error)
	Close() error
}

func NewClient added in v1.29.0

func NewClient(urlStr string, opts NewClientOpts) (Client, error)

type NewClientOpts added in v1.29.0

type NewClientOpts struct {
	Http trHttp.NewClientOpts
	// Overrides the network in the scheme. Probably a legacy thing.
	UdpNetwork string
	// Deprecated: Use Slogger.
	Logger       log.Logger
	Slogger      *slog.Logger
	ListenPacket func(network, addr string) (net.PacketConn, error)
	// If non-nil, UDP trackers send and receive through this shared socket instead of opening one
	// each, and UdpNetwork and ListenPacket are ignored for them. Closing the Client doesn't close
	// the socket.
	UdpSocket *udp.Socket
}

type Peer

type Peer = trHttp.Peer

Directories

Path Synopsis
udp

Jump to

Keyboard shortcuts

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