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