netpolicy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package netpolicy owns the default-deny public-egress address policy shared by authenticated outbound integrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNonPublic

func IsNonPublic(address netip.Addr) bool

Types

type Dialer

type Dialer interface {
	DialContext(context.Context, string, string) (net.Conn, error)
}

Dialer opens a connection to an already-resolved, policy-approved address.

type PublicDialer

type PublicDialer struct {
	AllowedCIDRs []netip.Prefix
	Resolver     Resolver
	Dialer       Dialer
}

PublicDialer resolves and validates every destination address immediately before dialing one of those exact addresses. It owns address policy only; callers retain protocol, proxy, redirect, TLS, and timeout policy. An opaque forward proxy changes the address passed here to the proxy's first hop, so a caller must not claim that this dialer validates the proxy's ultimate target.

func NewPublicDialer

func NewPublicDialer(allowedCIDRs []netip.Prefix, resolver Resolver, dialer Dialer) (*PublicDialer, error)

NewPublicDialer validates and copies policy inputs before first use.

func (*PublicDialer) DialContext

func (d *PublicDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type Resolver

type Resolver interface {
	LookupNetIP(context.Context, string, string) ([]netip.Addr, error)
}

Resolver resolves one hostname immediately before a connection attempt.

Jump to

Keyboard shortcuts

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