networkpolicy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package networkpolicy provides the outbound HTTP transport used for user-configured destinations.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDisallowedURL = errors.New("URL must resolve to an allowed address")
)

Functions

func AllowsLocalhostDevelopment

func AllowsLocalhostDevelopment(publicURL string) bool

AllowsLocalhostDevelopment reports whether publicURL explicitly configures a localhost HTTP development instance.

func SameOrigin

func SameOrigin(a, b *url.URL) bool

SameOrigin compares URL scheme, hostname, and effective port.

Types

type Policy

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

Policy validates URLs and supplies clients backed by one shared transport.

func New

func New(privateCIDRs []netip.Prefix, allowLocalhost bool) *Policy

New constructs an outbound policy. allowLocalhost is only for development instances whose configured public URL is itself localhost.

func (*Policy) Client

func (p *Policy) Client(timeout time.Duration) *http.Client

Client returns an HTTP client backed by the policy's shared transport.

func (*Policy) ParseURL

func (p *Policy) ParseURL(raw string) (*url.URL, error)

ParseURL validates the non-DNS properties of an outbound URL. DNS is resolved again by the transport immediately before dialing.

Jump to

Keyboard shortcuts

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