Clash.Meta/adapter/inbound/https.go
2023-10-11 22:54:19 +08:00

18 lines
464 B
Go

package inbound
import (
"net"
"net/http"
C "github.com/Dreamacro/clash/constant"
)
// NewHTTPS receive CONNECT request and return ConnContext
func NewHTTPS(request *http.Request, conn net.Conn, additions ...Addition) (net.Conn, *C.Metadata) {
metadata := parseHTTPAddr(request)
metadata.Type = C.HTTPS
ApplyAdditions(metadata, WithSrcAddr(conn.RemoteAddr()), WithInAddr(conn.LocalAddr()))
ApplyAdditions(metadata, additions...)
return conn, metadata
}