ippolicy

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(req *http.Request, direct netip.Addr, trusted []netip.Prefix) netip.Addr

ClientIP returns the end-client address. When direct is in trusted, X-Forwarded-For (leftmost) or X-Real-IP is used; otherwise direct is returned.

func DirectPeerIP

func DirectPeerIP(req *http.Request) (netip.Addr, error)

DirectPeerIP returns the address of the immediate TCP client (the peer connected to the gateway).

Types

type IPPolicy

type IPPolicy struct {
	plugin.Plugin
	// contains filtered or unexported fields
}

IPPolicy enforces per-route or global allow/deny CIDR lists at the edge (including OPTIONS).

func New

func New() *IPPolicy

New creates the IP policy plugin.

func (*IPPolicy) OnRequest

func (p *IPPolicy) OnRequest(_ *zoox.Context, _ *http.Request) error

OnRequest is a no-op; policy runs in the HTTP middleware.

func (*IPPolicy) OnResponse

func (p *IPPolicy) OnResponse(_ *zoox.Context, _ *http.Response) error

OnResponse is a no-op.

func (*IPPolicy) Prepare

func (p *IPPolicy) Prepare(app *zoox.Application, cfg *config.Config) error

Prepare compiles CIDRs and registers middleware before the reverse proxy.

Jump to

Keyboard shortcuts

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