github.com/metacubex/mihomo@v1.18.5/adapter/inbound/https.go (about)

     1  package inbound
     2  
     3  import (
     4  	"net"
     5  	"net/http"
     6  
     7  	C "github.com/metacubex/mihomo/constant"
     8  )
     9  
    10  // NewHTTPS receive CONNECT request and return ConnContext
    11  func NewHTTPS(request *http.Request, conn net.Conn, additions ...Addition) (net.Conn, *C.Metadata) {
    12  	metadata := parseHTTPAddr(request)
    13  	metadata.Type = C.HTTPS
    14  	ApplyAdditions(metadata, WithSrcAddr(conn.RemoteAddr()), WithInAddr(conn.LocalAddr()))
    15  	ApplyAdditions(metadata, additions...)
    16  	return conn, metadata
    17  }