mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 13:41:23 +08:00
23 lines
456 B
Go
23 lines
456 B
Go
package inbound
|
|
|
|
import (
|
|
"net"
|
|
"net/http"
|
|
|
|
C "github.com/Dreamacro/clash/constant"
|
|
)
|
|
|
|
// NewHTTPS is HTTPAdapter generator
|
|
func NewHTTPS(request *http.Request, conn net.Conn) *SocketAdapter {
|
|
metadata := parseHTTPAddr(request)
|
|
metadata.Type = C.HTTPCONNECT
|
|
if ip, port, err := parseAddr(conn.RemoteAddr().String()); err == nil {
|
|
metadata.SrcIP = ip
|
|
metadata.SrcPort = port
|
|
}
|
|
return &SocketAdapter{
|
|
metadata: metadata,
|
|
Conn: conn,
|
|
}
|
|
}
|