api

package
v0.0.0-...-bfd0fd8 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2014 License: MIT Imports: 17 Imported by: 1

Documentation

Overview

Package api provides the HTTP API implementation of the goat BitTorrent tracker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorResponse

func ErrorResponse(msg string) string

ErrorResponse returns an Error as JSON

func Router

func Router(w http.ResponseWriter, r *http.Request, session data.UserRecord)

Router handles the routing of HTTP API requests

Types

type APIAuthenticator

type APIAuthenticator interface {
	Auth(*http.Request) (error, error)
	Session() (data.UserRecord, error)
}

APIAuthenticator interface which defines methods required to implement an authentication method

type BasicAuthenticator

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

BasicAuthenticator uses the HTTP Basic with bcrypt authentication scheme

func (*BasicAuthenticator) Auth

func (a *BasicAuthenticator) Auth(r *http.Request) (error, error)

Auth handles validation of HTTP Basic with bcrypt authentication, used for user login

func (BasicAuthenticator) Session

func (a BasicAuthenticator) Session() (data.UserRecord, error)

Session attempts to return the user whose session was authenticated via this authenticator

type Error

type Error struct {
	Error string `json:"error"`
}

Error represents an error response from the API

type HMACAuthenticator

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

HMACAuthenticator uses the HMAC-SHA1 authentication scheme, used for API authentication

func (*HMACAuthenticator) Auth

func (a *HMACAuthenticator) Auth(r *http.Request) (error, error)

Auth handles validation of HMAC-SHA1 authentication

func (HMACAuthenticator) Session

func (a HMACAuthenticator) Session() (data.UserRecord, error)

Session attempts to return the user whose session was authenticated via this authenticator

Jump to

Keyboard shortcuts

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