Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GlobalRequestStats = &RequestStats{}
View Source
var GlobalUpstreamStats = &UpstreamProtocolStats{ stats: make(map[string]*RequestStats), }
Functions ¶
This section is empty.
Types ¶
type MITM ¶
type MITM struct {
ListenHTTPS bool //开启 HTTPS 代理服务器
EnableMITM bool //启用 HTTPS 中间人解密,关闭时 CONNECT 走 TCP 隧道透传
HTTPAddr string //HTTP listen addr
HTTPSAddr string //HTTPS listen addr
TLSConf *TLSConfig
Print bool //打印请求详情
Scheduler func(req *http.Request) (proxy string, err error) //代理调度 func
Filter func(req *http.Request) error //请求鉴权、清洗、限流
OnProxyFailure func(proxyURI string) //上游代理不可用时的回调(如 407 需要认证)
// contains filtered or unexported fields
}
MITM 中间人
func (*MITM) Dump ¶
func (m *MITM) Dump(clientResponse http.ResponseWriter, clientRequest *http.Request)
Dump rt
type ProcessCounts ¶ added in v0.5.0
type ProcessCounts struct {
Lightpanda int `json:"lightpanda"`
}
func GetProcessCounts ¶ added in v0.5.0
func GetProcessCounts() ProcessCounts
type ProxyConnectError ¶ added in v0.9.12
ProxyConnectError 上游代理在 CONNECT 握手阶段返回的非 200 响应, 携带 StatusCode 以便上层区分 407(需要认证)等可识别的失败原因
func (*ProxyConnectError) Error ¶ added in v0.9.12
func (e *ProxyConnectError) Error() string
type RequestStats ¶ added in v0.5.0
type RequestStats struct {
TotalRequests atomic.Int64
SuccessRequests atomic.Int64
FailedRequests atomic.Int64
BytesTransferred atomic.Int64
}
RequestStats 代理请求的全局运行时统计(atomic,无锁)
func (*RequestStats) Snapshot ¶ added in v0.5.0
func (s *RequestStats) Snapshot() RequestStatsSnapshot
type RequestStatsSnapshot ¶ added in v0.5.0
type TLSConfig ¶
type TLSConfig struct {
PrivateKeyFile string
CertFile string
Organization string
CommonName string
ServerTLSConfig *tls.Config
}
TLSConfig TLS配置
type UpstreamProtocolStats ¶ added in v0.9.1
type UpstreamProtocolStats struct {
// contains filtered or unexported fields
}
UpstreamProtocolStats 按上游代理协议(http/https/socks4/socks5)分别统计请求数和流量
func (*UpstreamProtocolStats) Get ¶ added in v0.9.1
func (u *UpstreamProtocolStats) Get(protocol string) *RequestStats
func (*UpstreamProtocolStats) Snapshot ¶ added in v0.9.1
func (u *UpstreamProtocolStats) Snapshot() map[string]RequestStatsSnapshot
Click to show internal directories.
Click to hide internal directories.