mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-11-29 07:08:35 +00:00
chore: rebuild add adapter/inbound.Addition to simply Listener.New apis
This commit is contained in:
1 parent
c7f83d3ff1
commit
2e22c712af
30 files changed
+290
-225
No files matched your search
@@ -9,15 +9,12 @@ import (
|
||||
)
|
||||
|
||||
// NewHTTPS receive CONNECT request and return ConnContext
|
||||
func NewHTTPS(request *http.Request, conn net.Conn) *context.ConnContext {
|
||||
return NewHTTPSWithInfos(request, conn, "", "")
|
||||
}
|
||||
|
||||
func NewHTTPSWithInfos(request *http.Request, conn net.Conn, inName, specialRules string) *context.ConnContext {
|
||||
func NewHTTPS(request *http.Request, conn net.Conn, additions ...Addition) *context.ConnContext {
|
||||
metadata := parseHTTPAddr(request)
|
||||
metadata.Type = C.HTTPS
|
||||
metadata.SpecialRules = specialRules
|
||||
metadata.InName = inName
|
||||
for _, addition := range additions {
|
||||
addition.Apply(metadata)
|
||||
}
|
||||
if ip, port, err := parseAddr(conn.RemoteAddr().String()); err == nil {
|
||||
metadata.SrcIP = ip
|
||||
metadata.SrcPort = port
|
||||
|
||||
Reference in new issue
Block a user