Documentation
¶
Overview ¶
Package proxyprobe:出网代理的连通性自测。
为什么要单独一个包:代理有两处使用者——install.sh 装机期(走 curl)和 运行期(走 Go 的 http.Client)。两边的「怎么算通」必须一致,否则会出现 「装机说通了、运行时却连不上」的割裂。判定口径统一放这里。
判定标准用 GitHub API:装机流程本来就要访问它,自测与实际用途同源。 HTTP 200/301/302 都算通(403 是 GitHub 限流,链路本身是通的)。
Index ¶
Constants ¶
View Source
const DefaultProbeURL = "https://api.github.com/repos/projectdiscovery/nuclei/releases/latest"
DefaultProbeURL 默认探测目标:GitHub 的 release API(装机流程本来就要访问它)。
Variables ¶
This section is empty.
Functions ¶
func ClientFor ¶
ClientFor 按协议构造带代理的 HTTP 客户端。导出给 hostd 的下载器复用, 保证「装机期下载」和「运行期自测」用的是同一套代理语义。
socks5 必须走 x/net/proxy 的 SOCKS5 dialer:net/http 的 ProxyURL 只懂 HTTP CONNECT 代理,喂它 socks5:// 会得到 "unsupported protocol scheme"—— 表现就是「填了 socks 代理但下载照样失败」,而用户完全看不出是协议不匹配。
Types ¶
type Result ¶
type Result struct {
OK bool `json:"ok"`
Proxy string `json:"proxy"`
Scheme string `json:"scheme"`
LatencyMS int64 `json:"latency_ms"`
Status int `json:"status"`
ExitIP string `json:"exit_ip,omitempty"`
Error string `json:"error,omitempty"`
Hint string `json:"hint,omitempty"`
}
Result 是一次代理自测的结果。
Click to show internal directories.
Click to hide internal directories.