You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
414 B
Go
26 lines
414 B
Go
package proxy
|
|
|
|
import (
|
|
"net"
|
|
"net/http"
|
|
)
|
|
|
|
// 拦截 https 流量通用接口
|
|
type Interceptor interface {
|
|
// 初始化
|
|
Start() error
|
|
// 传入当前客户端 req
|
|
Dial(req *http.Request) (net.Conn, error)
|
|
}
|
|
|
|
// 直接转发 https 流量
|
|
type Forward struct{}
|
|
|
|
func (i *Forward) Start() error {
|
|
return nil
|
|
}
|
|
|
|
func (i *Forward) Dial(req *http.Request) (net.Conn, error) {
|
|
return net.Dial("tcp", req.Host)
|
|
}
|