httpreverse

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeaderValuesContainsToken

func HeaderValuesContainsToken(values []string, token string) bool

HeaderValuesContainsToken reports whether any string in values contains the provided token, ASCII case-insensitively.

Types

type HostProxyMap

type HostProxyMap map[string]*pathmatch.Matcher[*ProxyTarget]

func (HostProxyMap) MatchHost

func (hpm HostProxyMap) MatchHost(host string) (matcher *pathmatch.Matcher[*ProxyTarget], ok bool)

type ProxyTarget

type ProxyTarget struct {
	Len     int
	Cnt     int
	Targets []*url.URL
}

ProxyTarget is the target of specific path.

func (*ProxyTarget) NextTargetURL

func (pt *ProxyTarget) NextTargetURL(path string) (targetURL *url.URL)

NextTargetURL returns the target url based on round robin strategy. Locking mechanism isn't applied, so that it may not perfectly distribute the requests.

type ReverseFroxy

type ReverseFroxy struct {
	On  bool
	Sec bool

	HostPathTarget map[string]map[string]*ProxyTarget

	// HostProxyMap maps host to basepath matcher, which maps basepath to proper ProxyTarget.
	HostProxyMap HostProxyMap
	// contains filtered or unexported fields
}

func ConfigReverseProxy

func ConfigReverseProxy(rpsm map[string]map[string][]string, secure bool) (*ReverseFroxy, error)

func (*ReverseFroxy) ServeHTTP

func (rf *ReverseFroxy) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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