Documentation ¶
Index ¶
Constants ¶
const DefaultTimeout = time.Second * time.Duration(15)
DefaultTimeout is the default timeout value used when a Timeout is not specified in NewProxy.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler func(Result)
Handler is a function alias that can be passed a Result for processing.
type Parameter ¶
type Parameter interface {
// contains filtered or unexported methods
}
Parameter is an interface that helps define config options for the Proxy struct.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is a struct that represents a stacked proxy that allows a forwarding proxy with secondary read only Switch connections that allow logging and storing the connection data.
func New ¶
New creates a new Proxy instance from the specified listen address and optional parameters.
func NewContext ¶
NewContext creates a new Proxy instance from the specified listen address and optional parameters.
This function allows the caller to specify a context to specify when to shut down the Proxy.
func (*Proxy) AddSecondary ¶
AddSecondary adds a one-way Switch context.
func (*Proxy) Close ¶ added in v1.6.0
Close attempts to gracefully close and stop the proxy and all remaining connections.
type Result ¶
type Result struct { Headers http.Header `json:"headers"` IP string `json:"ip"` UUID string `json:"uuid"` Path string `json:"path"` Method string `json:"method"` URL string `json:"url"` Content []byte `json:"content"` Status uint16 `json:"status"` }
Result is a struct that contains the data of the resulting Switch operation to be passed to Handlers.
func (Result) IsResponse ¶
IsResponse is a function that returns true if the Result is for a response.
type Switch ¶
Switch is a struct that represents a connection between proxy services. This struct contains mapping and functions to capture input and output.
func NewSwitch ¶
NewSwitch creates a switching context that allows the connection to be proxied to the specified server.
func NewSwitchTimeout ¶
NewSwitchTimeout creates a switching context that allows the connection to be proxied to the specified server.
This function will set the specified timeout.
func (*Switch) RemoveRewrite ¶
RemoveRewrite removes the URL rewrite from the Switch.