Documentation
¶
Overview ¶
Package netguard provides SSRF-resistant HTTP clients for outbound requests to user-supplied URLs. It validates the *resolved* IP at dial time, so DNS rebinding cannot smuggle a request to an internal address. Loopback and link-local are always blocked; private ranges by default.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Client ¶
Client returns an HTTP client whose dialer enforces the SSRF policy. Redirects are followed but each hop is re-validated by the dialer.
func Configure ¶
func Configure(allow bool)
Configure sets whether private-range targets are allowed. Call once at startup. Default (unconfigured) blocks private ranges.
func ValidateURL ¶
ValidateURL performs an up-front check: the scheme must be http(s), a host must be present, and any IP-literal host must be allowed. Hostnames are re-checked against their resolved IPs at dial time.
Types ¶
type ErrBlocked ¶
ErrBlocked is returned when a destination IP is disallowed.
func (*ErrBlocked) Error ¶
func (e *ErrBlocked) Error() string