api

package
v0.0.0-...-c57407d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package api implements a RESTful HTTP JSON API server for a BitTorrent tracker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponseHandler

type ResponseHandler func(http.ResponseWriter, *http.Request, httprouter.Params) (int, error)

ResponseHandler is an HTTP handler that returns a status code.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents an API server for a torrent tracker.

func NewServer

func NewServer(cfg *config.Config, tkr *tracker.Tracker) *Server

NewServer returns a new API server for a given configuration and tracker instance.

func (*Server) Serve

func (s *Server) Serve()

Serve runs an API server, blocking until the server has shut down.

func (*Server) Setup

func (s *Server) Setup() error

func (*Server) Stop

func (s *Server) Stop()

Stop cleanly shuts down the server.

Jump to

Keyboard shortcuts

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