reverseproxy

package
v0.0.0-...-e4308c2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseUpstream

func ParseUpstream(r *ReverseProxy, upstream *string) (upstream_url url.URL)

Types

type Listener

type Listener struct {
	Addr    string
	TLSCert string
	TLSKey  string
}

func (*Listener) Make

func (l *Listener) Make() (net.Listener, error)

func (*Listener) ServesTLS

func (l *Listener) ServesTLS() bool

type ReverseProxy

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

func (*ReverseProxy) AddListener

func (r *ReverseProxy) AddListener(address string)

AddListener adds a listener for non-TLS connections on the given address

func (*ReverseProxy) AddListenerTLS

func (r *ReverseProxy) AddListenerTLS(address, tlsCert, tlsKey string)

AddListenerTLS adds a listener for TLS connections on the given address

func (*ReverseProxy) AddTarget

func (r *ReverseProxy) AddTarget(upstreams []string, router *mux.Router) error

AddTarget adds an upstream server to use for a request that matches a given gorilla/mux Router. These are matched via Director function.

func (*ReverseProxy) ClearTargets

func (r *ReverseProxy) ClearTargets() error

func (*ReverseProxy) Director

func (r *ReverseProxy) Director() func(req *http.Request)

Director returns a function for use in http.ReverseProxy.Director. The function matches the incoming request to a specific target and sets the request object to be sent to the matched upstream server.

func (*ReverseProxy) Start

func (r *ReverseProxy) Start() error

Start will listen on configured listeners

func (*ReverseProxy) Stop

func (r *ReverseProxy) Stop()

Stop will gracefully shut down all listening servers

type Target

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

func (*Target) SelectTarget

func (t *Target) SelectTarget() *string

SelectTarget will load balance amongst available targets using a round-robin algorithm

Jump to

Keyboard shortcuts

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