proxy

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProxyEndpoint

func NewProxyEndpoint(
	logger log.Logger,
	downstream string,
	options ...ProxyOption,
) (endpoint.Endpoint, error)

NewProxyEndpoint returns an Endpoint which handles an incoming http.Request

Types

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

Proxy defines a reverse proxy for wingman

func NewProxy

func NewProxy(
	logger log.Logger,
	downstream string,
	options ...ProxyOption,
) (*Proxy, error)

NewProxy returns a new reverse proxy

func (*Proxy) HandlerFunc

func (pr *Proxy) HandlerFunc() func(context.Context, *net_http.Request) (*net_http.Response, error)

HandlerFunc returns endpoint for reverse proxy

type ProxyOption

type ProxyOption func(*Proxy)

ProxyOption is set of options which can modify proxy

func ProxyWithCustomTransport

func ProxyWithCustomTransport(rt net_http.RoundTripper) ProxyOption

ProxyWithCustomTransport provides option to set custom roundtripper for the reverse proxy

func ProxyWithModifiedTransport

func ProxyWithModifiedTransport(
	dialerTimeout time.Duration,
	dialerKeepAlive time.Duration,
	idleConnTimeout time.Duration,
	maxIdle int,
) ProxyOption

ProxyWithModifiedTransport provides option to customize the transport used in dialing downstream

func ProxyWithRequestOptions

func ProxyWithRequestOptions(fns ...RequestOption) ProxyOption

ProxyWithRequestOptions provies option to append custom RequestOption for the reverse proxy

func ProxyWithResponseOptions

func ProxyWithResponseOptions(fns ...ResponseOption) ProxyOption

ProxyWithResponseOptions provies option to append custom ResponseOptions for the reverse proxy

type RequestOption

type RequestOption func(req *net_http.Request) error

RequestOption defines means to modify request

type ResponseOption

type ResponseOption func(res *net_http.Response) error

ResponseOption defines means to modify response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL