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 ¶
- func ClientWhitelisted(peerID store.PeerID) bool
- func Init()
- func Migrate() error
- func NewBitTorrentHandler() *gin.Engine
- func NewHTTPServer(opts *HTTPOpts) *http.Server
- func PeerReaper(ctx context.Context)
- func RoleAdd(role *store.Role) error
- func RoleAll() []*store.Role
- func RoleDelete(roleID uint32) error
- func StatWorker(ctx context.Context)
- func TorrentAdd(torrent *store.Torrent) error
- func TorrentDelete(torrent *store.Torrent) error
- func TorrentGet(hash store.InfoHash, deletedOk bool) (*store.Torrent, error)
- func Torrents() store.Torrents
- func UserAdd(user *store.User) error
- func UserDelete(user *store.User) error
- func UserGetByPasskey(passkey string) (*store.User, error)
- func UserGetByRemoteID(remoteID uint64) (*store.User, error)
- func UserGetByUserID(userID uint32) (*store.User, error)
- func UserSave(user *store.User) error
- func Users() store.Users
- func WhiteList() store.WhiteList
- func WhiteListAdd(wl *store.WhiteListClient) error
- func WhiteListDelete(wl *store.WhiteListClient) error
- func WhiteListGet(p string) (*store.WhiteListClient, error)
- type GlobalStats
- type HTTPOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientWhitelisted ¶
func NewBitTorrentHandler ¶
NewBitTorrentHandler configures a router to handle tracker announce/scrape requests
func NewHTTPServer ¶
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 ¶
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 RoleDelete ¶
func StatWorker ¶
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 TorrentDelete ¶
func UserDelete ¶
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