http

package
v0.0.0-...-b47dde4 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2014 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package http implements an http-serving BitTorrent tracker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnnounce

func NewAnnounce(cfg *config.Config, r *http.Request, p httprouter.Params) (*models.Announce, error)

NewAnnounce parses an HTTP request and generates a models.Announce.

func NewScrape

func NewScrape(cfg *config.Config, r *http.Request, p httprouter.Params) (*models.Scrape, error)

NewScrape parses an HTTP request and generates a models.Scrape.

func Serve

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

Types

type ResponseHandler

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

type Server

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

type Writer

type Writer struct {
	http.ResponseWriter
}

Writer implements the tracker.Writer interface for the HTTP protocol.

func (*Writer) WriteAnnounce

func (w *Writer) WriteAnnounce(res *models.AnnounceResponse) error

WriteAnnounce writes a bencode dict representation of an AnnounceResponse.

func (*Writer) WriteError

func (w *Writer) WriteError(err error) error

WriteError writes a bencode dict with a failure reason.

func (*Writer) WriteScrape

func (w *Writer) WriteScrape(res *models.ScrapeResponse) error

WriteScrape writes a bencode dict representation of a ScrapeResponse.

Directories

Path Synopsis
Package query implements a faster single-purpose URL Query parser.
Package query implements a faster single-purpose URL Query parser.

Jump to

Keyboard shortcuts

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