Feature: add inbounds for flexible binding inbound (#2818)

This commit is contained in:
fuyun
2023-08-03 22:30:08 +08:00
committed by GitHub
parent 10f4d5375a
commit 9e78137768
25 changed files with 552 additions and 361 deletions

View File

@ -3,6 +3,7 @@ package inbound
import (
"net"
"net/netip"
"strconv"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/context"
@ -20,6 +21,7 @@ func NewSocket(target socks5.Addr, conn net.Conn, source C.Type) *context.ConnCo
}
if addrPort, err := netip.ParseAddrPort(conn.LocalAddr().String()); err == nil {
metadata.OriginDst = addrPort
metadata.InboundPort = strconv.Itoa(int(addrPort.Port()))
}
return context.NewConnContext(conn, metadata)
}