frontend

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package frontend defines interface which should satisfy every network frontend

Index

Constants

View Source
const DefaultListenAddress = ":6969"

DefaultListenAddress is the default net listen address if nothing else provided

Variables

This section is empty.

Functions

func CloseGroup added in v0.0.4

func CloseGroup(cls []io.Closer) (err error)

CloseGroup simultaneously calls Close for each non-nil array element and combines non-nil errors into one

func RegisterBuilder added in v0.0.3

func RegisterBuilder(name string, b Builder)

RegisterBuilder makes a Builder available by the provided name.

If called twice with the same name, the name is blank, or if the provided Builder is nil, this function panics.

Types

type Builder added in v0.0.3

type Builder func(conf.MapConfig, *middleware.Logic) (Frontend, error)

Builder is the function used to initialize a new Frontend with provided configuration.

type Frontend added in v0.0.3

type Frontend interface {
	io.Closer
}

Frontend dummy interface for bittorrent frontends

func NewFrontends added in v0.0.3

func NewFrontends(configs []conf.NamedMapConfig, logic *middleware.Logic) (fs []Frontend, err error)

NewFrontends is a utility function for initializing Frontend-s in bulk. Returns nil hook and error if frontend with name provided in config does not exists.

type ListenOptions added in v0.0.3

type ListenOptions struct {
	Addr                string
	ReusePort           bool `cfg:"reuse_port"`
	Workers             uint
	EnableRequestTiming bool `cfg:"enable_request_timing"`
}

ListenOptions is the base configuration which may be used in net listeners

func (ListenOptions) ListenTCP added in v0.0.3

func (lo ListenOptions) ListenTCP() (conn *net.TCPListener, err error)

ListenTCP listens at the given TCP Addr with SO_REUSEPORT and SO_REUSEADDR options enabled if ReusePort set to true

func (ListenOptions) ListenUDP added in v0.0.3

func (lo ListenOptions) ListenUDP() (conn *net.UDPConn, err error)

ListenUDP listens at the given UDP Addr with SO_REUSEPORT and SO_REUSEADDR options enabled if ReusePort set to true

func (ListenOptions) Validate added in v0.0.3

func (lo ListenOptions) Validate(logger *log.Logger) (validOptions ListenOptions)

Validate checks if listen address provided and sets default timeout options if needed

type ParseOptions

type ParseOptions struct {
	AllowIPSpoofing     bool   `cfg:"allow_ip_spoofing"`
	FilterPrivateIPs    bool   `cfg:"filter_private_ips"`
	MaxNumWant          uint32 `cfg:"max_numwant"`
	DefaultNumWant      uint32 `cfg:"default_numwant"`
	MaxScrapeInfoHashes uint32 `cfg:"max_scrape_infohashes"`
}

ParseOptions is the configuration used to parse an Announce Request.

If AllowIPSpoofing is true, IPs provided via params will be used.

func (ParseOptions) Validate

func (op ParseOptions) Validate(logger *log.Logger) ParseOptions

Validate sanity checks values set in a config and returns a new config with default values replacing anything that is invalid.

Directories

Path Synopsis
Package http implements a BitTorrent frontend via the HTTP protocol as described in BEP 3 and BEP 23.
Package http implements a BitTorrent frontend via the HTTP protocol as described in BEP 3 and BEP 23.
Package udp implements a BitTorrent tracker via the UDP protocol as described in BEP 15.
Package udp implements a BitTorrent tracker via the UDP protocol as described in BEP 15.

Jump to

Keyboard shortcuts

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