http

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

Documentation

Overview

Package http implements a BitTorrent frontend via the HTTP protocol as described in BEP 3 and BEP 23.

Index

Constants

View Source
const (

	// DefaultAnnounceRoute is the default url path to listen announce
	// requests if nothing else provided
	DefaultAnnounceRoute = "/announce"
	// DefaultScrapeRoute is the default url path to listen scrape
	// requests if nothing else provided
	DefaultScrapeRoute = "/scrape"
)
View Source
const Name = "http"

Name - registered name of the frontend

Variables

This section is empty.

Functions

func NewFrontend

func NewFrontend(c conf.MapConfig, logic *middleware.Logic) (frontend.Frontend, error)

NewFrontend builds and starts http bittorrent frontend from provided configuration

Types

type Config

type Config struct {
	frontend.ListenOptions
	ReadTimeout     time.Duration `cfg:"read_timeout"`
	WriteTimeout    time.Duration `cfg:"write_timeout"`
	IdleTimeout     time.Duration `cfg:"idle_timeout"`
	EnableKeepAlive bool          `cfg:"enable_keepalive"`
	UseTLS          bool          `cfg:"tls"`
	TLSCertPath     string        `cfg:"tls_cert_path"`
	TLSKeyPath      string        `cfg:"tls_key_path"`
	AnnounceRoutes  []string      `cfg:"announce_routes"`
	ScrapeRoutes    []string      `cfg:"scrape_routes"`
	PingRoutes      []string      `cfg:"ping_routes"`
	ParseOptions
}

Config represents all configurable options for an HTTP BitTorrent Frontend

func (Config) Validate

func (cfg Config) Validate() (validCfg Config, err error)

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

type ParseOptions

type ParseOptions struct {
	frontend.ParseOptions
	RealIPHeader string `cfg:"real_ip_header"`
}

ParseOptions is the configuration used to parse an Announce Request.

If AllowIPSpoofing is true, IPs provided via BitTorrent params will be used. If RealIPHeader is not empty string, the value of the first HTTP Header with that name will be used.

Jump to

Keyboard shortcuts

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