add obfs dialer

This commit is contained in:
ginuerzh
2021-12-16 22:26:13 +08:00
parent a52cd9a4c2
commit c7f5da6ac7
20 changed files with 691 additions and 274 deletions

View File

@ -59,9 +59,6 @@ func (c *httpConnector) Connect(ctx context.Context, conn net.Conn, network, add
ProtoMinor: 1,
Header: make(http.Header),
}
if c.md.UserAgent != "" {
req.Header.Set("User-Agent", c.md.UserAgent)
}
req.Header.Set("Proxy-Connection", "keep-alive")
if user := c.md.User; user != nil {
@ -71,6 +68,10 @@ func (c *httpConnector) Connect(ctx context.Context, conn net.Conn, network, add
"Basic "+base64.StdEncoding.EncodeToString([]byte(u+":"+p)))
}
for k, v := range c.md.headers {
req.Header.Set(k, v)
}
switch network {
case "tcp", "tcp4", "tcp6":
if _, ok := conn.(net.PacketConn); ok {