httppolicy

package
v3.0.0-rc29 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type T

type T struct {
	// AllowedUrl defines the list of URL patterns that are explicitly
	// permitted by the policy regardless BlockedUrl setting.
	AllowedUrl []string

	// BlockedURL define the URLs patterns that are explicitly disallowed by the policy.
	// Empty value is treated the same as a []string{"*"} (all URLs are blocked
	// unless explicitly allowed).
	BlockedUrl []string

	// AllowedCIDR defines CIDR blocks explicitly allowed by the policy,
	// overriding any entries in BlockedCIDR.
	AllowedCIDR []string

	// BlockedCIDR defines a list of CIDR blocks that are explicitly disallowed
	// by the policy for incoming requests.
	BlockedCIDR []string
}

func New

func New(allowedURL, blockedURL, allowedCIDR, blockedCIDR []string) *T

New creates and returns a new instance of T initialized with the provided whitelist URLs and blocked CIDRs.

func (*T) Check

func (t *T) Check(rawURL string) (ip net.IP, port string, err error)

Check validates the given rawURL, resolves its IP, determines its port, and ensures it complies with set rules. The accepted ip, port is returned to prevent TOCTOU bugs.

Jump to

Keyboard shortcuts

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