Add support and docs for Windows

This commit is contained in:
Dave Gallant
2024-07-28 19:48:33 -04:00
parent 885f73db1c
commit eec385f3d4
4 changed files with 17 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ package vpn
import (
"os"
"runtime"
"github.com/davegallant/vpngate/pkg/exec"
"github.com/juju/errors"
@@ -28,6 +29,10 @@ func Connect(configPath string) error {
}
}()
_, err = exec.Run("openvpn", ".", "--verb", "4", "--log", tmpLogFile.Name(), "--config", configPath)
executable := "openvpn"
if runtime.GOOS == "windows" {
executable = "C:\\Program Files\\OpenVPN\\bin\\openvpn.exe"
}
_, err = exec.Run(executable, ".", "--verb", "4", "--log", tmpLogFile.Name(), "--config", configPath)
return err
}