chore: rebuild add adapter/inbound.Addition to simply Listener.New apis
This commit is contained in:
@ -9,16 +9,13 @@ import (
|
||||
)
|
||||
|
||||
// NewHTTP receive normal http request and return HTTPContext
|
||||
func NewHTTP(target socks5.Addr, source net.Addr, conn net.Conn) *context.ConnContext {
|
||||
return NewHTTPWithInfos(target, source, conn, "", "")
|
||||
}
|
||||
|
||||
func NewHTTPWithInfos(target socks5.Addr, source net.Addr, conn net.Conn, inName, specialRules string) *context.ConnContext {
|
||||
func NewHTTP(target socks5.Addr, source net.Addr, conn net.Conn, additions ...Addition) *context.ConnContext {
|
||||
metadata := parseSocksAddr(target)
|
||||
metadata.NetWork = C.TCP
|
||||
metadata.Type = C.HTTP
|
||||
metadata.InName = inName
|
||||
metadata.SpecialRules = specialRules
|
||||
for _, addition := range additions {
|
||||
addition.Apply(metadata)
|
||||
}
|
||||
if ip, port, err := parseAddr(source.String()); err == nil {
|
||||
metadata.SrcIP = ip
|
||||
metadata.SrcPort = port
|
||||
|
Reference in New Issue
Block a user