Documentation ¶
Index ¶
Constants ¶
View Source
const (
// StickyCookieName is the name of the sticky cookie
StickyCookieName = "_backend"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendListFunc ¶
BackendListFunc returns a slice of backends
type RequestTrace ¶
type RequestTrace struct { Backend *router.Backend ReusedConn bool WasIdleConn bool ConnectStart time.Time ConnectDone time.Time HeadersWritten time.Time BodyWritten time.Time FirstByte time.Time // contains filtered or unexported fields }
func (*RequestTrace) Finalize ¶
func (r *RequestTrace) Finalize(backend *router.Backend)
Finalize safely finalizes the trace for read access.
type RequestTracker ¶
type ReverseProxy ¶
type ReverseProxy struct { // FlushInterval specifies the flush interval // to flush to the client while copying the // response body. // If zero, no periodic flushing is done. FlushInterval time.Duration RequestTracker RequestTracker // Logger is the logger for the proxy. Logger log15.Logger Error503Page []byte // contains filtered or unexported fields }
ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.
func NewReverseProxy ¶
func NewReverseProxy(c ReverseProxyConfig) *ReverseProxy
NewReverseProxy initializes a new ReverseProxy with a callback to get backends, a stickyKey for encrypting sticky session cookies, and a flag sticky to enable sticky sessions.
func (*ReverseProxy) ServeConn ¶
func (p *ReverseProxy) ServeConn(ctx context.Context, dconn net.Conn)
ServeConn takes an inbound conn and proxies it to a backend.
func (*ReverseProxy) ServeHTTP ¶
func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP implements http.Handler.
type ReverseProxyConfig ¶
type ReverseProxyConfig struct { BackendListFunc BackendListFunc StickyKey *[32]byte Sticky bool DisableKeepAlives bool RequestTracker RequestTracker Logger log15.Logger }
ReverseProxyConfig is used to initialise a ReverseProxy struct
Click to show internal directories.
Click to hide internal directories.