mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 05:31:18 +08:00
20 lines
497 B
Go
20 lines
497 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
|
|
additions = append(additions, WithSrcAddr(conn.RemoteAddr()), WithInAddr(conn.LocalAddr()))
|
|
for _, addition := range additions {
|
|
addition.Apply(metadata)
|
|
}
|
|
return conn, metadata
|
|
}
|