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 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