Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EndpointsHandler ¶
func EndpointsHandler(srv *HailoServer) http.HandlerFunc
EndpointsHandler serves up app-pinning configuration to apps
func Handler ¶
func Handler(srv *HailoServer) http.HandlerFunc
Handler will handle an HTTP request, deciding what to do with it
func RpcHandler ¶
func RpcHandler(srv *HailoServer) http.HandlerFunc
RpcHandler will handle an HTTP request to /rpc (specifically H2 RPC)
Types ¶
type CORSHandler ¶
func (*CORSHandler) ServeHTTP ¶
func (h *CORSHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type HailoServer ¶
type HailoServer struct { Tomb *ptomb.Tomb // used to kill the server CORSHandler *CORSHandler HTTPServer *http.Server RealIPHandler *RealIPHandler ThrottlingHandler *ThrottlingHandler Control *controlplane.ControlPlane Monitor *statusmonitor.StatusMonitor }
func NewServer ¶
func NewServer(accessLogWriter io.Writer) *HailoServer
Creates a new server, with the correct timeouts, throttling, etc.
func (*HailoServer) Kill ¶
func (h *HailoServer) Kill(reason error)
type PCIFilter ¶
func NewPCIFilter ¶
func NewPCIFilter(h http.Handler, srv *HailoServer) *PCIFilter
func (*PCIFilter) IsSensitiveRequest ¶
type RealIPHandler ¶
RealIPHandler ensures that the request's RemoteAddr field is correctly populated with the actual client's IP address, rather than that of any intermediary.
func (*RealIPHandler) ServeHTTP ¶
func (h *RealIPHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type ThrottlingHandler ¶
A ThrottlingHandler is a decorator around another HTTP handler that implements our API throttling behaviour. It buckets inbound requests, records statistics about request volume to each bucket, and throttles full buckets. If a request is throttled, it will proceed no further up the handler chain.
func NewThrottlingHandler ¶
func NewThrottlingHandler(h http.Handler, srv *HailoServer) *ThrottlingHandler
func (*ThrottlingHandler) ServeHTTP ¶
func (t *ThrottlingHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)