mirror of
https://github.com/davegallant/vpngate.git
synced 2025-08-07 09:02:31 +00:00
Add initial support and docs for Windows (#132)
- Add initial support for Windows - Update docs - Fix issue with openvpn 2.6 data-ciphers
This commit is contained in:
@@ -2,11 +2,10 @@ package vpn
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/davegallant/vpngate/pkg/exec"
|
||||
"github.com/juju/errors"
|
||||
"github.com/nxadm/tail"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// Connect to a specified OpenVPN configuration
|
||||
@@ -17,17 +16,11 @@ func Connect(configPath string) error {
|
||||
}
|
||||
defer os.Remove(tmpLogFile.Name())
|
||||
|
||||
go func() {
|
||||
// Tail the temporary openvpn log file
|
||||
t, err := tail.TailFile(tmpLogFile.Name(), tail.Config{Follow: true})
|
||||
if err != nil {
|
||||
log.Error().Msgf("%s", err)
|
||||
}
|
||||
for line := range t.Lines {
|
||||
log.Debug().Msg(line.Text)
|
||||
}
|
||||
}()
|
||||
executable := "openvpn"
|
||||
if runtime.GOOS == "windows" {
|
||||
executable = "C:\\Program Files\\OpenVPN\\bin\\openvpn.exe"
|
||||
}
|
||||
|
||||
_, err = exec.Run("openvpn", ".", "--verb", "4", "--log", tmpLogFile.Name(), "--config", configPath)
|
||||
err = exec.Run(executable, ".", "--verb", "4", "--config", configPath, "--data-ciphers", "AES-128-CBC")
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user