mihomo/adapter/inbound/https.go

18 lines
464 B
Go
Raw Normal View History

2019-12-08 12:17:24 +08:00
package inbound
2018-08-27 00:06:40 +08:00
import (
"net"
"net/http"
C "github.com/Dreamacro/clash/constant"
2018-08-27 00:06:40 +08:00
)
2021-04-29 11:23:14 +08:00
// NewHTTPS receive CONNECT request and return ConnContext
2023-10-11 10:55:12 +08:00
func NewHTTPS(request *http.Request, conn net.Conn, additions ...Addition) (net.Conn, *C.Metadata) {
metadata := parseHTTPAddr(request)
metadata.Type = C.HTTPS
2023-10-11 22:54:19 +08:00
ApplyAdditions(metadata, WithSrcAddr(conn.RemoteAddr()), WithInAddr(conn.LocalAddr()))
ApplyAdditions(metadata, additions...)
2023-10-11 10:55:12 +08:00
return conn, metadata
2018-08-27 00:06:40 +08:00
}