github.com/metacubex/mihomo@v1.18.5/adapter/inbound/http.go (about) 1 package inbound 2 3 import ( 4 "net" 5 6 C "github.com/metacubex/mihomo/constant" 7 "github.com/metacubex/mihomo/transport/socks5" 8 ) 9 10 // NewHTTP receive normal http request and return HTTPContext 11 func NewHTTP(target socks5.Addr, srcConn net.Conn, conn net.Conn, additions ...Addition) (net.Conn, *C.Metadata) { 12 metadata := parseSocksAddr(target) 13 metadata.NetWork = C.TCP 14 metadata.Type = C.HTTP 15 metadata.RawSrcAddr = srcConn.RemoteAddr() 16 metadata.RawDstAddr = srcConn.LocalAddr() 17 ApplyAdditions(metadata, WithSrcAddr(srcConn.RemoteAddr()), WithInAddr(srcConn.LocalAddr())) 18 ApplyAdditions(metadata, additions...) 19 return conn, metadata 20 }