Versions in this module Expand all Collapse all v1 v1.0.0 Jul 16, 2018 Changes in this version + const BrEncoding + const GzipEncoding + const HeaderAcceptEncoding + const HeaderAge + const HeaderCacheControl + const HeaderContentEncoding + const HeaderContentLength + const HeaderContentType + const HeaderETag + const HeaderIfModifiedSince + const HeaderIfNoneMatch + const HeaderLastModified + const HeaderServerTiming + const HeaderSetCookie + const HeaderXForwardedFor + const HeaderXRealIP + const HeaderXStatus + const JSONContent + const ServerTimingCacheFetcher + const ServerTimingDirectorPicker + const ServerTimingDispatcher + const ServerTimingEnd + const ServerTimingFreshChecker + const ServerTimingHeaderSetter + const ServerTimingIdentifier + const ServerTimingInitialization + const ServerTimingPike + const ServerTimingProxy + var ErrParseBackendURLFail = NewHTTPError(http.StatusNotImplemented, "parse backend url fail") + var ErrTargetURLNotInit = NewHTTPError(http.StatusNotImplemented, "target url is not init") + var NoopNext = func() error + func AddPolicySelectFunc(policy string) (err error) + func AddSelect(name string, fn SelectFunc) + func AddSelectByCookie(name, cookieName string) + func AddSelectByHeader(name, headerField string) + type Context struct + CreatedAt time.Time + Director *Director + Fresh bool + Identity []byte + Request *http.Request + Resp *cache.Response + Response *Response + ResponseWriter http.ResponseWriter + ServerTiming *ServerTiming + Status int + func NewContext(req *http.Request) (c *Context) + func (c *Context) Error(err error) + func (c *Context) JSON(data interface{}, status int) error + func (c *Context) RealIP() string + func (c *Context) Reset() + type Director struct + AvailableBackends []string + Backends []string + Header []string + HeaderMap map[string]string + Hosts []string + Name string + Ping string + Policy string + Prefixs []string + Priority int + RequestHeader []string + RequestHeaderMap map[string]string + RewriteRegexp map[*regexp.Regexp]string + Rewrites []string + TargetURLMap map[string]*url.URL + Transport *http.Transport + func (d *Director) AddAvailableBackend(backend string) + func (d *Director) AddBackend(backend string) + func (d *Director) AddHost(host string) + func (d *Director) AddPrefix(prefix string) + func (d *Director) GenHeaderMap() + func (d *Director) GenRequestHeaderMap() + func (d *Director) GenRewriteRegexp() + func (d *Director) GetAvailableBackends() []string + func (d *Director) GetTargetURL(backend *string) (*url.URL, error) + func (d *Director) HealthCheck() + func (d *Director) Match(host, uri string) (match bool) + func (d *Director) Prepare() + func (d *Director) RefreshPriority() + func (d *Director) RemoveAvailableBackend(backend string) + func (d *Director) RemoveBackend(backend string) + func (d *Director) RemoveHost(host string) + func (d *Director) RemovePrefix(prefix string) + func (d *Director) Select(c *Context) string + func (d *Director) SetTransport(transport *http.Transport) + func (d *Director) StartHealthCheck(interval time.Duration) + type Directors []*Director + func (s Directors) Len() int + func (s Directors) Less(i, j int) bool + func (s Directors) Swap(i, j int) + type ErrorHandler func(error, *Context) + type HTTPError struct + Code int + Internal error + Message interface{} + func NewHTTPError(code int, message ...interface{}) *HTTPError + func (he *HTTPError) Error() string + type Middleware func(*Context, Next) error + type Next func() error + type Pike struct + ErrorHandler ErrorHandler + ReadTimeout time.Duration + WriteTimeout time.Duration + func New() (p *Pike) + func (p *Pike) Close() error + func (p *Pike) DefaultErrorHanddler(err error, c *Context) + func (p *Pike) ListenAndServe(addr string) error + func (p *Pike) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (p *Pike) Use(mids ...Middleware) + type Response struct + Committed bool + func NewResponse() *Response + func (w *Response) Bytes() []byte + func (w *Response) Header() http.Header + func (w *Response) Reset() + func (w *Response) Size() int + func (w *Response) Status() int + func (w *Response) Write(b []byte) (int, error) + func (w *Response) WriteHeader(code int) + type SelectFunc func(*Context, *Director) uint32 + type ServerTiming struct + func NewServerTiming() *ServerTiming + func (st *ServerTiming) Reset() + func (st *ServerTiming) Start(index int) func() + func (st *ServerTiming) String() string