Versions in this module Expand all Collapse all v0 v0.52.5 Dec 8, 2023 v0.52.4 Dec 8, 2023 Changes in this version + const NotFound + var ErrNoRouteFound = errors.New("no route found") + var ErrRouterConfigConflict = errors.New("router config conflict") + var NotFoundPagePath = "" + func GetHTTPSHostname(c net.Conn) (_ net.Conn, _ map[string]string, err error) + func NotFoundResponse() *http.Response + type ByLocation []*Router + func (a ByLocation) Len() int + func (a ByLocation) Less(i, j int) bool + func (a ByLocation) Swap(i, j int) + type ChooseEndpointFunc func() (string, error) + type CreateConnByEndpointFunc func(endpoint, remoteAddr string) (net.Conn, error) + type CreateConnFunc func(remoteAddr string) (net.Conn, error) + type HTTPReverseProxy struct + func NewHTTPReverseProxy(option HTTPReverseProxyOptions, vhostRouter *Routers) *HTTPReverseProxy + func (rp *HTTPReverseProxy) CheckAuth(domain, location, routeByHTTPUser, user, passwd string) bool + func (rp *HTTPReverseProxy) CreateConnection(reqRouteInfo *RequestRouteInfo, byEndpoint bool) (net.Conn, error) + func (rp *HTTPReverseProxy) GetHeaders(domain, location, routeByHTTPUser string) (headers map[string]string) + func (rp *HTTPReverseProxy) GetRouteConfig(domain, location, routeByHTTPUser string) *RouteConfig + func (rp *HTTPReverseProxy) Register(routeCfg RouteConfig) error + func (rp *HTTPReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) + func (rp *HTTPReverseProxy) UnRegister(routeCfg RouteConfig) + 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, timeout time.Duration) (mux *Muxer, err error) + func (v *Muxer) Listen(ctx context.Context, cfg *RouteConfig) (l *Listener, err error) + func (v *Muxer) SetCheckAuthFunc(f authFunc) *Muxer + func (v *Muxer) SetFailHookFunc(f failHookFunc) *Muxer + func (v *Muxer) SetRewriteHostFunc(f hostRewriteFunc) *Muxer + func (v *Muxer) SetSuccessHookFunc(f successHookFunc) *Muxer + type RequestRouteInfo struct + Endpoint string + HTTPUser string + Host string + RemoteAddr string + URL string + URLHost string + type RouteConfig struct + ChooseEndpointFn ChooseEndpointFunc + CreateConnByEndpointFn CreateConnByEndpointFunc + CreateConnFn CreateConnFunc + Domain string + Headers map[string]string + Location string + Password string + RewriteHost string + RouteByHTTPUser string + Username string + type RouteInfo string + const RouteInfoKey + type Router struct + type Routers struct + func NewRouters() *Routers + func (r *Routers) Add(domain, location, httpUser string, payload interface{}) error + func (r *Routers) Del(domain, location, httpUser string) + func (r *Routers) Get(host, path, httpUser string) (vr *Router, exist bool)