Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrListenerClosed = errors.New("revdial: Listener closed")
ErrListenerClosed is returned by Accept after Close has been called.
Functions ¶
This section is empty.
Types ¶
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
The Dialer can create new connections back to the origin. A Dialer can have multiple clients.
func NewDialer ¶
NewDialer returns the side of the connection which will initiate new connections over the already established reverse connections.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is a net.Listener, returning new connections which arrive from a corresponding Dialer.
func NewListener ¶
NewListener returns a new Listener, it dials to the Dialer creating "reverse connection" that are accepted by this Listener. - client: http client, required for TLS - host: a URL to the base of the reverse handler on the Dialer - id: identify this listener
type ReversePool ¶
type ReversePool struct {
// contains filtered or unexported fields
}
ReversePool contains a pool of Dialers to create reverse connections It exposes an http.Handler to handle the clients.
pool := h2rev2.NewReversePool() mux := http.NewServeMux() mux.Handle("", pool)
func (*ReversePool) Close ¶
func (rp *ReversePool) Close()
Close the Reverse pool and all its dialers
func (*ReversePool) CreateDialer ¶
func (rp *ReversePool) CreateDialer(id string, conn net.Conn) *Dialer
CreateDialer creates a reverse dialer with id it's a noop if a dialer already exists
func (*ReversePool) DeleteDialer ¶
func (rp *ReversePool) DeleteDialer(id string)
DeleteDialer delete the reverse dialer for the id
func (*ReversePool) GetDialer ¶
func (rp *ReversePool) GetDialer(id string) *Dialer
GetDialer returns a reverse dialer for the id
func (*ReversePool) ServeHTTP ¶
func (rp *ReversePool) ServeHTTP(w http.ResponseWriter, r *http.Request)
HTTP Handler that handles reverse connections and reverse proxy requests using 2 different paths: path base/revdial?key=id establish reverse connections and queue them so it can be consumed by the dialer path base/proxy/id/(path) proxies the (path) through the reverse connection identified by id