Documentation
¶
Index ¶
- type AddrPool
- type Auth
- type HTTPProxy
- type HostAuth
- type Pooler
- type RegistryItem
- type RemoteID
- type Server
- func (s *Server) Addr() string
- func (r Server) GetID(cname string) string
- func (s *Server) Ping(identifier string) (time.Duration, error)
- func (r Server) PreSubscribe(origaddr string)
- func (s *Server) RoundTrip(r *http.Request) (*http.Response, error)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) Start()
- func (s *Server) Stop()
- func (r Server) Subscribe(cname string, origaddr string)
- func (r Server) Subscriber(hostPort string) (string, *Auth, bool)
- func (s *Server) Unsubscribe(identifier string, idname string) *RegistryItem
- type ServerConfig
- type TCPProxy
- type TunnelExt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddrPool ¶
type AddrPool struct {
// contains filtered or unexported fields
}
func (*AddrPool) GetHTTPPort ¶ added in v0.3.0
GetHTTPPort retrieves port for given node id http tunnel
type HTTPProxy ¶
type HTTPProxy struct { httputil.ReverseProxy // contains filtered or unexported fields }
HTTPProxy forwards HTTP traffic.
func NewHTTPProxy ¶
NewHTTPProxy creates a new direct HTTPProxy, everything will be proxied to localURL.
func NewMultiHTTPProxy ¶
NewMultiHTTPProxy creates a new dispatching HTTPProxy, requests may go to different backends based on localURLMap.
func (*HTTPProxy) Director ¶
Director is ReverseProxy Director it changes request URL so that the request is correctly routed based on localURL and localURLMap. If no URL can be found the request is canceled.
func (*HTTPProxy) Proxy ¶
func (p *HTTPProxy) Proxy(w io.Writer, r io.ReadCloser, msg *proto.ControlMessage)
Proxy is a ProxyFunc.
type RegistryItem ¶
type RegistryItem struct { Hosts []*HostAuth Listeners []net.Listener ListenerNames []string ClientName string ClientID string }
RegistryItem holds information about hosts and listeners associated with a client.
type Server ¶
type Server struct { PortPool Pooler // contains filtered or unexported fields }
Server is responsible for proxying public connections to the client over a tunnel connection.
func NewServer ¶
func NewServer(config *ServerConfig) (*Server, error)
NewServer creates a new Server based on configuration. Caller must invoke Start() on returned instance in order to start server
func (Server) PreSubscribe ¶
func (r Server) PreSubscribe(origaddr string)
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP proxies http connection to the client.
func (*Server) Start ¶
func (s *Server) Start()
Start starts accepting connections form clients. For accepting http traffic from end users server must be run as handler on http server.
func (Server) Subscriber ¶
Subscriber returns client identifier assigned to given host.
func (*Server) Unsubscribe ¶
func (s *Server) Unsubscribe(identifier string, idname string) *RegistryItem
Unsubscribe removes client from registry, disconnects client if already connected and returns it's RegistryItem.
type ServerConfig ¶
type ServerConfig struct { // Address is TCP address to listen for client connections. If empty ":0" is used. Address string // PortPool assigns and release ports PortPool Pooler // AuthHandler is function validates provided auth token AuthHandler func(string) bool // Logger is optional logger. If nil logging is disabled. Logger *log.Entry }
ServerConfig defines all data needed for running the Server.
type TCPProxy ¶
type TCPProxy struct {
// contains filtered or unexported fields
}
TCPProxy forwards TCP streams.
func NewMultiTCPProxy ¶
NewMultiTCPProxy creates a new dispatching TCPProxy, connections may go to different backends based on localAddrMap.
func NewTCPProxy ¶
NewTCPProxy creates new direct TCPProxy, everything will be proxied to localAddr.
func (*TCPProxy) Proxy ¶
func (p *TCPProxy) Proxy(w io.Writer, r io.ReadCloser, msg *proto.ControlMessage)
Proxy is a ProxyFunc.