From cf473d85c9ed002e6c052458eca8dbd0aa1d67c1 Mon Sep 17 00:00:00 2001 From: naison <895703375@qq.com> Date: Thu, 28 Aug 2025 20:25:38 +0800 Subject: [PATCH] hotfix: add self tun ip to route table (#712) --- pkg/handler/connect.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/handler/connect.go b/pkg/handler/connect.go index 5ed3b669..4fc7f5c3 100644 --- a/pkg/handler/connect.go +++ b/pkg/handler/connect.go @@ -401,6 +401,12 @@ func (c *ConnectOptions) startLocalTunServer(ctx context.Context, forwardAddress routes = append(routes, types.Route{Dst: *ipNet}) } } + if c.LocalTunIPv4 != nil { + routes = append(routes, types.Route{Dst: net.IPNet{IP: c.LocalTunIPv4.IP, Mask: net.CIDRMask(32, 32)}}) + } + if c.LocalTunIPv6 != nil { + routes = append(routes, types.Route{Dst: net.IPNet{IP: c.LocalTunIPv6.IP, Mask: net.CIDRMask(128, 128)}}) + } tunConfig := tun.Config{ Addr: (&net.IPNet{IP: c.LocalTunIPv4.IP, Mask: net.CIDRMask(32, 32)}).String(),