validator

package
v1.2.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidScheme   = errors.New("invalid URL scheme: only http and https are permitted")
	ErrEmptyHost       = errors.New("invalid URL: missing host")
	ErrSSRFForbiddenIP = errors.New("prohibited target IP address: private, loopback, or cloud metadata endpoints are not allowed")
)

Functions

func SafeDialContext added in v0.3.0

func SafeDialContext(timeout time.Duration) func(ctx context.Context, network, addr string) (net.Conn, error)

SafeDialContext returns a custom DialContext function that resolves DNS and validates IP blocklists at connect time to prevent TOCTOU DNS rebinding SSRF attacks.

func ValidateSafeURL

func ValidateSafeURL(targetURL string) error

ValidateSafeURL checks if a target URL is safe for synthetic probing and protects against SSRF attacks.

Types

This section is empty.

Jump to

Keyboard shortcuts

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