net

package
v1.9.13 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HardenTransport added in v1.8.17

func HardenTransport(transport *http.Transport, dialer *net.Dialer)

HardenTransport configures the given transport to block connections to link-local IP addresses (169.254.0.0/16 and fe80::/10) and the AWS EC2 IPv6 instance metadata address (fd00:ec2::254). This prevents SSRF attacks targeting cloud instance metadata endpoints. It modifies the transport in place. All four of the transport's dial functions are replaced or cleared. All other properties of the transport are left alone, including proxy and TLS configuration.

If dialer is nil, a new dialer with 30 second connect and keep-alive timeouts is used. Any supplied dialer is never modified.

Types

This section is empty.

Jump to

Keyboard shortcuts

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