Documentation ¶
Overview ¶
Package protocol contains all of the available protocols: TCP, HTTP and the HTTP reverse proxy component.
All protocols support plugins (e.g. Middlewares and Symptoms) to interfere with their behaviour.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FilterFunc ¶
FilterFunc is a function that is called to process a proxy response Since it has handle to the response object, it can manipulate the content
type HTTPProxy ¶ added in v0.0.3
type HTTPProxy struct { Port int `required:"true"` Host string `required:"true" default:"localhost"` Protocol string `default:"http" required:"true"` ProxyHost string `required:"true" mapstructure:"proxy_host"` ProxyPort int `required:"true" mapstructure:"proxy_port"` ProxyProtocol string `required:"true" default:"http" mapstructure:"proxy_protocol"` Insecure bool `required:"true" default:"false" mapstructure:"insecure"` ProxySslCertificate string `required:"false" mapstructure:"proxy_ssl_cert"` ProxySslKey string `required:"false" mapstructure:"proxy_ssl_key"` ProxyClientSslCert string `required:"false" mapstructure:"proxy_client_ssl_cert"` ProxyClientSslKey string `required:"false" mapstructure:"proxy_client_ssl_key"` ProxyClientSslCa string `required:"false" mapstructure:"proxy_client_ssl_ca"` ProxyRules []ProxyRule `required:"false" mapstructure:"proxy_rules"` // contains filtered or unexported fields }
HTTPProxy implements the proxy interface for the HTTP protocol
func (*HTTPProxy) ApplyProxyPassRule ¶ added in v0.0.4
ApplyProxyPassRule applies ProxyPass rules to the outbond request from the reverse proxy
func (*HTTPProxy) Proxy ¶ added in v0.0.3
func (p *HTTPProxy) Proxy()
Proxy performs the proxy event
func (*HTTPProxy) Setup ¶ added in v0.0.3
func (p *HTTPProxy) Setup(middleware []muxy.Middleware)
Setup sets up the middleware
type ProxyPass ¶ added in v0.0.4
type ProxyPass struct { Method string Path string Host string // Scheme is one of http or https Scheme string }
ProxyPass contains details of the HTTP request to send to the downstream proxy target
type ProxyRequest ¶ added in v0.0.4
ProxyRequest contains details of the HTTP request to match to determine if the proxy rule should fire
type ProxyRule ¶ added in v0.0.4
type ProxyRule struct { Request ProxyRequest Pass ProxyPass }
ProxyRule contains the rules for proxying a target HTTP system
type ReverseProxy ¶
type ReverseProxy struct { // Director must be a function which modifies // the request into a new request to be sent // using Transport. Its response is then copied // back to the original client unmodified. Director func(*http.Request) // Filters must be an array of functions which modify // the response before the body is written Middleware []muxy.Middleware // The transport used to perform proxy requests. // If nil, http.DefaultTransport is used. Transport http.RoundTripper // FlushInterval specifies the flush interval // to flush to the client while copying the // response body. // If zero, no periodic flushing is done. FlushInterval time.Duration }
ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.
func NewSingleHostReverseProxy ¶
func NewSingleHostReverseProxy(target *url.URL) *ReverseProxy
NewSingleHostReverseProxy returns a new ReverseProxy that rewrites URLs to the scheme, host, and base path provided in target. If the target's path is "/base" and the incoming request was for "/dir", the target request will be for /base/dir.
func (*ReverseProxy) ServeHTTP ¶
func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type TCPProxy ¶ added in v0.0.3
type TCPProxy struct { Port int `required:"true"` Host string `required:"true" default:"localhost"` ProxyHost string `required:"true" mapstructure:"proxy_host"` ProxyPort int `required:"true" mapstructure:"proxy_port"` NaglesAlgorithm bool `mapstructure:"nagles_algorithm"` HexOutput bool `mapstructure:"hex_output"` PacketSize int `mapstructure:"packet_size" default:"64" required:"true"` // contains filtered or unexported fields }
TCPProxy implements a TCP proxy
func (*TCPProxy) Setup ¶ added in v0.0.3
func (p *TCPProxy) Setup(middleware []muxy.Middleware)
Setup the TCP proxy