web

package
v0.0.0-...-98b9f36 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Home

func Home() http.HandlerFunc

Home handler is just a nice home page message

func NewOverviewHandler

func NewOverviewHandler(cfgs *api.Configuration) func(w http.ResponseWriter, r *http.Request)

NewOverviewHandler creates instance of all status checks handler

func NewStatusHandler

func NewStatusHandler(cfgs *api.Configuration) func(w http.ResponseWriter, r *http.Request)

NewStatusHandler creates instance of single proxy status check handler

func RedirectHTTPS

func RedirectHTTPS(port int) http.HandlerFunc

RedirectHTTPS redirects an http request to https

Types

type APIHandler

type APIHandler struct {
	Cfgs *api.Configuration
	// contains filtered or unexported fields
}

APIHandler is the api rest controller

func NewAPIHandler

func NewAPIHandler(cfgChan chan<- api.ConfigurationMessage) *APIHandler

NewAPIHandler creates a new instance of Controller

func (*APIHandler) DeleteBy

func (c *APIHandler) DeleteBy() http.HandlerFunc

DeleteBy is the delete handler

func (*APIHandler) Get

func (c *APIHandler) Get() http.HandlerFunc

Get is the find all handler

func (*APIHandler) GetBy

func (c *APIHandler) GetBy() http.HandlerFunc

GetBy is the find by handler

func (*APIHandler) Post

func (c *APIHandler) Post() http.HandlerFunc

Post is the create handler

func (*APIHandler) PutBy

func (c *APIHandler) PutBy() http.HandlerFunc

PutBy is the update handler

type Option

type Option func(*Server)

Option represents the available options

func WithConfigurations

func WithConfigurations(cfgs *api.Configuration) Option

WithConfigurations sets the current configurations in memory

func WithCredentials

func WithCredentials(cred config.Credentials) Option

WithCredentials sets the credentials for the server

func WithPort

func WithPort(port int) Option

WithPort sets the server port

func WithProfiler

func WithProfiler(enabled, public bool) Option

WithProfiler enables or disables profiler

func WithTLS

func WithTLS(tls config.TLS) Option

WithTLS sets the TLS configs for the server

type Server

type Server struct {
	Port              int
	Credentials       config.Credentials
	TLS               config.TLS
	ConfigurationChan chan api.ConfigurationMessage
	// contains filtered or unexported fields
}

Server represents the web server

func New

func New(opts ...Option) *Server

New creates a new web server

func (*Server) AddRoutes

func (s *Server) AddRoutes(r router.Router)

AddRoutes adds the admin routes

func (*Server) Start

func (s *Server) Start() error

Start creates a router and serves requests async

func (*Server) Stop

func (s *Server) Stop()

Stop stops the server

Jump to

Keyboard shortcuts

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