proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRoutes = &errString{s: "no routes"}

Functions

func BuildProxy

func BuildProxy(up *url.URL, transport http.RoundTripper) *httputil.ReverseProxy

func NewTransport

func NewTransport(cfg TransportConfig) *http.Transport

func StripPath

func StripPath(path string, strip string) string

Types

type Route

type Route struct {
	Name         string
	PathPrefix   string
	Upstream     *url.URL
	StripPrefix  string
	AuthRequired bool
	RateLimit    RouteRateLimit
	Proxy        *httputil.ReverseProxy
}

type RouteRateLimit

type RouteRateLimit struct {
	Enabled bool
	RPS     float64
	Burst   float64
	Scope   string
}

type Router

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

func New

func New(routes []Route) (*Router, error)

func (*Router) Match

func (r *Router) Match(path string) *Route

type TransportConfig

type TransportConfig struct {
	DialTimeout           time.Duration
	TLSHandshakeTimeout   time.Duration
	ResponseHeaderTimeout time.Duration
	IdleConnTimeout       time.Duration
	MaxIdleConns          int
	MaxIdleConnsPerHost   int
}

Jump to

Keyboard shortcuts

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