Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminAuthMiddleware ¶
func AdminAuthMiddleware(ct CheckToken) func(http.Handler) http.Handler
AdminAuthMiddleware will return HTTP middleware that will authenticate a user is authenticated and has proper permissions.
Types ¶
type CheckToken ¶
CheckToken is a function that is used by the AdminAuthMiddleware to check a given token
type RateStore ¶
RateStore is the interface from which the server will get rates to be rendered via HTTP in JSON.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles setting up an HTTP server and servicing HTTP requests.
func NewServer ¶
func NewServer( port uint16, ct CheckToken, rs RateStore, rateInterval time.Duration, opts ...ServerOption, ) *Server
NewServer opens a TCP listener and returns an initialized Server.
type ServerOption ¶
type ServerOption func(*Server)
ServerOption is a function that can be passed to the server initializer to configure optional settings.
func WithLogWriter ¶
func WithLogWriter(w io.Writer) ServerOption
WithLogWriter will override the logger used for HTTP logs.
Click to show internal directories.
Click to hide internal directories.