Help us shape the future of Go! Take the 2026 Go Developer Survey

egress

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package egress restricts where a provider request may go: only to the hosts a provider's manifest names, over HTTPS, without following a redirect to another host, and never to a private, loopback or link-local address, which is checked after DNS resolution so a rebinding name cannot reach one.

Index

Constants

This section is empty.

Variables

View Source
var ErrRefused = errors.New("egress: refused")

ErrRefused is returned for a request the policy does not allow.

Functions

func Client

func Client(p Policy) *http.Client

Client returns an HTTP client that enforces the policy.

Types

type Policy

type Policy struct {
	// Hosts are the allowed hosts, with a port when not the default.
	Hosts []string
	// AllowPrivate permits private, loopback and link-local addresses. It is
	// for development and tests only.
	AllowPrivate bool
	// AllowHTTP permits plain HTTP. It is for development and tests only.
	AllowHTTP bool
	// Transport is the base transport, cloned. The default is a clone of
	// http.DefaultTransport.
	Transport *http.Transport
	// Timeout bounds a whole request. Default 30 seconds.
	Timeout time.Duration
}

Policy is where requests may go.

Jump to

Keyboard shortcuts

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