Make all variables behave like server filters
This commit is contained in:
@@ -45,13 +45,13 @@ ENV VPNSP=pia \
|
||||
# PIA, Windscribe, Surfshark, Cyberghost, Vyprvpn, NordVPN only
|
||||
USER= \
|
||||
PASSWORD= \
|
||||
REGION="Austria" \
|
||||
REGION= \
|
||||
# PIA only
|
||||
PIA_ENCRYPTION=strong \
|
||||
PORT_FORWARDING=off \
|
||||
PORT_FORWARDING_STATUS_FILE="/forwarded_port" \
|
||||
# Mullvad only
|
||||
COUNTRY=Sweden \
|
||||
COUNTRY= \
|
||||
CITY= \
|
||||
ISP= \
|
||||
# Mullvad and Windscribe only
|
||||
|
||||
16
README.md
16
README.md
@@ -134,13 +134,15 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
|
||||
| `OPENVPN_CIPHER` | | i.e. `aes-256-gcm` | Specify a custom cipher to use. It will also set `ncp-disable` if using AES GCM for PIA |
|
||||
| `OPENVPN_AUTH` | | i.e. `sha256` | Specify a custom auth algorithm to use |
|
||||
|
||||
*For all providers below, server location parameters are all optional. By default a random server is picked using the filter settings provided.*
|
||||
|
||||
- Private Internet Access
|
||||
|
||||
| Variable | Default | Choices | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| 🏁 `USER` | | | Your username |
|
||||
| 🏁 `PASSWORD` | | | Your password |
|
||||
| `REGION` | `Austria` | One of the [PIA regions](https://www.privateinternetaccess.com/pages/network/) | VPN server region |
|
||||
| `REGION` | | One of the [PIA regions](https://www.privateinternetaccess.com/pages/network/) | VPN server region |
|
||||
| `PIA_ENCRYPTION` | `strong` | `normal`, `strong` | Encryption preset |
|
||||
| `PORT_FORWARDING` | `off` | `on`, `off` | Enable port forwarding on the VPN server |
|
||||
| `PORT_FORWARDING_STATUS_FILE` | `/forwarded_port` | Any filepath | Filepath to store the forwarded port number |
|
||||
@@ -150,7 +152,7 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
|
||||
| Variable | Default | Choices | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| 🏁 `USER` | | | Your user ID |
|
||||
| `COUNTRY` | `Sweden` | One of the [Mullvad countries](https://mullvad.net/en/servers/#openvpn) | VPN server country |
|
||||
| `COUNTRY` | | One of the [Mullvad countries](https://mullvad.net/en/servers/#openvpn) | VPN server country |
|
||||
| `CITY` | | One of the [Mullvad cities](https://mullvad.net/en/servers/#openvpn) | VPN server city |
|
||||
| `ISP` | | One of the [Mullvad ISP](https://mullvad.net/en/servers/#openvpn) | VPN server ISP |
|
||||
| `PORT` | | `80` or `443` for TCP; or `53` for UDP. Leave blank for default Mullvad server port | Custom VPN port to use |
|
||||
@@ -161,7 +163,7 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
|
||||
| --- | --- | --- | --- |
|
||||
| 🏁 `USER` | | | Your username |
|
||||
| 🏁 `PASSWORD` | | | Your password |
|
||||
| `REGION` | `Austria` | One of the [Windscribe regions](https://windscribe.com/status) | VPN server region |
|
||||
| `REGION` | | One of the [Windscribe regions](https://windscribe.com/status) | VPN server region |
|
||||
| `PORT` | | One from the [this list of ports](https://windscribe.com/getconfig/openvpn) | Custom VPN port to use |
|
||||
|
||||
- Surfshark
|
||||
@@ -170,7 +172,7 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
|
||||
| --- | --- | --- | --- |
|
||||
| 🏁 `USER` | | | Your **service** username, found at the bottom of the [manual setup page](https://account.surfshark.com/setup/manual) |
|
||||
| 🏁 `PASSWORD` | | | Your **service** password |
|
||||
| `REGION` | `Austria` | One of the [Surfshark regions (subdomains)](https://github.com/qdm12/private-internet-access-docker/wiki/surfshark) | VPN server region |
|
||||
| `REGION` | | One of the [Surfshark regions](https://github.com/qdm12/private-internet-access-docker/wiki/surfshark) | VPN server region |
|
||||
|
||||
- Cyberghost
|
||||
|
||||
@@ -179,7 +181,7 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
|
||||
| 🏁 `USER` | | | Your username |
|
||||
| 🏁 `PASSWORD` | | | Your password |
|
||||
| 🏁 `CLIENT_KEY` | | | Your device client key content, **see below** |
|
||||
| `REGION` | `Austria` | One of the [Cyberghost countries](https://github.com/qdm12/private-internet-access-docker/wiki/Cyberghost#regions) | VPN server country |
|
||||
| `REGION` | | One of the [Cyberghost countries](https://github.com/qdm12/private-internet-access-docker/wiki/Cyberghost#regions) | VPN server country |
|
||||
| `CYBERGHOST_GROUP` | `Premium UDP Europe` | One of the [server groups](https://github.com/qdm12/private-internet-access-docker/wiki/Cyberghost#server-groups) | Server group |
|
||||
|
||||
To specify your client key, you can either:
|
||||
@@ -199,7 +201,7 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
|
||||
| --- | --- | --- | --- |
|
||||
| 🏁 `USER` | | | Your username |
|
||||
| 🏁 `PASSWORD` | | | Your password |
|
||||
| `REGION` | `Austria` | One of the [VyprVPN regions](https://www.vyprvpn.com/server-locations) | VPN server region |
|
||||
| `REGION` | | One of the [VyprVPN regions](https://www.vyprvpn.com/server-locations) | VPN server region |
|
||||
|
||||
- NordVPN
|
||||
|
||||
@@ -207,7 +209,7 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
|
||||
| --- | --- | --- | --- |
|
||||
| 🏁 `USER` | | | Your username |
|
||||
| 🏁 `PASSWORD` | | | Your password |
|
||||
| 🏁 `REGION` | `Austria` (wrong) | One of the NordVPN server country, i.e. `Switzerland` | VPN server country |
|
||||
| `REGION` | | One of the NordVPN server country, i.e. `Switzerland` | VPN server country |
|
||||
| `SERVER_NUMBER` | | Server integer number | Optional server number. For example `251` for `Italy #251` |
|
||||
|
||||
### DNS over TLS
|
||||
|
||||
@@ -10,14 +10,15 @@ import (
|
||||
// GetCyberghostGroup obtains the server group for the Cyberghost server from the
|
||||
// environment variable CYBERGHOST_GROUP
|
||||
func (p *reader) GetCyberghostGroup() (group string, err error) {
|
||||
s, err := p.envParams.GetValueIfInside("CYBERGHOST_GROUP", constants.CyberghostGroupChoices())
|
||||
s, err := p.envParams.GetValueIfInside("CYBERGHOST_GROUP", constants.CyberghostGroupChoices(), libparams.Default("Premium UDP Europe"))
|
||||
return s, err
|
||||
}
|
||||
|
||||
// GetCyberghostRegion obtains the country name for the Cyberghost server from the
|
||||
// environment variable REGION
|
||||
func (p *reader) GetCyberghostRegion() (region string, err error) {
|
||||
s, err := p.envParams.GetValueIfInside("REGION", constants.CyberghostRegionChoices())
|
||||
choices := append(constants.CyberghostRegionChoices(), "")
|
||||
s, err := p.envParams.GetValueIfInside("REGION", choices)
|
||||
return s, err
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import (
|
||||
// GetNordvpnRegion obtains the region (country) for the NordVPN server from the
|
||||
// environment variable REGION
|
||||
func (r *reader) GetNordvpnRegion() (region string, err error) {
|
||||
return r.envParams.GetValueIfInside("REGION", constants.NordvpnRegionChoices())
|
||||
choices := append(constants.NordvpnRegionChoices(), "")
|
||||
return r.envParams.GetValueIfInside("REGION", choices)
|
||||
}
|
||||
|
||||
// GetNordvpnRegion obtains the server number (optional) for the NordVPN server from the
|
||||
|
||||
@@ -2,7 +2,6 @@ package params
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
|
||||
libparams "github.com/qdm12/golibs/params"
|
||||
"github.com/qdm12/private-internet-access-docker/internal/constants"
|
||||
@@ -60,9 +59,5 @@ func (r *reader) GetPIAEncryptionPreset() (preset string, err error) {
|
||||
// environment variable REGION
|
||||
func (r *reader) GetPIARegion() (region string, err error) {
|
||||
choices := append(constants.PIAGeoChoices(), "")
|
||||
s, err := r.envParams.GetValueIfInside("REGION", choices)
|
||||
if len(s) == 0 { // Suggestion by @rorph https://github.com/rorph
|
||||
s = choices[rand.Int()%len(choices)] //nolint:gosec
|
||||
}
|
||||
return s, err
|
||||
return r.envParams.GetValueIfInside("REGION", choices)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ import (
|
||||
// GetSurfsharkRegion obtains the region for the Surfshark server from the
|
||||
// environment variable REGION
|
||||
func (r *reader) GetSurfsharkRegion() (region string, err error) {
|
||||
s, err := r.envParams.GetValueIfInside("REGION", constants.SurfsharkRegionChoices())
|
||||
return s, err
|
||||
choices := append(constants.SurfsharkRegionChoices(), "")
|
||||
return r.envParams.GetValueIfInside("REGION", choices)
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@ import (
|
||||
// GetVyprvpnRegion obtains the region for the Vyprvpn server from the
|
||||
// environment variable REGION
|
||||
func (r *reader) GetVyprvpnRegion() (region string, err error) {
|
||||
return r.envParams.GetValueIfInside("REGION", constants.VyprvpnRegionChoices())
|
||||
choices := append(constants.VyprvpnRegionChoices(), "")
|
||||
return r.envParams.GetValueIfInside("REGION", choices)
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
// GetWindscribeRegion obtains the region for the Windscribe server from the
|
||||
// environment variable REGION
|
||||
func (r *reader) GetWindscribeRegion() (region string, err error) {
|
||||
s, err := r.envParams.GetValueIfInside("REGION", constants.WindscribeRegionChoices())
|
||||
return s, err
|
||||
choices := append(constants.WindscribeRegionChoices(), "")
|
||||
return r.envParams.GetValueIfInside("REGION", choices)
|
||||
}
|
||||
|
||||
// GetMullvadPort obtains the port to reach the Mullvad server on from the
|
||||
|
||||
Reference in New Issue
Block a user