Documentation
¶
Index ¶
Constants ¶
const PROXY_SHUTDOWN_TIMEOUT = 30 * time.Second
TODO: make this configurable?
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func NewDeploymentProxy ¶
Creates a proxy for a given deployment
func (*Proxy) GracefulShutdown ¶
waits for the proxy to be drained of connections within the shutdown timeout, then calls the shutdownFunc (the proxy should be removes or replaced in the ProxyMaager)
type ProxyManager ¶
type ProxyManager struct {
// string -> *Proxy
syncmap.Map
// contains filtered or unexported fields
}
this is the object that oversees the proxying of requests to the correct deployment
func NewProxyManager ¶
func NewProxyManager(RequestLogger RequestLogger) *ProxyManager
func (*ProxyManager) AddProxy ¶
func (proxyManager *ProxyManager) AddProxy(host string, proxy *Proxy)
Starts forwarding traffic to a deployment. The deployment must be ready to recieve requests before this is called.
func (*ProxyManager) ListenAndServe ¶
func (proxyManager *ProxyManager) ListenAndServe(host string) error
func (*ProxyManager) RemoveDeployment ¶
func (proxyManager *ProxyManager) RemoveDeployment(host string)
Stops forwarding traffic to a deployment
func (*ProxyManager) ServeHTTP ¶
func (proxyManager *ProxyManager) ServeHTTP(w http.ResponseWriter, r *http.Request)
This function is responsible for taking an http request and forwarding it to the correct deployment
type RequestLogger ¶
type ResponseWriterInterceptor ¶
type ResponseWriterInterceptor struct {
http.ResponseWriter
// contains filtered or unexported fields
}
ResponseWriterInterceptor is a custom http.ResponseWriter that captures the status code.
func (*ResponseWriterInterceptor) WriteHeader ¶
func (rw *ResponseWriterInterceptor) WriteHeader(code int)