publicnet

package
v0.19.1297 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package publicnet restricts outbound connections to the public internet, for fetches whose destination comes from untrusted input.

Index

Constants

This section is empty.

Variables

View Source
var ErrNonPublic = errors.New("non-public address")

Functions

func DialContext

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

DialContext wraps dialer so it only connects to public addresses, pinning the connection to the address that was checked.

func IsPublicIP

func IsPublicIP(ip net.IP) bool

func NewHTTPClient added in v0.19.1277

func NewHTTPClient() *http.Client

func RequirePublicHost

func RequirePublicHost(ctx context.Context, host string) error

RequirePublicHost rejects host unless every address it resolves to is on the public internet. Callers that then connect should also dial through DialContext, so a record that changes between the check and the connection is still caught.

func ResolvePublic

func ResolvePublic(ctx context.Context, host string) ([]net.IPAddr, error)

ResolvePublic resolves host and returns its addresses, failing unless every address is on the public internet.

Types

This section is empty.

Directories

Path Synopsis
Package templatefetch is the HTTP client for vendor-supplied stack template URLs.
Package templatefetch is the HTTP client for vendor-supplied stack template URLs.

Jump to

Keyboard shortcuts

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