outbound

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package outbound 提供带 SSRF 防护的出站 HTTP 客户端与 URL 校验。

主程序的通知、监控与部署插件共用同一套规则:公网目标允许 HTTP/HTTPS, 但拒绝云元数据、链路本地与保留网段;拨号阶段会重新校验解析结果, 避免 DNS 重绑定绕过配置阶段的检查。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialSafe

func DialSafe(ctx context.Context, network, address string) (net.Conn, error)

DialSafe 在解析后逐个校验目标地址并直接拨号,避免 DNS 重新解析到云元数据地址。

func NewClient

func NewClient(timeout time.Duration, skipVerify bool) *http.Client

NewClient 返回带安全拨号器的 HTTP 客户端。 skipVerify 仅用于用户明确允许的自签证书场景。

func SafeError

func SafeError(err error) string

SafeError 返回适合写入日志或接口响应的错误文本。

func SanitizeErrorText

func SanitizeErrorText(text string) string

SanitizeErrorText 脱敏错误文本中的 URL 路径与查询参数,避免把 token 写入日志。

func ValidateURL

func ValidateURL(raw string) error

ValidateURL 校验用户配置的出站 HTTP(S) 地址。 只允许 http/https,拒绝 userinfo 与非法端口,避免把请求发送到 file:// 等非预期协议,或让 URL 中的凭据信息被误当作主机。

func ValidateWebhookURL

func ValidateWebhookURL(raw string) error

ValidateWebhookURL 校验部署 webhook 地址。 Webhook 会携带证书私钥,因此公网地址必须使用 HTTPS; 回环/私网/.local/.internal 目标允许 HTTP,便于本地接收端。

Types

This section is empty.

Jump to

Keyboard shortcuts

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