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

providerhttp

package
v1.4.30 Latest Latest
Warning

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

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

Documentation

Overview

Package providerhttp provides hardened outbound HTTP policy for configured providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressAllowed

func AddressAllowed(address net.IP, policy Policy) bool

AddressAllowed applies the provider destination policy to one resolved address.

func HostAllowed

func HostAllowed(host string, policy Policy) bool

HostAllowed rejects known metadata names and disallowed literal addresses.

func NewTransport

func NewTransport(policy Policy) *http.Transport

NewTransport returns a transport that ignores ambient proxies and validates every DNS answer before dialing the validated IP directly.

func NormalizeOrigin

func NormalizeOrigin(address string) (string, error)

NormalizeOrigin validates and canonicalizes an exact HTTP(S) origin.

func RefuseRedirects

func RefuseRedirects(*http.Request, []*http.Request) error

RefuseRedirects prevents credential forwarding and cross-origin redirects.

Types

type Policy

type Policy struct {
	AllowLoopback      bool
	AllowPrivate       bool
	RequireLoopback    bool
	InsecureSkipVerify bool
	RootCAs            *x509.CertPool
}

Policy controls explicitly approved local-network destinations and TLS behavior.

Jump to

Keyboard shortcuts

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