Documentation
¶
Index ¶
Constants ¶
const ( // DefaultTimeout is the default timeout value used when a Timeout is not // specified in NewProxy. DefaultTimeout = time.Second * time.Duration(15) )
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 shutdown the Proxy.
func (*Proxy) AddSecondary ¶
AddSecondary adds an additional one-way Switch context.
func (*Proxy) ServeHTTP ¶
func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP satisfies the http.Handler interface.
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.