revproxy

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendRouting

type BackendRouting map[string]backendPathHandlers

BackendRouting contains a mopping of host name to the relevant backend path handlers in order of priority

type Config

type Config struct {
	//BackendTimeout is timeout for each proxied request to the respective backend.
	// Defaults to 20 seconds.
	BackendTimeout time.Duration
}

Config is a data structure that holds the config options for the reverse proxy

type ConfigOption

type ConfigOption func(*Config)

ConfigOption is used to implement the functional parameter pattern for the reverse proxy

func BackendTimeout added in v0.3.0

func BackendTimeout(timeout time.Duration) ConfigOption

BackendTimeout sets the timeout for waiting for the backend response for the reverse proxy

type ReverseProxy

type ReverseProxy struct {

	// Transport are the transport configurations for the reverse proxy. Will be cloned for each path.
	Transport *http.Transport
	// contains filtered or unexported fields
}

ReverseProxy implements the main ingress reverse proxy logic

func New

func New(options ...ConfigOption) *ReverseProxy

New setups a new reverse proxy. To start it see methods GetServerHttp and GetServerHttps.

func (*ReverseProxy) GetCertificateFunc added in v0.5.0

func (proxy *ReverseProxy) GetCertificateFunc() func(hello *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificateFunc returns a function for the tls.Config.GetCertificate callback. Supposed to be used with tls.Listener.

func (*ReverseProxy) GetHandlerProxying added in v0.3.3

func (proxy *ReverseProxy) GetHandlerProxying() http.Handler

GetHandlerProxying returns the main proxying handler. Can be used with HTTP and HTTPS listeners. A TLS-terminating setup should use this for HTTPS only.

func (*ReverseProxy) GetHttpsRedirectHandler added in v0.3.3

func (proxy *ReverseProxy) GetHttpsRedirectHandler() http.Handler

GetHttpsRedirectHandler returns a handler which redirects all requests with HTTP status 308 to the same route but with the https scheme. Should therefore not be used for TLS listeners. Paths that start with "/.well-known/acme-challenge" are stil reverse proxied to the backend for ACME challenges.

func (*ReverseProxy) LoadIngressState

func (proxy *ReverseProxy) LoadIngressState(state state.IngressState) error

LoadIngressState loads a new ingress state as reverse proxy settings. There is no downtime during this change. The new state is processed and then swapped in while supporting concurrent requests. Once applied the reverse proxy is then purely defined by the new state.

type TlsCerts

type TlsCerts map[string]*tls.Certificate

TlsCerts contains a mapping of host name to the relevant TLS certificates

Jump to

Keyboard shortcuts

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