refactor: refactor code (#373)

This commit is contained in:
naison
2024-11-22 22:00:50 +08:00
committed by GitHub
parent 880f842203
commit 98c22ba9b7
18 changed files with 172 additions and 166 deletions

View File

@@ -367,6 +367,7 @@ func (c *ConnectOptions) startLocalTunServer(ctx context.Context, forwardAddress
tunConfig := tun.Config{
Addr: (&net.IPNet{IP: c.localTunIPv4.IP, Mask: net.CIDRMask(32, 32)}).String(),
Routes: routes,
MTU: config.DefaultMTU,
}
if enable, _ := util.IsIPv6Enabled(); enable {
tunConfig.Addr6 = (&net.IPNet{IP: c.localTunIPv6.IP, Mask: net.CIDRMask(128, 128)}).String()
@@ -378,7 +379,6 @@ func (c *ConnectOptions) startLocalTunServer(ctx context.Context, forwardAddress
log.Errorf("Failed to parse local node %s: %v", localNode, err)
return err
}
node.Values.Add(config.ConfigKubeVPNTransportEngine, string(c.Engine))
chainNode, err := core.ParseNode(forwardAddress)
if err != nil {