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.
25 lines
385 B
Go
25 lines
385 B
Go
4 years ago
|
package proxy
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
)
|
||
|
|
||
|
// 拦截 https 流量通用接口
|
||
|
type Interceptor interface {
|
||
|
// 初始化
|
||
|
Start() error
|
||
|
// 针对每个 host 连接
|
||
|
Dial(host string) (net.Conn, error)
|
||
|
}
|
||
|
|
||
|
// 直接转发 https 流量
|
||
|
type Forward struct{}
|
||
|
|
||
|
func (i *Forward) Start() error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (i *Forward) Dial(host string) (net.Conn, error) {
|
||
|
return net.Dial("tcp", host)
|
||
|
}
|