netguard

package
v0.2.0-beta.13 Latest Latest
Warning

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

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

Documentation

Overview

Package netguard builds HTTP clients for user-configured outbound URLs (alert and deploy notification webhooks) that refuse to connect to loopback, private, link-local, or otherwise internal addresses.

Index

Constants

View Source
const AllowPrivateEnv = "APP_NOTIFY_ALLOW_PRIVATE_NETWORKS"

AllowPrivateEnv names the env var that, when true, lets outbound notification requests reach internal addresses (for example a self-hosted chat server on a private IP).

Variables

View Source
var ErrBlockedAddress = errors.New("netguard: destination address is internal and not allowed")

ErrBlockedAddress is returned when a dial targets an internal address while AllowPrivateEnv is not enabled.

Functions

func AllowPrivate

func AllowPrivate() bool

AllowPrivate reports whether AllowPrivateEnv is set to a true value.

func IsBlocked

func IsBlocked(addr netip.Addr) bool

IsBlocked reports whether addr is an address an outbound notification must not reach unless AllowPrivateEnv is enabled.

func NewClient

func NewClient() *http.Client

NewClient returns an HTTP client whose every connection, including redirects, is refused when it targets an internal address. It ignores HTTP(S)_PROXY, since a proxy would dial the destination on our behalf and bypass the check.

Types

This section is empty.

Jump to

Keyboard shortcuts

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