bootstrap

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InfoHash

func InfoHash(meshID string, psk []byte) ([20]byte, error)

func PeerID

func PeerID() ([20]byte, error)

Types

type AnnounceRequest

type AnnounceRequest struct {
	InfoHash [20]byte
	PeerID   [20]byte
	Port     int
	Event    Event
	NumWant  int
}

type Event

type Event int32
const (
	EventNone Event = iota
	EventCompleted
	EventStarted
	EventStopped
)

func (Event) String

func (e Event) String() string

type HTTPClient

type HTTPClient struct {
	Client      *http.Client
	BindIfIndex int
}

func NewHTTPClient

func NewHTTPClient(timeout time.Duration) *HTTPClient

func NewHTTPClientWithBind

func NewHTTPClientWithBind(timeout time.Duration, bindIfIndex int) *HTTPClient

func (*HTTPClient) Announce

func (c *HTTPClient) Announce(ctx context.Context, trackerURL string, req AnnounceRequest) ([]string, error)

type Manager

type Manager struct {
	HTTP trackerAnnouncer
	UDP  trackerAnnouncer
	// contains filtered or unexported fields
}

func NewManager

func NewManager(timeout time.Duration) *Manager

func NewManagerWithBind

func NewManagerWithBind(timeout time.Duration, bindIfIndex int) *Manager

NewManagerWithBind constructs a Manager whose UDP tracker client forces outbound packets through the given network interface index (0 disables the override and lets the OS routing table decide).

func (*Manager) AnnounceAll

func (m *Manager) AnnounceAll(ctx context.Context, trackers []string, req AnnounceRequest) ([]string, error)

type UDPClient

type UDPClient struct {
	BindIfIndex int
}

UDPClient announces over the binary UDP tracker protocol. Setting BindIfIndex to a non-zero value forces the underlying socket onto a specific NIC (see transport.ResolveBindInterface).

func (*UDPClient) Announce

func (c *UDPClient) Announce(ctx context.Context, trackerURL string, req AnnounceRequest) ([]string, error)

Jump to

Keyboard shortcuts

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