Documentation ¶
Overview ¶
Package reverseproxy allows instance a simple reverse proxy with capacity to implement many interceptors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configurer ¶
type Configurer interface { // Origin allows set the endpoint backend url. Origin(address string) error // Public allows set the endpoint frontend url. Public(address string) error // AddInterceptor allows loading a new interceptor that the proxy must be execute by each request. // // Receives a name to identify the interceptor loaded. AddInterceptor(name string, interceptor interceptor.Interceptor) error }
Configurer defines the available options to configure a new instance of reverseproxy.ReverseProxy.
type ReverseProxy ¶
type ReverseProxy struct {
// contains filtered or unexported fields
}
ReverseProxy execute a httputil.ReverseProxy and manage the interceptors configured.
func New ¶
func New(options ...func(Configurer) error) (*ReverseProxy, error)
New returns a new reverseproxy.ReverseProxy instace configured.
Receives a list of options callback with the configurations to apply.
func (*ReverseProxy) Run ¶
func (rp *ReverseProxy) Run() error
Run starts to lisent and serve the reverse proxy
func (*ReverseProxy) ServeHTTP ¶
func (rp *ReverseProxy) ServeHTTP(response http.ResponseWriter, request *http.Request) error
ServeHTTP implements http.Handler interface. It allows execute a request parse manually.
Receives the request data that the reverse proxy handle to apply the correspondent redirection.