Versions in this module Expand all Collapse all v1 v1.0.0 Apr 9, 2022 Changes in this version + const NotFound + var ErrNoDomain = errors.New("no such domain") + var ErrRouterConfigConflict = errors.New("router config conflict") + var NotFoundPagePath = "" + func GetHTTPSHostname(c net.Conn) (_ net.Conn, _ map[string]string, err error) + type BufferPool interface + Get func() []byte + Put func([]byte) + type ByLocation []*Router + func (a ByLocation) Len() int + func (a ByLocation) Less(i, j int) bool + func (a ByLocation) Swap(i, j int) + type CreateConnFunc func(remoteAddr string) (net.Conn, error) + type HTTPReverseProxy struct + func NewHTTPReverseProxy(option HTTPReverseProxyOptions, vhostRouter *Routers) *HTTPReverseProxy + func (rp *HTTPReverseProxy) CheckAuth(domain, location, user, passwd string) bool + func (rp *HTTPReverseProxy) CreateConnection(domain string, location string, remoteAddr string) (net.Conn, error) + func (rp *HTTPReverseProxy) GetHeaders(domain string, location string) (headers map[string]string) + func (rp *HTTPReverseProxy) GetRealHost(domain string, location string) (host string) + func (rp *HTTPReverseProxy) GetRouteConfig(domain string, location string) *RouteConfig + func (rp *HTTPReverseProxy) Register(routeCfg RouteConfig) error + func (rp *HTTPReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) + func (rp *HTTPReverseProxy) UnRegister(domain string, location string) + type HTTPReverseProxyOptions struct + ResponseHeaderTimeoutS int64 + type HTTPSMuxer struct + func NewHTTPSMuxer(listener net.Listener, timeout time.Duration) (*HTTPSMuxer, error) + type Listener struct + func (l *Listener) Accept() (net.Conn, error) + func (l *Listener) Addr() net.Addr + func (l *Listener) Close() error + func (l *Listener) Name() string + type Muxer struct + func NewMuxer(listener net.Listener, vhostFunc muxFunc, authFunc httpAuthFunc, ...) (mux *Muxer, err error) + func (v *Muxer) Listen(ctx context.Context, cfg *RouteConfig) (l *Listener, err error) + type ReverseProxy struct + BufferPool BufferPool + Director func(*http.Request) + ErrorHandler func(http.ResponseWriter, *http.Request, error) + ErrorLog *log.Logger + FlushInterval time.Duration + ModifyResponse func(*http.Response) error + Transport http.RoundTripper + func NewSingleHostReverseProxy(target *url.URL) *ReverseProxy + func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) + type RouteConfig struct + CreateConnFn CreateConnFunc + Domain string + Headers map[string]string + Location string + Password string + RewriteHost string + Username string + type RouteInfo string + const RouteInfoHost + const RouteInfoRemote + const RouteInfoURL + type Router struct + type Routers struct + RouterByDomain map[string][]*Router + func NewRouters() *Routers + func (r *Routers) Add(domain, location string, payload interface{}) error + func (r *Routers) Del(domain, location string) + func (r *Routers) Get(host, path string) (vr *Router, exist bool)