hotfix: add self tun ip to route table (#712)

This commit is contained in:
naison
2025-08-28 20:25:38 +08:00
committed by GitHub
parent 2d23a46d33
commit cf473d85c9

View File

@@ -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(),