tracker

package
v0.0.0-...-da267cc Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package tracker implements the public facing HTTP interfaces to the tracker.

Tracker endpoints:

  • /:passkey/announce
  • /:passkey/scrape

API routes:

  • General

  • POST /ping

  • GET /tracker/stats

  • PATCH /config

  • Torrents

  • DELETE /torrent/:info_hash

  • PATCH /torrent/:info_hash

  • POST /torrent

  • POST /whitelist

  • GET /whitelist

  • DELETE/whitelist/:prefix

  • Users

  • POST /user

  • DELETE /user/pk/:passkey

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientWhitelisted

func ClientWhitelisted(peerID store.PeerID) bool

func Init

func Init()

func Migrate

func Migrate() error

func NewBitTorrentHandler

func NewBitTorrentHandler() *gin.Engine

NewBitTorrentHandler configures a router to handle tracker announce/scrape requests

func NewHTTPServer

func NewHTTPServer(opts *HTTPOpts) *http.Server

NewHTTPServer will configure and return a *http.Server suitable for serving requests. This should be used over the default ListenAndServe options as they do not set certain parameters, notably timeouts, which can negatively effect performance.

func PeerReaper

func PeerReaper(ctx context.Context)

PeerReaper will call the store.PeerStore.Reap() function periodically. This is used to clean peers that have not announced in a while from the swarm.

func RoleAdd

func RoleAdd(role *store.Role) error

func RoleAll

func RoleAll() []*store.Role

func RoleDelete

func RoleDelete(roleID uint32) error

func StatWorker

func StatWorker(ctx context.Context)

StatWorker handles summing up stats for users/peers/db to be sent to the backing stores for long term storage. No locking required for these data sets

func TorrentAdd

func TorrentAdd(torrent *store.Torrent) error

func TorrentDelete

func TorrentDelete(torrent *store.Torrent) error

func TorrentGet

func TorrentGet(hash store.InfoHash, deletedOk bool) (*store.Torrent, error)

func Torrents

func Torrents() store.Torrents

func UserAdd

func UserAdd(user *store.User) error

func UserDelete

func UserDelete(user *store.User) error

func UserGetByPasskey

func UserGetByPasskey(passkey string) (*store.User, error)

func UserGetByRemoteID

func UserGetByRemoteID(remoteID uint64) (*store.User, error)

func UserGetByUserID

func UserGetByUserID(userID uint32) (*store.User, error)

func UserSave

func UserSave(user *store.User) error

func Users

func Users() store.Users

func WhiteList

func WhiteList() store.WhiteList

func WhiteListAdd

func WhiteListAdd(wl *store.WhiteListClient) error

func WhiteListDelete

func WhiteListDelete(wl *store.WhiteListClient) error

func WhiteListGet

func WhiteListGet(p string) (*store.WhiteListClient, error)

Types

type GlobalStats

type GlobalStats struct {
}

GlobalStats holds basic stats for the running tracker

type HTTPOpts

type HTTPOpts struct {
	ListenAddr     string
	UseTLS         bool
	Handler        http.Handler
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	MaxHeaderBytes int
	TLSConfig      *tls.Config
}

HTTPOpts is used to configure a http.Server instance

func DefaultHTTPOpts

func DefaultHTTPOpts() *HTTPOpts

DefaultHTTPOpts returns a default set of options for http.Server instances

Jump to

Keyboard shortcuts

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