Documentation
¶
Index ¶
- Constants
- Variables
- func GetHTTPSHostname(c net.Conn) (_ net.Conn, _ map[string]string, err error)
- type ByLocation
- type ChooseEndpointFunc
- type CreateConnByEndpointFunc
- type CreateConnFunc
- type 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
- type HTTPSMuxer
- type Listener
- type Muxer
- type RequestRouteInfo
- type RouteConfig
- type RouteInfo
- type Router
- type Routers
Constants ¶
View Source
const (
NotFound = `` /* 489-byte string literal not displayed */
)
Variables ¶
View Source
var ErrNoRouteFound = errors.New("no route found")
View Source
var ErrRouterConfigConflict = errors.New("router config conflict")
View Source
var NotFoundPagePath = ""
Functions ¶
Types ¶
type ByLocation ¶
type ByLocation []*Router
sort by location
func (ByLocation) Len ¶
func (a ByLocation) Len() int
func (ByLocation) Less ¶
func (a ByLocation) Less(i, j int) bool
func (ByLocation) Swap ¶
func (a ByLocation) Swap(i, j int)
type ChooseEndpointFunc ¶ added in v0.45.0
type CreateConnByEndpointFunc ¶ added in v0.45.0
type HTTPReverseProxy ¶
type HTTPReverseProxy struct {
// contains filtered or unexported fields
}
func NewHTTPReverseProxy ¶
func NewHTTPReverseProxy(option HTTPReverseProxyOptions, vhostRouter *Routers) *HTTPReverseProxy
func (*HTTPReverseProxy) CheckAuth ¶
func (rp *HTTPReverseProxy) CheckAuth(domain, location, routeByHTTPUser, user, passwd string) bool
func (*HTTPReverseProxy) CreateConnection ¶
func (rp *HTTPReverseProxy) CreateConnection(reqRouteInfo *RequestRouteInfo, byEndpoint bool) (net.Conn, error)
CreateConnection create a new connection by route config
func (*HTTPReverseProxy) GetHeaders ¶
func (rp *HTTPReverseProxy) GetHeaders(domain, location, routeByHTTPUser string) (headers map[string]string)
func (*HTTPReverseProxy) GetRouteConfig ¶ added in v0.35.0
func (rp *HTTPReverseProxy) GetRouteConfig(domain, location, routeByHTTPUser string) *RouteConfig
func (*HTTPReverseProxy) Register ¶
func (rp *HTTPReverseProxy) Register(routeCfg RouteConfig) error
Register register the route config to reverse proxy reverse proxy will use CreateConnFn from routeCfg to create a connection to the remote service
func (*HTTPReverseProxy) ServeHTTP ¶
func (rp *HTTPReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)
func (*HTTPReverseProxy) UnRegister ¶
func (rp *HTTPReverseProxy) UnRegister(routeCfg RouteConfig)
UnRegister unregister route config by domain and location
type HTTPReverseProxyOptions ¶
type HTTPReverseProxyOptions struct {
ResponseHeaderTimeoutS int64
}
type Muxer ¶
type Muxer struct {
// contains filtered or unexported fields
}
Muxer is only used for https and tcpmux proxy.
type RequestRouteInfo ¶ added in v0.45.0
type RouteConfig ¶
type RouteConfig struct {
Domain string
Location string
RewriteHost string
Username string
Password string
Headers map[string]string
RouteByHTTPUser string
CreateConnFn CreateConnFunc
ChooseEndpointFn ChooseEndpointFunc
CreateConnByEndpointFn CreateConnByEndpointFunc
}
RouteConfig is the params used to match HTTP requests
Click to show internal directories.
Click to hide internal directories.