2 Commits

Author SHA1 Message Date
Dave Gallant
eec385f3d4 Add support and docs for Windows 2024-07-28 20:00:46 -04:00
Dave Gallant
885f73db1c Add proxy to list command also 2024-07-24 07:39:27 -04:00
6 changed files with 20 additions and 7 deletions

View File

@@ -13,6 +13,7 @@ builds:
goos: goos:
- linux - linux
- darwin - darwin
- windows
goarch: goarch:
- amd64 - amd64
- arm - arm

View File

@@ -14,22 +14,27 @@ curl ipinfo.io
## Requirements ## Requirements
- [openvpn](https://github.com/OpenVPN/openvpn) - OpenVPN <= 2.5 (configurations on vpngate.net do not seem work on OpenVPN 2.6+)
- macOS or Linux - macOS, Linux, or Windows
## Install ## Install
The simplest method of installation is using homebrew. You can also build from source. You can install vpngate in a few different ways, and differs slightly depending on your OS.
### from homebrew ### Homebrew
vpngate can be installed with [homebrew](https://brew.sh/) (ensure that xcode is installed before installing homebrew by running `xcode-select --install`). vpngate can be installed with [homebrew](https://brew.sh/) (ensure that xcode is installed before installing homebrew by running `xcode-select --install`).
```shell ```shell
brew install openvpn davegallant/public/vpngate brew install openvpn davegallant/public/vpngate
``` ```
## Windows
On Windows, install OpenVPN 2.5.x from the [official website](https://openvpn.net/community-downloads/).
You must run in the terminal (command prompt) as Administrator in order to be able to run the relevant OpenVPN commands.
### from source ### from source
Ensure that [go](https://golang.org/doc/install) is installed. Ensure that [go](https://golang.org/doc/install) is installed.

View File

@@ -25,7 +25,7 @@ var (
func init() { func init() {
connectCmd.Flags().BoolVarP(&flagRandom, "random", "r", false, "connect to a random server") connectCmd.Flags().BoolVarP(&flagRandom, "random", "r", false, "connect to a random server")
connectCmd.Flags().BoolVarP(&flagReconnect, "reconnect", "t", false, "continually attempt to connect to the server") connectCmd.Flags().BoolVarP(&flagReconnect, "reconnect", "t", false, "continually attempt to connect to the server")
connectCmd.Flags().StringVarP(&flagProxy, "proxy", "p", "", "provide a http/https proxy server to make requests through (i.e. 127.0.0.1:8080)") connectCmd.Flags().StringVarP(&flagProxy, "proxy", "p", "", "provide a http/https proxy server to make requests through (i.e. http://127.0.0.1:8080)")
connectCmd.Flags().StringVarP(&flagSocks5Proxy, "socks5", "s", "", "provide a socks5 proxy server to make requests through (i.e. 127.0.0.1:1080)") connectCmd.Flags().StringVarP(&flagSocks5Proxy, "socks5", "s", "", "provide a socks5 proxy server to make requests through (i.e. 127.0.0.1:1080)")
rootCmd.AddCommand(connectCmd) rootCmd.AddCommand(connectCmd)
} }

View File

@@ -14,6 +14,8 @@ import (
func init() { func init() {
rootCmd.AddCommand(listCmd) rootCmd.AddCommand(listCmd)
listCmd.Flags().StringVarP(&flagProxy, "proxy", "p", "", "provide a http/https proxy server to make requests through (i.e. http://127.0.0.1:8080)")
listCmd.Flags().StringVarP(&flagSocks5Proxy, "socks5", "s", "", "provide a socks5 proxy server to make requests through (i.e. 127.0.0.1:1080)")
} }
var listCmd = &cobra.Command{ var listCmd = &cobra.Command{

View File

@@ -2,6 +2,7 @@ package vpn
import ( import (
"os" "os"
"runtime"
"github.com/davegallant/vpngate/pkg/exec" "github.com/davegallant/vpngate/pkg/exec"
"github.com/juju/errors" "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 return err
} }