Documentation ¶
Index ¶
- Variables
- func GetConn(r *http.Request) net.Conn
- func GetConnUnwarpTLS(r *http.Request) net.Conn
- func SaveConnInContext(ctx context.Context, c net.Conn) context.Context
- func SupportAltSvc(useragent string) bool
- type ClientCommonConf
- type CloseReader
- type CloseWriter
- type HTTPProxy
- func (hp *HTTPProxy) Auth(req *http.Request, header string) bool
- func (hp *HTTPProxy) ConnectHandler(rw http.ResponseWriter, req *http.Request)
- func (hp *HTTPProxy) HTTPHandler(rw http.ResponseWriter, req *http.Request)
- func (hp *HTTPProxy) InfoHandler(rw http.ResponseWriter, req *http.Request)
- func (hp *HTTPProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- type HTTPService
- type HTTPServiceConf
- type Server
- func (s *Server) AddService(svc *ServiceInfo) (*ServiceInfo, error)
- func (s *Server) DelService(name string) error
- func (s *Server) DeleteService(c *gin.Context)
- func (s *Server) GetServiceByName(c *gin.Context)
- func (s *Server) GetServices(c *gin.Context)
- func (s *Server) ListenAndServe(addr string, tls *tls.Config, useProxyProto bool) error
- func (s *Server) PostService(c *gin.Context)
- func (s *Server) PutService(c *gin.Context)
- func (s *Server) PutServiceExposedAddr(c *gin.Context)
- func (s *Server) PutServiceProxyAddr(c *gin.Context)
- func (s *Server) Shutdown()
- func (s *Server) UpdateService(name string, svc *ServiceInfo) (*ServiceInfo, error)
- type Service
- type ServiceClient
- type ServiceConf
- type ServiceInfo
- type ServiceReflector
- func (r *ServiceReflector) GetServiceInfo() ServiceInfo
- func (r *ServiceReflector) Handle(conn net.Conn) error
- func (r *ServiceReflector) Listen() error
- func (r *ServiceReflector) Rename(name string) ServiceInfo
- func (r *ServiceReflector) Running() bool
- func (r *ServiceReflector) Serve()
- func (r *ServiceReflector) Stop() error
- func (r *ServiceReflector) UpdateAddr(exposedAddr *string, proxyAddr *string)
- type SvcInitConn
- type SvcInitMuxListenChanPair
- type TimedService
Constants ¶
This section is empty.
Variables ¶
View Source
var ConnContextKey = &contextKey{"http-conn"}
View Source
var (
ErrorServiceNotFound = errors.New("Service is not found")
)
Functions ¶
func SupportAltSvc ¶
Types ¶
type ClientCommonConf ¶
type ClientCommonConf struct { // ServerAddr specifies the address of the server to connect to. By // default, this value is "http://0.0.0.0:7001". Server string `ini:"server" json:"server"` // SkipTLSVerify willl skip the check of TLS certificates. SkipTLSVerify bool `ini:"skip_verify" json:"skip_verify"` // HeartBeatInterval specifies at what interval heartbeats are sent to the // server, in seconds. It is not recommended to change this value. By // default, this value is 30. HeartbeatInterval int64 `ini:"heartbeat_interval" json:"heartbeat_interval"` // HeartBeatTimeout specifies the maximum allowed heartbeat response delay // before the connection is terminated, in seconds. It is not recommended // to change this value. By default, this value is 90. HeartbeatTimeout int64 `ini:"heartbeat_timeout" json:"heartbeat_timeout"` }
func GetDefaultClientConf ¶
func GetDefaultClientConf() ClientCommonConf
type CloseReader ¶
type CloseReader interface {
CloseRead() error
}
type CloseWriter ¶
type CloseWriter interface {
CloseWrite() error
}
type HTTPProxy ¶
type HTTPProxy struct {
// contains filtered or unexported fields
}
func NewHTTPProxy ¶ added in v0.2.0
func (*HTTPProxy) ConnectHandler ¶
func (hp *HTTPProxy) ConnectHandler(rw http.ResponseWriter, req *http.Request)
deprecated Hijack needs to SetReadDeadline on the Conn of the request, but if we use stream compression here, we may always get i/o timeout error.
func (*HTTPProxy) HTTPHandler ¶
func (hp *HTTPProxy) HTTPHandler(rw http.ResponseWriter, req *http.Request)
func (*HTTPProxy) InfoHandler ¶
func (hp *HTTPProxy) InfoHandler(rw http.ResponseWriter, req *http.Request)
type HTTPService ¶
type HTTPService struct { *Service // contains filtered or unexported fields }
func (*HTTPService) ModifyResponse ¶
func (s *HTTPService) ModifyResponse(r *http.Response) error
func (*HTTPService) ServeHTTP ¶
func (s *HTTPService) ServeHTTP(w http.ResponseWriter, r *http.Request)
HTTP Reverse Proxy Handler
func (*HTTPService) Shutdown ¶
func (s *HTTPService) Shutdown() error
type HTTPServiceConf ¶
type HTTPServiceConf struct { Hostname string `ini:"http_hostname"` Username string `ini:"http_username"` Password string `ini:"http_password"` CacheTime int `ini:"http_cache_time"` AltSvc bool `ini:"http_altsvc"` DDNSDomain string `ini:"http_ddns_domain"` NIPDomain string `ini:"http_nip_domain"` Backend string `ini:"http_backend"` ChainProxy string `ini:"http_proxy_chain"` TLSCert string `ini:"https_crt"` TLSKey string `ini:"https_key"` ProxyInsecure bool `ini:"https_proxy_skip_cert_verification"` }
type Server ¶
func (*Server) AddService ¶
func (s *Server) AddService(svc *ServiceInfo) (*ServiceInfo, error)
func (*Server) DelService ¶
func (*Server) DeleteService ¶
func (*Server) GetServiceByName ¶
func (*Server) GetServices ¶
func (*Server) ListenAndServe ¶
func (*Server) PostService ¶
func (*Server) PutService ¶
func (*Server) PutServiceExposedAddr ¶
func (*Server) PutServiceProxyAddr ¶
func (*Server) UpdateService ¶
func (s *Server) UpdateService(name string, svc *ServiceInfo) (*ServiceInfo, error)
type Service ¶
type Service struct { ServiceInfo Cfg ServiceConf // contains filtered or unexported fields }
func NewService ¶
func NewService(name string, cfg ServiceConf) *Service
func (*Service) ListenAndServe ¶
type ServiceClient ¶
type ServiceClient struct {
// contains filtered or unexported fields
}
func NewServiceClient ¶
func NewServiceClient(svc *Service, clientCfg *ClientCommonConf) *ServiceClient
func (*ServiceClient) DialBindAddr ¶
func (c *ServiceClient) DialBindAddr(_ context.Context, network string, addr string) (net.Conn, error)
Use the binded address to dial
func (*ServiceClient) DialProxyAddr ¶
func (c *ServiceClient) DialProxyAddr(_ context.Context, network string, addr string) (net.Conn, error)
Use the binded address to dial
func (*ServiceClient) Start ¶
func (c *ServiceClient) Start(force bool) error
func (*ServiceClient) Stop ¶
func (c *ServiceClient) Stop() error
type ServiceConf ¶
type ServiceConf struct { Name string `ini:"-" json:"name"` Scheme string `ini:"type" json:"type"` LocalAddr string `ini:"local_ip" json:"local_ip"` LocalPort uint16 `ini:"local_port" json:"local_port"` BindAddr string `ini:"bind_addr" json:"bind_addr"` BindPort uint16 `ini:"bind_port" json:"bind_port"` RemoteAddr string `ini:"remote_addr" json:"remote_addr"` RemotePort uint16 `ini:"remote_port" json:"remote_port"` HTTPServiceConf `ini:",extends"` }
func GetDefaultServiceConf ¶
func GetDefaultServiceConf() ServiceConf
type ServiceInfo ¶
type ServiceInfo struct { Name string `json:"name" binding:"required"` RemoteAddr string `json:"remote_addr,omitempty"` ExposedAddr string `json:"exposed_addr,omitempty"` // address for direct connection ProxyAddr string `json:"proxy_addr,omitempty"` // address for proxy_protocol Scheme string `json:"scheme" binding:"required"` Hostnames []string `json:"hostnames,omitempty"` // binding hostname if scheme is supported }
type ServiceReflector ¶
type ServiceReflector struct {
// contains filtered or unexported fields
}
ServiceReflector is the implementation on Server-side.
func NewServiceReflector ¶
func NewServiceReflector(info *ServiceInfo) *ServiceReflector
func (*ServiceReflector) GetServiceInfo ¶
func (r *ServiceReflector) GetServiceInfo() ServiceInfo
func (*ServiceReflector) Handle ¶
func (r *ServiceReflector) Handle(conn net.Conn) error
Handle an client request
func (*ServiceReflector) Listen ¶
func (r *ServiceReflector) Listen() error
func (*ServiceReflector) Rename ¶
func (r *ServiceReflector) Rename(name string) ServiceInfo
func (*ServiceReflector) Running ¶
func (r *ServiceReflector) Running() bool
func (*ServiceReflector) Serve ¶
func (r *ServiceReflector) Serve()
func (*ServiceReflector) Stop ¶
func (r *ServiceReflector) Stop() error
func (*ServiceReflector) UpdateAddr ¶
func (r *ServiceReflector) UpdateAddr(exposedAddr *string, proxyAddr *string)
type SvcInitConn ¶
type SvcInitMuxListenChanPair ¶
type SvcInitMuxListenChanPair struct { Conn *SvcInitConn Err error }
type TimedService ¶
type TimedService struct { *ServiceReflector // contains filtered or unexported fields }
ServiceInfo is a service wrapper
func (TimedService) GetServiceInfoForOutput ¶ added in v0.2.0
func (svc TimedService) GetServiceInfoForOutput() ServiceInfo
GetServiceInfoForOutput filters fields for output
func (TimedService) Stop ¶ added in v0.2.0
func (svc TimedService) Stop() error
func (TimedService) Timeout ¶
func (svc TimedService) Timeout(s *Server)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.