Documentation ¶
Index ¶
- Variables
- func HandleHTTP(relay *Relay) http.HandlerFunc
- type Logger
- type Metrics
- type ProxyType
- type Relay
- func (r *Relay) Close() error
- func (r *Relay) ListenServe() error
- func (r *Relay) Running() bool
- func (r *Relay) Serve(l net.Listener) error
- func (r *Relay) SetClient(client *http.Client)
- func (r *Relay) SetHTTP(server http.Server) error
- func (r *Relay) SetProxy(dialer ...*proxy.Dialer)
- func (r *Relay) SetTLS(certificateFile, keyFile string)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownProxyType is returned when a relay has a proxy type which is invalid ErrUnknownProxyType = errors.New("unknown proxytype used in creation of relay") // ErrAddrNotMatch is returned when a server object has a addr which is not nil // and does not equal the relay's address ErrAddrNotMatch = errors.New("addr does not match the relays host address") )
Functions ¶
func HandleHTTP ¶
func HandleHTTP(relay *Relay) http.HandlerFunc
HandleHTTP is to be used as the HTTP relay's handler set in the http.Server object
Types ¶
type Logger ¶
Logger is used for logging debug information such as connections being created, dropped etc
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics stores information such as bandwidth usage conn stats etc
func (*Metrics) Connections ¶
Connections returns the amount of active and total connections
func (*Metrics) DialerAvg ¶
DialerAvg returns the 10 point average dial time this average includes failed dials
type ProxyType ¶
type ProxyType uint8
ProxyType represents what type of proxy the relay is.
Raw TCP is used for just forwarding the raw connection to the remote address.
type Relay ¶
type Relay struct { // Name is a generic name which can be assigned to this relay Name string // Host is the address to listen on Host string // ForwardAddr is the destination to send the connection ForwardAddr string // ProxyType is used to forward or manipulate the connection ProxyType ProxyType // Metrics is used to store information such as upload/download // and other statistics *Metrics // contains filtered or unexported fields }
Relay represents a reverse proxy and all of its settings
func (*Relay) ListenServe ¶
ListenServe will start a listener and handle the incoming requests
func (*Relay) SetHTTP ¶
SetHTTP is used to set the relay as a type HTTP relay addr will auto be set in the server object if left blank