proxy

package
v0.29.3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionID = "{{CONNECTION_ID}}"
	HTTPProto    = "{{HTTP_PROTO}}"
	SourceIP     = "{{SOURCE_IP}}"
	SourcePort   = "{{SOURCE_PORT}}"
	SourceIPPort = "{{SOURCE_IP}}:{{SOURCE_PORT}}"
)
View Source
const (
	ProtocolHTTP  = "http"
	ProtocolHTTPS = "https"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.20.2

type Config struct {
	DefaultTarget           string
	TargetMap               []string
	Headers                 []string
	HeadersByIP             map[string][]string
	KeepAliveTimeoutSeconds int
	HTTPSBackend            bool
	HTTPSBackendIgnoreCert  bool
	EnableAccessLog         bool
	RateLimit               int
	RateLimitTimeWindowMs   int
	RateLimitBurst          int
	RateLimitCacheSize      int
}

func (*Config) Apply added in v0.20.2

func (c *Config) Apply(ctx context.Context, p *HTTPProxy) error

type Director added in v0.20.2

type Director interface {
	Director(request *http.Request) error
}

type DirectorChain added in v0.20.2

type DirectorChain []Director

func NewDirectorChain added in v0.20.2

func NewDirectorChain(directors ...Director) DirectorChain

skip nil directors

func (DirectorChain) Director added in v0.20.2

func (c DirectorChain) Director(request *http.Request) error

type DirectorDestMap added in v0.20.2

type DirectorDestMap map[string]string

func NewDirectorDestMap added in v0.20.2

func NewDirectorDestMap(m map[string]string) DirectorDestMap

func (DirectorDestMap) Director added in v0.20.2

func (d DirectorDestMap) Director(request *http.Request) error

type DirectorHost added in v0.20.2

type DirectorHost string

func NewDirectorHost added in v0.20.2

func NewDirectorHost(host string) DirectorHost

func (DirectorHost) Director added in v0.20.2

func (d DirectorHost) Director(request *http.Request) error

type DirectorSameIP added in v0.20.2

type DirectorSameIP struct {
	Port string
}

func NewDirectorSameIP added in v0.20.2

func NewDirectorSameIP(port int) DirectorSameIP

func (DirectorSameIP) Director added in v0.20.2

func (s DirectorSameIP) Director(request *http.Request) error

type DirectorSetHeaders added in v0.20.2

type DirectorSetHeaders map[string]string

func NewDirectorSetHeaders added in v0.20.2

func NewDirectorSetHeaders(m map[string]string) DirectorSetHeaders

func (DirectorSetHeaders) Director added in v0.20.2

func (h DirectorSetHeaders) Director(request *http.Request) error

type DirectorSetHeadersByIP added in v0.29.1

type DirectorSetHeadersByIP struct {
	cidranger.Ranger[HTTPHeaders]
	// contains filtered or unexported fields
}

func NewDirectorSetHeadersByIP added in v0.29.1

func NewDirectorSetHeadersByIP(m map[string]HTTPHeaders) (DirectorSetHeadersByIP, error)

func (DirectorSetHeadersByIP) Director added in v0.29.1

func (h DirectorSetHeadersByIP) Director(request *http.Request) error

type DirectorSetScheme added in v0.22.6

type DirectorSetScheme string

func NewSetSchemeDirector added in v0.22.6

func NewSetSchemeDirector(scheme string) DirectorSetScheme

func (DirectorSetScheme) Director added in v0.22.6

func (d DirectorSetScheme) Director(req *http.Request) error

type HTTPHeader added in v0.29.1

type HTTPHeader struct {
	Name  string
	Value string
}

type HTTPHeaders added in v0.29.1

type HTTPHeaders []HTTPHeader

type HTTPProxy

type HTTPProxy struct {
	GetContext           func(req *http.Request) (context.Context, error)
	HandleHTTPValidation func(w http.ResponseWriter, r *http.Request) bool
	Director             Director // modify requests to backend.
	HTTPTransport        http.RoundTripper
	EnableAccessLog      bool

	IdleTimeout time.Duration
	// contains filtered or unexported fields
}

func NewHTTPProxy

func NewHTTPProxy(ctx context.Context, listener net.Listener) *HTTPProxy

func (*HTTPProxy) Close added in v0.23.9

func (p *HTTPProxy) Close() error

func (*HTTPProxy) Start added in v0.20.2

func (p *HTTPProxy) Start() error

Start - finish initialization of proxy and start handling request. It is sync method, always return with non nil error: if handle stopped by context or if error on start handling. Any public fields must not change after Start called

type IPHeaders added in v0.29.1

type IPHeaders struct {
	Headers map[string]string
	IP      string
}

type Net added in v0.29.2

type Net struct {
	net.IPNet
}

func (Net) Network added in v0.29.2

func (n Net) Network() net.IPNet

type RateLimitParams added in v0.29.0

type RateLimitParams struct {
	RateLimit  int
	TimeWindow time.Duration
	Burst      int
	CacheSize  int
	Clock      clockwork.Clock
}

type RateLimiter added in v0.29.0

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

func NewRateLimiter added in v0.29.0

func NewRateLimiter(params RateLimitParams) (*RateLimiter, error)

func (*RateLimiter) Allow added in v0.29.0

func (rl *RateLimiter) Allow(r *http.Request) bool

type Transport added in v0.22.6

type Transport struct {
	IgnoreHTTPSCertificate bool
	RateLimiter            *RateLimiter
}

func (Transport) RoundTrip added in v0.22.6

func (t Transport) RoundTrip(req *http.Request) (*http.Response, error)

type TransportLogger added in v0.23.16

type TransportLogger struct {
	Transport http.RoundTripper
}

func NewTransportLogger added in v0.23.16

func NewTransportLogger(transport http.RoundTripper) TransportLogger

func (TransportLogger) RoundTrip added in v0.23.16

func (t TransportLogger) RoundTrip(request *http.Request) (resp *http.Response, err error)

Jump to

Keyboard shortcuts

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