From bd54c2bfa7eba059253958b198f199272aefb0f9 Mon Sep 17 00:00:00 2001 From: fengcaiwen <895703375@qq.com> Date: Sat, 17 Feb 2024 23:34:50 +0800 Subject: [PATCH] feat: install tun driver on windows --- cmd/cmds/client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/cmds/client.go b/cmd/cmds/client.go index 4e84578..c710d96 100644 --- a/cmd/cmds/client.go +++ b/cmd/cmds/client.go @@ -7,6 +7,7 @@ import ( log "github.com/sirupsen/logrus" "github.com/spf13/cobra" + "github.com/wencaiwulue/kubevpn/v2/pkg/driver" "github.com/wencaiwulue/kubevpn/v2/pkg/util" "github.com/wencaiwulue/tlstunnel/pkg/client" @@ -23,6 +24,11 @@ func CmdClient() *cobra.Command { Use: "client", Short: "client to connect server", Long: `client to connect server`, + PreRun: func(cmd *cobra.Command, args []string) { + if util.IsWindows() { + driver.InstallWireGuardTunDriver() + } + }, RunE: func(cmd *cobra.Command, args []string) error { switch mode { case config.ProxyTypeGlobe: @@ -44,6 +50,7 @@ func CmdClient() *cobra.Command { <-signals cancelFunc() }() + defer driver.UninstallWireGuardTunDriver() return client.Connect(ctx, extraCIDR, sshConf) }, SilenceUsage: true,