Documentation
¶
Index ¶
Constants ¶
View Source
const BASIC = "Basic"
BASIC is the prefix of basic authorization headers.
Variables ¶
View Source
var ( // ErrEmptyAuthHeader occurs when an authorization header is empty. ErrEmptyAuthHeader = errors.New("authorization header is empty") // ErrAuthHeaderNotBasic occurs when an authorization header is not basic. ErrAuthHeaderNotBasic = errors.New("authorization header type must be \"basic\"") // ErrInvalidAuthHeader occurs when an authorization header is invalid. ErrInvalidAuthHeader = errors.New("invalid authorization header") )
View Source
var ErrInvalidCredentials = errors.New("invalid credentials")
ErrInvalidCredentials occurs when credentials have been provided to an endpoint that are not known to the server.
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials struct { // Username is the Credentials' username. Username string `json:"username,omitempty"` // Password is the Credentials' password. Password string `json:"password,omitempty"` }
Credentials are credentials for interacting with the Server.
type ErrorResponse ¶
type ErrorResponse struct { // Error describes the reason why the request failed. Error string `json:"error,omitempty"` }
ErrorResponse represents a response to a failed request.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
A Server provides a web interface for interacting with a goba.Goba.
func New ¶
func New(goba goba.Goba, validCredentials ...Credentials) *Server
New creates a new configured Server and returns it.
func (Server) ListenAndServe ¶
ListenAndServe serves HTTP requests from the given TCP address.
func (Server) ListenAndServeTLS ¶
ListenAndServeTLS serves HTTP requests from the given TCP address. certFile and keyFile are paths to TLS certificate and key files.
Click to show internal directories.
Click to hide internal directories.