From 68d12f89ffaa1c98f4d6fc7f14f5305478c94285 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sun, 17 Dec 2023 13:13:35 -0500 Subject: [PATCH] Add DestIpAddress() in Dialer interface Android client prepares an IP before proxy connection is established. It is useful when connecting to wireguard (or quic) outbound with domain address. E.g. engage.cloudflareclient.com:2408 --- libv2ray_main.go | 2 +- libv2ray_support.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libv2ray_main.go b/libv2ray_main.go index b3a5615..4a47da4 100644 --- a/libv2ray_main.go +++ b/libv2ray_main.go @@ -252,7 +252,7 @@ func NewV2RayPoint(s V2RayVPNServiceSupportsSet, adns bool) *V2RayPoint { This func will return libv2ray binding version and V2Ray version used. */ func CheckVersionX() string { - var version = 25 + var version = 26 return fmt.Sprintf("Lib v%d, Xray-core v%s", version, v2core.Version()) } diff --git a/libv2ray_support.go b/libv2ray_support.go index 6d6631f..915c313 100644 --- a/libv2ray_support.go +++ b/libv2ray_support.go @@ -276,6 +276,10 @@ func (d *ProtectedDialer) Dial(ctx context.Context, return d.fdConn(ctx, resolved.IPs[0], resolved.Port, fd) } +func (d *ProtectedDialer) DestIpAddress() net.IP { + return d.vServer.currentIP() +} + func (d *ProtectedDialer) fdConn(ctx context.Context, ip net.IP, port int, fd int) (net.Conn, error) { defer unix.Close(fd)