handler

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register()

Types

type Module

type Module struct {
	Secret     string      `json:"secret,omitempty"`
	CookieName string      `json:"cookie_name,omitempty"`
	Upstreams  []*Upstream `json:"upstreams,omitempty"`
	// contains filtered or unexported fields
}

func (Module) CaddyModule

func (Module) CaddyModule() caddy.ModuleInfo

func (*Module) Provision

func (m *Module) Provision(ctx caddy.Context) (err error)

func (*Module) ServeHTTP

func (m *Module) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*Module) UnmarshalCaddyfile

func (m *Module) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

type Upstream

type Upstream struct {
	CIDR string `json:"cidr,omitempty"`
	Port int    `json:"port,omitempty"`
	Host string `json:"host,omitempty"`
	// contains filtered or unexported fields
}

func (*Upstream) Resolve added in v0.1.7

func (u *Upstream) Resolve(ctx context.Context, ttl, timeout time.Duration, logger *zap.Logger) (*reverseproxy.Upstream, error)

Resolve returns an upstream for this host, resolving Host to a raw IP. The resolved address is cached for ttl and refreshed by a single collapsed lookup; concurrent callers during an in-flight lookup wait on the entry's channel, or bail if their request context is cancelled.

A fresh *reverseproxy.Upstream is built on every call rather than cached: reverse_proxy writes into the struct per request (Host, cb, healthCheckPolicy via provisionUpstream), so a shared pointer would be a data race. Only the address is cached — the expensive part.

Jump to

Keyboard shortcuts

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