Surfshark (#167)

This commit is contained in:
Quentin McGaw
2020-05-29 07:24:27 -04:00
committed by GitHub
parent 85a93bdd34
commit 96e57d2c32
17 changed files with 436 additions and 11 deletions

View File

@@ -19,6 +19,7 @@ assignees: qdm12
- [x] PIA
- [ ] Mullvad
- [ ] Windscribe
- [ ] Surfshark
3. What's the version of the program?

View File

@@ -19,6 +19,7 @@ assignees:
- [x] PIA
- [ ] Mullvad
- [ ] Windscribe
- [ ] Surfshark
3. What's the version of the program?

View File

@@ -42,7 +42,7 @@ ENV VPNSP="private internet access" \
UID=1000 \
GID=1000 \
IP_STATUS_FILE="/ip" \
# PIA and Windscribe only
# PIA, Windscribe and Surfshark only
USER= \
PASSWORD= \
REGION="Austria" \

View File

@@ -1,6 +1,6 @@
# Gluetun VPN client
*Lightweight swiss-knife-like VPN client to tunnel to Private Internet Access, Mullvad and Windscribe VPN servers, using Go, OpenVPN, iptables, DNS over TLS, ShadowSocks and Tinyproxy*
*Lightweight swiss-knife-like VPN client to tunnel to Private Internet Access, Mullvad, Windscribe and Surfshark VPN servers, using Go, OpenVPN, iptables, DNS over TLS, ShadowSocks and Tinyproxy*
**ANNOUNCEMENT**: *New wiki available [here](https://github.com/qdm12/private-internet-access-docker/wiki)*
@@ -33,7 +33,7 @@
## Features
- Based on Alpine 3.11 for a small Docker image below 50MB
- Supports **Private Internet Access**, **Mullvad** and **Windscribe** servers
- Supports **Private Internet Access**, **Mullvad**, **Windscribe** and **Surfshark** servers
- DNS over TLS baked in with service provider(s) of your choice
- DNS fine blocking of malicious/ads/surveillance hostnames and IP addresses, with live update every 24 hours
- Choose the vpn network protocol, `udp` or `tcp`
@@ -59,6 +59,10 @@
- Pick the [region](https://windscribe.com/status)
### Surfshark
- Pick the [region](https://github.com/qdm12/private-internet-access-docker/wiki/Surfshark)
### Extra niche features
- Possibility of split horizon DNS by selecting multiple DNS over TLS providers
@@ -76,6 +80,7 @@
[![https://windscribe.com/?affid=mh7nyafu](https://raw.githubusercontent.com/qdm12/private-internet-access-docker/master/doc/windscribe.jpg)](https://windscribe.com/?affid=mh7nyafu)
- Surfshark: **username** and **password**
- If you have a host or router firewall, please refer [to the firewall documentation](https://github.com/qdm12/private-internet-access-docker/blob/master/doc/firewall.md)
1. On some devices such as Synology or Qnap machines, it's required to setup your tunnel device `/dev/net/tun` on your host:
@@ -132,7 +137,7 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
| Variable | Default | Choices | Description |
| --- | --- | --- | --- |
| 🏁 `VPNSP` | `private internet access` | `private internet access`, `mullvad`, `windscribe` | VPN Service Provider |
| 🏁 `VPNSP` | `private internet access` | `private internet access`, `mullvad`, `windscribe`, `surfshark` | VPN Service Provider |
| `IP_STATUS_FILE` | `/ip` | Any filepath | Filepath to store the public IP address assigned |
| `PROTOCOL` | `udp` | `udp` or `tcp` | Network protocol to use |
| `OPENVPN_VERBOSITY` | `1` | `0` to `6` | Openvpn verbosity level |
@@ -171,6 +176,14 @@ Want more testing? ▶ [see the Wiki](https://github.com/qdm12/private-internet-
| `REGION` | `Austria` | 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
| Variable | Default | Choices | Description |
| --- | --- | --- | --- |
| 🏁 `USER` | | | Your username |
| 🏁 `PASSWORD` | | | Your password |
| `REGION` | `Austria` | One of the [Surfshark regions (subdomains)](https://github.com/qdm12/private-internet-access-docker/wiki/surfshark) | VPN server region |
### DNS over TLS
None of the following values are required.

View File

@@ -31,6 +31,7 @@ import (
"github.com/qdm12/private-internet-access-docker/internal/settings"
"github.com/qdm12/private-internet-access-docker/internal/shadowsocks"
"github.com/qdm12/private-internet-access-docker/internal/splash"
"github.com/qdm12/private-internet-access-docker/internal/surfshark"
"github.com/qdm12/private-internet-access-docker/internal/tinyproxy"
"github.com/qdm12/private-internet-access-docker/internal/windscribe"
)
@@ -64,6 +65,7 @@ func main() {
piaConf := pia.NewConfigurator(client, fileManager, firewallConf)
mullvadConf := mullvad.NewConfigurator(fileManager, logger)
windscribeConf := windscribe.NewConfigurator(fileManager)
surfsharkConf := surfshark.NewConfigurator(fileManager)
tinyProxyConf := tinyproxy.NewConfigurator(fileManager, logger)
shadowsocksConf := shadowsocks.NewConfigurator(fileManager, logger)
streamMerger := command.NewStreamMerger()
@@ -104,6 +106,9 @@ func main() {
case constants.Windscribe:
openVPNUser = allSettings.Windscribe.User
openVPNPassword = allSettings.Windscribe.Password
case constants.Surfshark:
openVPNUser = allSettings.Surfshark.User
openVPNPassword = allSettings.Surfshark.Password
}
err = ovpnConf.WriteAuthFile(openVPNUser, openVPNPassword, allSettings.System.UID, allSettings.System.GID)
fatalOnError(err)
@@ -179,6 +184,22 @@ func main() {
allSettings.OpenVPN.Root,
allSettings.OpenVPN.Cipher,
allSettings.OpenVPN.Auth)
case constants.Surfshark:
connections, err = surfsharkConf.GetOpenVPNConnections(
allSettings.Surfshark.Region,
allSettings.OpenVPN.NetworkProtocol,
allSettings.OpenVPN.TargetIP)
if err != nil {
break
}
err = surfsharkConf.BuildConf(
connections,
allSettings.OpenVPN.Verbosity,
allSettings.System.UID,
allSettings.System.GID,
allSettings.OpenVPN.Root,
allSettings.OpenVPN.Cipher,
allSettings.OpenVPN.Auth)
}
fatalOnError(err)

View File

@@ -21,7 +21,7 @@ services:
- OPENVPN_TARGET_IP=
- TZ=
# PIA and Windscribe only
# PIA, Windscribe and Surfshark only
- REGION=Austria
- USER=js89ds7
- PASSWORD=8fd9s239G

View File

@@ -2,9 +2,9 @@ package constants
const (
// Announcement is a message announcement
Announcement = "New Wiki available at https://github.com/qdm12/private-internet-access-docker/wiki"
Announcement = "New VPN provider supported surfshark.com"
// AnnouncementExpiration is the expiration date of the announcement in format yyyy-mm-dd
AnnouncementExpiration = "2020-06-10"
AnnouncementExpiration = "2020-06-20"
)
const (

View File

@@ -0,0 +1,161 @@
package constants
import (
"net"
"github.com/qdm12/private-internet-access-docker/internal/models"
)
const (
SurfsharkCertificate = "MIIFTTCCAzWgAwIBAgIJAMs9S3fqwv+mMA0GCSqGSIb3DQEBCwUAMD0xCzAJBgNVBAYTAlZHMRIwEAYDVQQKDAlTdXJmc2hhcmsxGjAYBgNVBAMMEVN1cmZzaGFyayBSb290IENBMB4XDTE4MDMxNDA4NTkyM1oXDTI4MDMxMTA4NTkyM1owPTELMAkGA1UEBhMCVkcxEjAQBgNVBAoMCVN1cmZzaGFyazEaMBgGA1UEAwwRU3VyZnNoYXJrIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDEGMNj0aisM63oSkmVJyZPaYX7aPsZtzsxo6m6p5Wta3MGASoryRsBuRaH6VVa0fwbI1nw5ubyxkuaNa4v3zHVwuSq6F1p8S811+1YP1av+jqDcMyojH0ujZSHIcb/i5LtaHNXBQ3qN48Cc7sqBnTIIFpmb5HthQ/4pW+a82b1guM5dZHsh7q+LKQDIGmvtMtO1+NEnmj81BApFayiaD1ggvwDI4x7o/Y3ksfWSCHnqXGyqzSFLh8QuQrTmWUm84YHGFxoI1/8AKdIyVoB6BjcaMKtKs/pbctk6vkzmYf0XmGovDKPQF6MwUekchLjB5gSBNnptSQ9kNgnTLqi0OpSwI6ixX52Ksva6UM8P01ZIhWZ6ua/T/tArgODy5JZMW+pQ1A6L0b7egIeghpwKnPRG+5CzgO0J5UE6gv000mqbmC3CbiS8xi2xuNgruAyY2hUOoV9/BuBev8ttE5ZCsJH3YlG6NtbZ9hPc61GiBSx8NJnX5QHyCnfic/X87eST/amZsZCAOJ5v4EPSaKrItt+HrEFWZQIq4fJmHJNNbYvWzCE08AL+5/6Z+lxb/Bm3dapx2zdit3x2e+miGHekuiE8lQWD0rXD4+T+nDRi3X+kyt8Ex/8qRiUfrisrSHFzVMRungIMGdO9O/zCINFrb7wahm4PqU2f12Z9TRCOTXciQIDAQABo1AwTjAdBgNVHQ4EFgQUYRpbQwyDahLMN3F2ony3+UqOYOgwHwYDVR0jBBgwFoAUYRpbQwyDahLMN3F2ony3+UqOYOgwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAn9zV7F/XVnFNZhHFrt0ZS1Yqz+qM9CojLmiyblMFh0p7t+Hh+VKVgMwrz0LwDH4UsOosXA28eJPmech6/bjfymkoXISy/NUSTFpUChGO9RabGGxJsT4dugOw9MPaIVZffny4qYOc/rXDXDSfF2b+303lLPI43y9qoe0oyZ1vtk/UKG75FkWfFUogGNbpOkuz+et5Y0aIEiyg0yh6/l5Q5h8+yom0HZnREHhqieGbkaGKLkyu7zQ4D4tRK/mBhd8nv+09GtPEG+D5LPbabFVxKjBMP4Vp24WuSUOqcGSsURHevawPVBfgmsxf1UCjelaIwngdh6WfNCRXa5QQPQTKubQvkvXONCDdhmdXQccnRX1nJWhPYi0onffvjsWUfztRypsKzX4dvM9k7xnIcGSGEnCC4RCgt1UiZIj7frcCMssbA6vJ9naM0s7JF7N3VKeHJtqe1OCRHMYnWUZt9vrqX6IoIHlZCoLlv39wFW9QNxelcAOCVbD+19MZ0ZXt7LitjIqe7yF5WxDQN4xru087FzQ4Hfj7eH1SNLLyKZkA1eecjmRoi/OoqAt7afSnwtQLtMUc2bQDg6rHt5C0e4dCLqP/9PGZTSJiwmtRHJ/N5qYWIh9ju83APvLm/AGBTR2pXmj9G3KdVOkpIC7L35dI623cSEC3Q3UZutsEm/UplsM="
SurfsharkOpenvpnStaticKeyV1 = "b02cb1d7c6fee5d4f89b8de72b51a8d0c7b282631d6fc19be1df6ebae9e2779e6d9f097058a31c97f57f0c35526a44ae09a01d1284b50b954d9246725a1ead1ff224a102ed9ab3da0152a15525643b2eee226c37041dc55539d475183b889a10e18bb94f079a4a49888da566b99783460ece01daaf93548beea6c827d9674897e7279ff1a19cb092659e8c1860fbad0db4ad0ad5732f1af4655dbd66214e552f04ed8fd0104e1d4bf99c249ac229ce169d9ba22068c6c0ab742424760911d4636aafb4b85f0c952a9ce4275bc821391aa65fcd0d2394f006e3fba0fd34c4bc4ab260f4b45dec3285875589c97d3087c9134d3a3aa2f904512e85aa2dc2202498"
)
func SurfsharkServers() []models.SurfsharkServer {
return []models.SurfsharkServer{
{Region: models.SurfsharkRegion("Albania"), IPs: []net.IP{{31, 171, 152, 195}, {31, 171, 152, 197}, {31, 171, 154, 147}, {31, 171, 154, 149}, {31, 171, 154, 163}, {31, 171, 154, 165}}},
{Region: models.SurfsharkRegion("Australia Adelaide"), IPs: []net.IP{{45, 248, 79, 19}, {45, 248, 79, 21}, {45, 248, 79, 27}, {45, 248, 79, 29}, {45, 248, 79, 35}, {45, 248, 79, 37}, {45, 248, 79, 51}, {45, 248, 79, 53}, {45, 248, 79, 67}, {45, 248, 79, 69}, {45, 248, 79, 83}, {45, 248, 79, 85}}},
{Region: models.SurfsharkRegion("Australia Brisbane"), IPs: []net.IP{{45, 248, 77, 235}, {45, 248, 77, 237}, {144, 48, 39, 11}, {144, 48, 39, 13}, {144, 48, 39, 67}, {144, 48, 39, 69}, {144, 48, 39, 83}, {144, 48, 39, 85}, {144, 48, 39, 107}, {144, 48, 39, 109}, {144, 48, 39, 123}, {144, 48, 39, 125}, {144, 48, 39, 131}, {144, 48, 39, 133}}},
{Region: models.SurfsharkRegion("Australia Melbourne"), IPs: []net.IP{{103, 192, 80, 131}, {103, 192, 80, 133}, {103, 192, 80, 139}, {103, 192, 80, 141}, {103, 192, 80, 147}, {103, 192, 80, 149}, {144, 48, 38, 19}, {144, 48, 38, 21}, {144, 48, 38, 139}, {144, 48, 38, 141}, {144, 48, 38, 147}, {144, 48, 38, 149}, {144, 48, 38, 179}, {144, 48, 38, 181}, {144, 48, 38, 183}}},
{Region: models.SurfsharkRegion("Australia Perth"), IPs: []net.IP{{45, 248, 78, 43}, {45, 248, 78, 45}, {124, 150, 139, 27}, {124, 150, 139, 29}, {124, 150, 139, 35}, {124, 150, 139, 37}, {124, 150, 139, 43}, {124, 150, 139, 45}, {124, 150, 139, 123}, {124, 150, 139, 125}, {124, 150, 139, 179}, {124, 150, 139, 181}}},
{Region: models.SurfsharkRegion("Australia Sydney"), IPs: []net.IP{{45, 125, 247, 43}, {45, 125, 247, 45}, {45, 125, 247, 91}, {45, 125, 247, 93}, {45, 125, 247, 195}, {45, 125, 247, 197}, {45, 248, 76, 171}, {45, 248, 76, 173}, {103, 25, 59, 51}, {103, 25, 59, 53}, {103, 25, 59, 83}, {103, 25, 59, 85}, {103, 25, 59, 87}, {180, 149, 228, 115}, {180, 149, 228, 117}}},
{Region: models.SurfsharkRegion("Austria"), IPs: []net.IP{{5, 253, 207, 51}, {5, 253, 207, 53}, {5, 253, 207, 83}, {5, 253, 207, 85}, {37, 120, 212, 75}, {37, 120, 212, 77}, {37, 120, 212, 131}, {37, 120, 212, 133}, {37, 120, 212, 139}, {37, 120, 212, 141}, {37, 120, 212, 147}, {37, 120, 212, 149}, {91, 132, 139, 101}, {91, 132, 139, 103}, {91, 132, 139, 105}, {91, 132, 139, 107}}},
{Region: models.SurfsharkRegion("Azerbaijan"), IPs: []net.IP{{94, 20, 21, 85}, {94, 20, 21, 87}}},
{Region: models.SurfsharkRegion("Belgium"), IPs: []net.IP{{5, 253, 205, 99}, {5, 253, 205, 101}, {5, 253, 205, 179}, {5, 253, 205, 181}, {5, 253, 205, 211}, {5, 253, 205, 213}, {5, 253, 205, 227}, {5, 253, 205, 229}, {37, 120, 143, 115}, {37, 120, 143, 121}, {37, 120, 143, 123}, {37, 120, 218, 251}, {37, 120, 218, 253}, {89, 249, 73, 195}, {89, 249, 73, 197}, {185, 104, 186, 75}, {185, 104, 186, 77}, {185, 232, 21, 51}, {185, 232, 21, 53}}},
{Region: models.SurfsharkRegion("Bosnia and Herzegovina"), IPs: []net.IP{{185, 99, 3, 7}, {185, 99, 3, 12}, {185, 99, 3, 205}, {185, 99, 3, 207}, {185, 99, 3, 212}, {185, 99, 3, 214}, {185, 164, 34, 250}, {185, 164, 34, 252}, {185, 212, 111, 6}, {185, 212, 111, 41}, {185, 212, 111, 59}}},
{Region: models.SurfsharkRegion("Brazil"), IPs: []net.IP{{181, 215, 183, 244}, {181, 215, 183, 248}, {191, 96, 70, 171}}},
{Region: models.SurfsharkRegion("Bulgaria"), IPs: []net.IP{{37, 120, 152, 35}, {37, 120, 152, 37}, {37, 120, 152, 39}, {37, 120, 152, 195}, {37, 120, 152, 197}, {217, 138, 202, 19}, {217, 138, 202, 21}}},
{Region: models.SurfsharkRegion("Canada Montreal"), IPs: []net.IP{{172, 98, 82, 83}, {172, 98, 82, 85}, {172, 98, 82, 243}, {172, 98, 82, 245}, {198, 8, 85, 3}, {198, 8, 85, 5}, {198, 8, 85, 19}, {198, 8, 85, 21}, {198, 8, 85, 35}, {198, 8, 85, 37}, {198, 8, 85, 40}, {198, 8, 85, 42}, {198, 8, 85, 45}, {198, 8, 85, 47}, {198, 8, 85, 67}, {198, 8, 85, 69}, {198, 8, 85, 74}, {198, 8, 85, 77}, {198, 8, 85, 79}, {198, 8, 85, 82}, {198, 8, 85, 84}, {198, 8, 85, 89}, {198, 8, 85, 131}, {198, 8, 85, 133}}},
{Region: models.SurfsharkRegion("Canada Toronto"), IPs: []net.IP{{68, 71, 244, 131}, {68, 71, 244, 134}, {68, 71, 244, 197}, {68, 71, 244, 200}, {68, 71, 244, 205}, {68, 71, 244, 207}, {68, 71, 244, 210}, {68, 71, 244, 212}, {68, 71, 244, 215}, {68, 71, 244, 217}, {68, 71, 244, 220}, {68, 71, 244, 222}, {104, 200, 138, 3}, {104, 200, 138, 5}, {104, 200, 138, 7}, {104, 200, 138, 147}, {104, 200, 138, 149}, {104, 200, 138, 152}, {104, 200, 138, 154}, {104, 200, 138, 163}, {104, 200, 138, 165}, {162, 253, 71, 211}, {162, 253, 71, 213}, {162, 253, 71, 215}}},
{Region: models.SurfsharkRegion("Canada Vancouver"), IPs: []net.IP{{66, 115, 147, 67}, {66, 115, 147, 69}, {66, 115, 147, 72}, {66, 115, 147, 74}, {66, 115, 147, 77}, {66, 115, 147, 79}, {66, 115, 147, 82}, {66, 115, 147, 84}, {66, 115, 147, 87}, {66, 115, 147, 89}, {66, 115, 147, 92}, {66, 115, 147, 94}, {104, 200, 132, 35}, {104, 200, 132, 37}, {104, 200, 132, 39}, {107, 181, 177, 179}, {107, 181, 177, 181}, {107, 181, 177, 183}, {172, 83, 40, 147}, {172, 83, 40, 149}, {208, 78, 41, 195}, {208, 78, 41, 197}, {208, 78, 41, 200}, {208, 78, 41, 202}}},
{Region: models.SurfsharkRegion("Chile"), IPs: []net.IP{{31, 169, 121, 16}}},
{Region: models.SurfsharkRegion("Colombia"), IPs: []net.IP{{45, 129, 32, 3}, {45, 129, 32, 5}, {45, 129, 32, 8}, {45, 129, 32, 10}, {45, 129, 32, 13}, {45, 129, 32, 15}}},
{Region: models.SurfsharkRegion("Costa Rica"), IPs: []net.IP{{176, 227, 241, 19}, {176, 227, 241, 21}}},
{Region: models.SurfsharkRegion("Croatia"), IPs: []net.IP{{85, 10, 56, 224}, {85, 10, 56, 226}, {85, 10, 56, 228}, {89, 164, 99, 109}, {89, 164, 99, 111}}},
{Region: models.SurfsharkRegion("Cyprus"), IPs: []net.IP{{195, 47, 194, 40}, {195, 47, 194, 42}}},
{Region: models.SurfsharkRegion("Czech Republic"), IPs: []net.IP{{95, 168, 209, 111}, {185, 152, 64, 151}, {185, 152, 64, 178}, {193, 9, 112, 179}, {193, 9, 112, 181}, {193, 9, 112, 183}, {193, 9, 112, 195}, {193, 9, 112, 197}, {193, 9, 112, 199}}},
{Region: models.SurfsharkRegion("Denmark"), IPs: []net.IP{{37, 120, 145, 19}, {37, 120, 145, 21}, {37, 120, 194, 91}, {37, 120, 194, 93}, {37, 120, 194, 99}, {37, 120, 194, 101}, {37, 120, 194, 107}, {37, 120, 194, 109}, {37, 120, 194, 115}, {37, 120, 194, 117}, {37, 120, 194, 123}, {37, 120, 194, 125}, {37, 120, 194, 163}, {37, 120, 194, 165}, {45, 12, 221, 163}, {45, 12, 221, 165}, {45, 12, 221, 167}, {45, 12, 221, 179}, {45, 12, 221, 183}, {95, 174, 65, 67}, {95, 174, 65, 69}, {95, 174, 65, 71}, {95, 174, 65, 73}}},
{Region: models.SurfsharkRegion("Estonia"), IPs: []net.IP{{165, 231, 163, 3}, {165, 231, 163, 5}, {165, 231, 163, 7}, {185, 174, 159, 51}, {185, 174, 159, 53}, {185, 174, 159, 59}, {185, 174, 159, 61}, {185, 174, 159, 67}, {185, 174, 159, 69}}},
{Region: models.SurfsharkRegion("Finland"), IPs: []net.IP{{196, 244, 191, 163}, {196, 244, 191, 165}, {196, 244, 191, 195}, {196, 244, 191, 197}}},
{Region: models.SurfsharkRegion("France Bordeaux"), IPs: []net.IP{{185, 108, 106, 19}, {185, 108, 106, 21}, {185, 108, 106, 51}, {185, 108, 106, 53}, {185, 108, 106, 67}, {185, 108, 106, 69}, {185, 108, 106, 140}, {185, 108, 106, 142}, {185, 108, 106, 144}, {185, 108, 106, 146}, {185, 108, 106, 148}, {185, 108, 106, 150}, {185, 108, 106, 152}, {185, 108, 106, 154}, {185, 108, 106, 156}, {185, 108, 106, 158}, {185, 108, 106, 160}, {185, 108, 106, 162}, {185, 108, 106, 164}, {185, 108, 106, 166}}},
{Region: models.SurfsharkRegion("France Marseilles"), IPs: []net.IP{{185, 166, 84, 5}, {185, 166, 84, 13}, {185, 166, 84, 19}, {185, 166, 84, 23}, {185, 166, 84, 29}, {185, 166, 84, 31}, {185, 166, 84, 33}, {185, 166, 84, 51}, {185, 166, 84, 53}, {185, 166, 84, 55}, {185, 166, 84, 57}, {185, 166, 84, 59}, {185, 166, 84, 65}, {185, 166, 84, 75}, {185, 166, 84, 77}, {185, 166, 84, 81}, {185, 166, 84, 85}, {185, 166, 84, 91}}},
{Region: models.SurfsharkRegion("France Paris"), IPs: []net.IP{{45, 83, 90, 181}, {45, 83, 90, 183}, {45, 89, 174, 59}, {45, 89, 174, 61}, {45, 89, 174, 83}, {45, 89, 174, 85}, {45, 89, 174, 91}, {45, 89, 174, 93}, {45, 89, 174, 99}, {45, 89, 174, 103}, {84, 17, 43, 178}, {84, 17, 43, 180}, {84, 17, 43, 183}, {84, 17, 60, 235}, {84, 17, 60, 250}, {84, 247, 51, 235}, {84, 247, 51, 237}, {84, 247, 51, 245}, {84, 247, 51, 253}, {185, 246, 211, 69}, {185, 246, 211, 103}, {217, 138, 207, 243}, {217, 138, 207, 251}, {217, 138, 207, 253}}},
{Region: models.SurfsharkRegion("Germany Berlin"), IPs: []net.IP{{37, 120, 217, 131}, {37, 120, 217, 133}, {37, 120, 217, 147}, {37, 120, 217, 149}, {37, 120, 217, 181}, {152, 89, 163, 19}, {152, 89, 163, 21}, {152, 89, 163, 23}, {152, 89, 163, 227}, {152, 89, 163, 245}, {152, 89, 163, 247}, {193, 176, 86, 197}, {193, 176, 86, 199}, {217, 138, 216, 59}, {217, 138, 216, 61}, {217, 138, 216, 219}, {217, 138, 216, 221}, {217, 138, 216, 227}, {217, 138, 216, 229}, {217, 138, 216, 235}, {217, 138, 216, 237}, {217, 138, 216, 243}, {217, 138, 216, 245}, {217, 138, 216, 251}, {217, 138, 216, 253}}},
{Region: models.SurfsharkRegion("Germany Frankfurt am Main st001"), IPs: []net.IP{{45, 87, 212, 179}}},
{Region: models.SurfsharkRegion("Germany Frankfurt am Main st002"), IPs: []net.IP{{45, 87, 212, 181}}},
{Region: models.SurfsharkRegion("Germany Frankfurt am Main st003"), IPs: []net.IP{{45, 87, 212, 183}}},
{Region: models.SurfsharkRegion("Germany Frankfurt am Main"), IPs: []net.IP{{37, 120, 196, 53}, {37, 120, 196, 59}, {37, 120, 196, 61}, {37, 120, 196, 173}, {37, 120, 197, 11}, {37, 120, 197, 13}, {82, 102, 16, 99}, {82, 102, 16, 101}, {84, 16, 240, 174}, {84, 16, 240, 176}, {89, 187, 169, 104}, {89, 187, 169, 119}, {185, 59, 220, 144}, {185, 59, 220, 150}, {185, 59, 220, 168}, {185, 59, 220, 172}, {185, 93, 180, 99}, {185, 93, 180, 101}, {185, 102, 219, 6}, {185, 102, 219, 47}, {185, 102, 219, 49}, {185, 158, 135, 34}, {185, 158, 135, 36}, {185, 158, 135, 38}}},
{Region: models.SurfsharkRegion("Germany Munich"), IPs: []net.IP{{178, 238, 231, 49}, {178, 238, 231, 51}, {178, 238, 231, 53}, {178, 238, 231, 55}}},
{Region: models.SurfsharkRegion("Germany Nuremberg"), IPs: []net.IP{{62, 171, 149, 160}, {62, 171, 149, 162}, {62, 171, 151, 180}, {62, 171, 151, 182}}},
{Region: models.SurfsharkRegion("Greece"), IPs: []net.IP{{87, 239, 248, 78}, {87, 239, 248, 80}, {87, 239, 248, 82}, {87, 239, 248, 85}, {87, 239, 248, 87}, {185, 226, 65, 150}}},
{Region: models.SurfsharkRegion("Hong Kong"), IPs: []net.IP{{64, 120, 121, 212}, {64, 120, 121, 214}, {64, 120, 121, 216}, {64, 120, 121, 232}, {64, 120, 121, 234}, {64, 120, 121, 236}, {64, 120, 121, 238}, {64, 120, 121, 240}, {64, 120, 121, 244}, {64, 120, 121, 246}, {64, 120, 121, 248}, {84, 17, 37, 154}, {84, 17, 37, 156}, {84, 17, 37, 158}, {84, 17, 37, 160}, {84, 17, 57, 185}, {209, 58, 186, 10}, {209, 58, 186, 12}, {209, 58, 186, 16}, {209, 58, 186, 18}}},
{Region: models.SurfsharkRegion("Hungary"), IPs: []net.IP{{37, 120, 144, 147}, {37, 120, 144, 149}, {37, 120, 144, 151}, {37, 120, 144, 195}, {37, 120, 144, 197}, {37, 120, 144, 199}, {37, 120, 144, 211}, {37, 120, 144, 213}, {37, 120, 144, 215}, {37, 120, 144, 243}, {37, 120, 144, 245}}},
{Region: models.SurfsharkRegion("Iceland"), IPs: []net.IP{{82, 221, 128, 156}}},
{Region: models.SurfsharkRegion("India Chennai"), IPs: []net.IP{{103, 94, 27, 99}, {103, 94, 27, 101}, {103, 94, 27, 115}, {103, 94, 27, 117}, {103, 94, 27, 179}, {103, 94, 27, 181}, {103, 94, 27, 227}, {103, 94, 27, 229}, {103, 108, 117, 131}, {103, 108, 117, 133}, {103, 108, 117, 147}, {103, 108, 117, 149}, {103, 108, 117, 151}}},
{Region: models.SurfsharkRegion("India Indore"), IPs: []net.IP{{103, 39, 132, 187}, {103, 39, 132, 189}, {103, 73, 189, 219}, {103, 73, 189, 221}, {137, 59, 52, 107}, {137, 59, 52, 109}}},
{Region: models.SurfsharkRegion("India Mumbai"), IPs: []net.IP{{103, 221, 233, 61}, {103, 221, 233, 86}, {103, 221, 233, 88}, {103, 221, 233, 89}, {103, 221, 233, 91}, {165, 231, 253, 147}, {165, 231, 253, 149}, {165, 231, 253, 163}, {165, 231, 253, 165}}},
{Region: models.SurfsharkRegion("Indonesia"), IPs: []net.IP{{103, 227, 255, 211}, {103, 227, 255, 213}, {103, 227, 255, 215}}},
{Region: models.SurfsharkRegion("Ireland"), IPs: []net.IP{{185, 108, 128, 114}, {185, 108, 128, 118}, {185, 108, 128, 159}, {185, 108, 128, 161}, {185, 108, 128, 181}, {185, 108, 128, 183}, {185, 108, 128, 185}, {217, 138, 222, 43}, {217, 138, 222, 45}, {217, 138, 222, 51}, {217, 138, 222, 53}}},
{Region: models.SurfsharkRegion("Israel"), IPs: []net.IP{{87, 239, 255, 107}, {87, 239, 255, 109}, {87, 239, 255, 111}, {87, 239, 255, 114}, {87, 239, 255, 116}, {87, 239, 255, 119}, {87, 239, 255, 121}}},
{Region: models.SurfsharkRegion("Italy Milan"), IPs: []net.IP{{37, 120, 201, 19}, {37, 120, 201, 67}, {84, 17, 58, 146}, {84, 17, 58, 148}, {84, 17, 58, 154}, {84, 17, 58, 156}, {84, 17, 58, 159}, {84, 17, 58, 166}, {84, 17, 58, 192}, {84, 17, 58, 207}, {95, 174, 64, 73}, {212, 102, 54, 145}, {212, 102, 54, 147}, {212, 102, 54, 150}, {212, 102, 54, 155}, {212, 102, 54, 157}, {212, 102, 54, 162}, {212, 102, 54, 165}, {212, 102, 54, 167}, {212, 102, 54, 170}, {212, 102, 54, 177}, {212, 102, 54, 180}, {212, 102, 54, 182}, {212, 102, 55, 66}, {212, 102, 55, 68}}},
{Region: models.SurfsharkRegion("Italy Rome"), IPs: []net.IP{{37, 120, 207, 5}, {82, 102, 26, 114}, {82, 102, 26, 115}, {82, 102, 26, 117}, {87, 101, 94, 210}, {87, 101, 94, 211}, {87, 101, 94, 213}, {87, 101, 94, 215}, {87, 101, 94, 226}, {185, 217, 71, 2}, {185, 217, 71, 3}, {185, 217, 71, 5}, {185, 217, 71, 18}, {185, 217, 71, 50}, {185, 217, 71, 187}, {185, 217, 71, 211}, {185, 217, 71, 213}, {185, 217, 71, 235}, {185, 217, 71, 251}, {185, 217, 71, 253}, {217, 138, 219, 221}, {217, 138, 219, 227}, {217, 138, 219, 229}, {217, 138, 219, 243}}},
{Region: models.SurfsharkRegion("Japan Tokyo st001"), IPs: []net.IP{{45, 87, 213, 19}}},
{Region: models.SurfsharkRegion("Japan Tokyo st002"), IPs: []net.IP{{45, 87, 213, 21}}},
{Region: models.SurfsharkRegion("Japan Tokyo st003"), IPs: []net.IP{{45, 87, 213, 23}}},
{Region: models.SurfsharkRegion("Japan Tokyo st004"), IPs: []net.IP{{217, 138, 212, 19}}},
{Region: models.SurfsharkRegion("Japan Tokyo st005"), IPs: []net.IP{{217, 138, 212, 21}}},
{Region: models.SurfsharkRegion("Japan Tokyo st006"), IPs: []net.IP{{82, 102, 28, 123}}},
{Region: models.SurfsharkRegion("Japan Tokyo st007"), IPs: []net.IP{{82, 102, 28, 125}}},
{Region: models.SurfsharkRegion("Japan Tokyo"), IPs: []net.IP{{45, 87, 213, 3}, {45, 87, 213, 5}, {45, 87, 213, 7}, {45, 87, 213, 83}, {45, 87, 213, 85}, {45, 87, 213, 87}, {45, 87, 213, 101}, {45, 87, 213, 103}, {45, 87, 213, 105}, {45, 87, 213, 211}, {45, 87, 213, 213}, {45, 87, 213, 243}, {45, 87, 213, 245}, {84, 17, 34, 24}, {84, 17, 34, 26}, {84, 17, 34, 44}, {84, 17, 34, 46}, {89, 187, 161, 2}, {89, 187, 161, 4}, {89, 187, 161, 239}, {89, 187, 161, 241}, {103, 208, 221, 227}, {103, 208, 221, 229}, {185, 242, 4, 163}}},
{Region: models.SurfsharkRegion("Kazakhstan"), IPs: []net.IP{{45, 136, 56, 57}, {45, 136, 56, 61}, {45, 136, 56, 64}}},
{Region: models.SurfsharkRegion("Korea"), IPs: []net.IP{{27, 255, 77, 195}, {27, 255, 77, 197}, {27, 255, 77, 226}, {61, 14, 210, 229}, {61, 14, 210, 232}, {61, 14, 210, 234}, {61, 14, 210, 237}, {61, 14, 210, 239}, {61, 14, 210, 242}, {61, 14, 210, 244}, {61, 97, 243, 112}, {61, 97, 243, 119}, {61, 97, 243, 124}, {103, 249, 28, 209}, {103, 249, 28, 215}, {103, 249, 28, 227}, {103, 249, 28, 229}, {103, 249, 28, 231}, {103, 249, 31, 24}, {103, 249, 31, 28}}},
{Region: models.SurfsharkRegion("Latvia"), IPs: []net.IP{{91, 203, 70, 186}, {91, 203, 70, 188}, {188, 92, 78, 135}, {188, 92, 78, 137}, {188, 92, 78, 140}, {188, 92, 78, 142}, {188, 92, 78, 145}, {188, 92, 78, 147}, {188, 92, 78, 150}, {188, 92, 78, 152}}},
{Region: models.SurfsharkRegion("Libya"), IPs: []net.IP{{41, 208, 72, 157}, {41, 208, 72, 158}, {41, 208, 72, 204}, {41, 208, 72, 207}}},
{Region: models.SurfsharkRegion("Luxembourg"), IPs: []net.IP{{185, 153, 151, 64}, {185, 153, 151, 68}, {185, 153, 151, 73}, {185, 153, 151, 75}, {185, 153, 151, 78}, {185, 153, 151, 80}, {185, 153, 151, 82}, {185, 153, 151, 83}, {185, 153, 151, 85}, {185, 153, 151, 87}, {185, 153, 151, 89}, {185, 153, 151, 91}}},
{Region: models.SurfsharkRegion("Malaysia"), IPs: []net.IP{{42, 0, 30, 135}, {42, 0, 30, 160}, {42, 0, 30, 162}, {42, 0, 30, 164}, {42, 0, 30, 177}, {42, 0, 30, 179}, {42, 0, 30, 209}, {42, 0, 30, 213}, {42, 0, 30, 215}}},
{Region: models.SurfsharkRegion("Moldova"), IPs: []net.IP{{178, 175, 148, 39}}},
{Region: models.SurfsharkRegion("Netherlands Amsterdam st001"), IPs: []net.IP{{81, 19, 209, 51}}},
{Region: models.SurfsharkRegion("Netherlands Amsterdam"), IPs: []net.IP{{81, 19, 208, 56}, {81, 19, 209, 20}, {81, 19, 209, 59}, {81, 19, 209, 100}, {81, 19, 209, 113}, {81, 19, 209, 120}, {81, 19, 209, 124}, {89, 46, 223, 72}, {89, 46, 223, 76}, {89, 46, 223, 80}, {89, 46, 223, 86}, {89, 46, 223, 88}, {89, 46, 223, 94}, {89, 46, 223, 98}, {89, 46, 223, 102}, {89, 46, 223, 167}, {89, 46, 223, 169}, {89, 46, 223, 214}, {89, 46, 223, 219}, {89, 46, 223, 224}, {89, 187, 174, 229}, {89, 187, 174, 231}, {185, 59, 222, 92}, {185, 59, 222, 166}, {185, 59, 222, 168}}},
{Region: models.SurfsharkRegion("New Zealand"), IPs: []net.IP{{180, 149, 231, 3}, {180, 149, 231, 11}, {180, 149, 231, 13}, {180, 149, 231, 43}, {180, 149, 231, 45}, {180, 149, 231, 67}, {180, 149, 231, 69}, {180, 149, 231, 115}, {180, 149, 231, 117}, {180, 149, 231, 119}, {180, 149, 231, 165}}},
{Region: models.SurfsharkRegion("Nigeria"), IPs: []net.IP{{102, 165, 23, 4}, {102, 165, 23, 38}, {102, 165, 23, 40}, {102, 165, 23, 42}, {102, 165, 23, 44}}},
{Region: models.SurfsharkRegion("North Macedonia"), IPs: []net.IP{{185, 225, 28, 67}, {185, 225, 28, 69}, {185, 225, 28, 83}, {185, 225, 28, 85}, {185, 225, 28, 91}, {185, 225, 28, 93}, {185, 225, 28, 99}, {185, 225, 28, 101}, {185, 225, 28, 107}, {185, 225, 28, 109}}},
{Region: models.SurfsharkRegion("Norway"), IPs: []net.IP{{45, 12, 223, 67}, {45, 12, 223, 69}, {45, 12, 223, 71}, {45, 12, 223, 195}, {45, 12, 223, 211}, {45, 12, 223, 213}, {84, 247, 50, 27}, {84, 247, 50, 29}, {84, 247, 50, 67}, {84, 247, 50, 69}, {95, 174, 66, 35}, {95, 174, 66, 37}, {95, 174, 66, 39}, {95, 174, 66, 41}}},
{Region: models.SurfsharkRegion("Paraguay"), IPs: []net.IP{{181, 40, 18, 56}, {186, 16, 32, 163}, {186, 16, 32, 168}, {186, 16, 32, 173}}},
{Region: models.SurfsharkRegion("Philippines"), IPs: []net.IP{{45, 134, 224, 3}, {45, 134, 224, 5}, {45, 134, 224, 8}, {45, 134, 224, 10}}},
{Region: models.SurfsharkRegion("Poland Gdansk"), IPs: []net.IP{{5, 187, 49, 187}, {5, 187, 49, 189}, {5, 187, 53, 51}, {5, 187, 53, 53}, {5, 187, 53, 55}}},
{Region: models.SurfsharkRegion("Poland Warsaw"), IPs: []net.IP{{5, 253, 206, 67}, {5, 253, 206, 69}, {5, 253, 206, 71}, {5, 253, 206, 75}, {5, 253, 206, 77}, {5, 253, 206, 227}, {5, 253, 206, 229}, {84, 17, 55, 132}, {84, 17, 55, 134}, {185, 246, 208, 72}, {185, 246, 208, 77}, {185, 246, 208, 105}, {185, 246, 208, 107}, {185, 246, 208, 176}, {185, 246, 208, 182}}},
{Region: models.SurfsharkRegion("Portugal Lisbon"), IPs: []net.IP{{5, 154, 174, 26}, {5, 154, 174, 65}, {5, 154, 174, 67}, {5, 154, 174, 75}, {5, 154, 174, 77}, {5, 154, 174, 99}, {5, 154, 174, 101}, {5, 154, 174, 115}, {5, 154, 174, 117}, {5, 154, 174, 171}, {5, 154, 174, 173}, {5, 154, 174, 179}, {5, 154, 174, 181}, {5, 154, 174, 187}, {5, 154, 174, 189}, {5, 154, 174, 211}, {5, 154, 174, 213}, {5, 154, 174, 219}, {5, 154, 174, 221}, {5, 154, 174, 227}}},
{Region: models.SurfsharkRegion("Portugal Loule"), IPs: []net.IP{{176, 61, 146, 84}, {176, 61, 146, 86}, {176, 61, 146, 106}, {176, 61, 146, 108}, {176, 61, 146, 111}, {176, 61, 146, 113}, {176, 61, 146, 116}, {176, 61, 146, 118}, {176, 61, 146, 121}, {176, 61, 146, 123}, {176, 61, 148, 60}, {176, 61, 148, 62}}},
{Region: models.SurfsharkRegion("Portugal Porto"), IPs: []net.IP{{194, 39, 127, 21}, {194, 39, 127, 23}, {194, 39, 127, 36}, {194, 39, 127, 38}, {194, 39, 127, 231}, {194, 39, 127, 233}, {194, 39, 127, 244}}},
{Region: models.SurfsharkRegion("Romania"), IPs: []net.IP{{86, 106, 137, 147}, {86, 106, 137, 149}, {194, 68, 44, 61}}},
{Region: models.SurfsharkRegion("Russia Moscow"), IPs: []net.IP{{213, 183, 56, 18}, {213, 183, 56, 145}, {213, 183, 56, 160}, {213, 183, 56, 166}, {213, 183, 56, 233}, {213, 183, 56, 236}}},
{Region: models.SurfsharkRegion("Russia St. Petersburg"), IPs: []net.IP{{213, 183, 54, 109}, {213, 183, 54, 110}, {213, 183, 54, 143}, {213, 183, 54, 165}}},
{Region: models.SurfsharkRegion("Serbia"), IPs: []net.IP{{37, 120, 193, 51}, {37, 120, 193, 53}, {152, 89, 160, 115}, {152, 89, 160, 117}, {152, 89, 160, 119}, {152, 89, 160, 121}, {152, 89, 160, 123}, {152, 89, 160, 125}, {152, 89, 160, 211}, {152, 89, 160, 213}, {152, 89, 160, 215}}},
{Region: models.SurfsharkRegion("Singapore st001"), IPs: []net.IP{{217, 138, 201, 91}}},
{Region: models.SurfsharkRegion("Singapore st002"), IPs: []net.IP{{217, 138, 201, 93}}},
{Region: models.SurfsharkRegion("Singapore st003"), IPs: []net.IP{{84, 247, 49, 19}}},
{Region: models.SurfsharkRegion("Singapore st004"), IPs: []net.IP{{84, 247, 49, 21}}},
{Region: models.SurfsharkRegion("Singapore"), IPs: []net.IP{{89, 187, 163, 130}, {89, 187, 163, 132}, {89, 187, 163, 134}, {89, 187, 163, 136}, {103, 254, 153, 169}, {103, 254, 153, 171}, {103, 254, 153, 176}, {103, 254, 155, 229}, {103, 254, 155, 241}, {209, 58, 170, 134}, {209, 58, 170, 142}, {209, 58, 170, 144}, {209, 58, 170, 146}, {209, 58, 170, 159}, {209, 58, 170, 163}, {209, 58, 170, 164}, {209, 58, 170, 169}, {209, 58, 170, 172}, {209, 58, 176, 24}, {209, 58, 176, 43}, {209, 58, 176, 45}, {209, 58, 176, 47}}},
{Region: models.SurfsharkRegion("Slovekia"), IPs: []net.IP{{37, 120, 221, 3}, {37, 120, 221, 5}, {193, 37, 255, 35}, {193, 37, 255, 37}, {193, 37, 255, 39}, {193, 37, 255, 41}}},
{Region: models.SurfsharkRegion("Slovenia"), IPs: []net.IP{{195, 158, 249, 36}, {195, 158, 249, 38}, {195, 158, 249, 40}, {195, 158, 249, 42}}},
{Region: models.SurfsharkRegion("South Africa"), IPs: []net.IP{{154, 127, 49, 226}, {154, 127, 49, 228}, {154, 127, 49, 230}, {154, 127, 49, 232}, {154, 127, 57, 62}, {196, 251, 250, 111}}},
{Region: models.SurfsharkRegion("Spain Barcelona"), IPs: []net.IP{{37, 120, 142, 131}, {37, 120, 142, 133}, {37, 120, 142, 135}, {185, 188, 61, 3}, {185, 188, 61, 5}}},
{Region: models.SurfsharkRegion("Spain Madrid"), IPs: []net.IP{{37, 120, 148, 215}, {82, 102, 17, 181}, {82, 102, 17, 185}, {84, 17, 62, 163}, {84, 17, 62, 165}, {84, 17, 62, 179}, {84, 17, 62, 181}, {89, 37, 95, 7}, {89, 37, 95, 11}, {89, 37, 95, 15}, {89, 37, 95, 17}, {89, 37, 95, 19}, {89, 37, 95, 21}, {89, 37, 95, 23}, {89, 37, 95, 25}, {89, 37, 95, 27}, {188, 208, 141, 100}, {212, 102, 48, 2}, {212, 102, 48, 4}, {212, 102, 48, 8}, {212, 102, 48, 10}, {212, 102, 48, 13}, {212, 102, 48, 15}, {212, 102, 48, 18}, {212, 102, 48, 20}}},
{Region: models.SurfsharkRegion("Spain Valencia"), IPs: []net.IP{{185, 153, 150, 44}, {185, 153, 150, 46}, {185, 153, 150, 48}, {185, 153, 150, 50}, {185, 153, 150, 52}, {185, 153, 150, 54}, {185, 153, 150, 56}, {185, 153, 150, 58}, {196, 196, 150, 67}, {196, 196, 150, 71}, {196, 196, 150, 83}, {196, 196, 150, 85}}},
{Region: models.SurfsharkRegion("Sweden"), IPs: []net.IP{{45, 83, 91, 131}, {45, 83, 91, 133}, {45, 83, 91, 135}, {45, 83, 91, 147}, {45, 83, 91, 149}, {45, 83, 91, 151}, {46, 227, 69, 21}, {46, 227, 69, 23}, {46, 227, 69, 25}, {46, 227, 69, 27}, {46, 227, 69, 29}, {185, 76, 9, 34}, {185, 76, 9, 36}, {185, 76, 9, 39}, {185, 76, 9, 41}, {185, 76, 9, 44}, {185, 76, 9, 46}, {185, 76, 9, 49}, {185, 76, 9, 51}}},
{Region: models.SurfsharkRegion("Switzerland"), IPs: []net.IP{{37, 120, 213, 3}, {37, 120, 213, 5}, {37, 120, 213, 7}, {45, 12, 222, 243}, {45, 12, 222, 245}, {84, 17, 53, 86}, {84, 17, 53, 166}, {84, 17, 53, 168}, {84, 17, 53, 208}, {84, 17, 53, 210}, {84, 17, 53, 212}, {84, 17, 53, 214}, {84, 17, 53, 216}, {84, 17, 53, 219}, {84, 17, 53, 221}, {84, 17, 53, 223}, {84, 17, 53, 225}, {84, 17, 53, 227}, {84, 39, 112, 35}}},
{Region: models.SurfsharkRegion("Taiwan"), IPs: []net.IP{{2, 58, 241, 3}, {2, 58, 241, 5}, {2, 58, 242, 43}, {2, 58, 242, 45}, {2, 58, 242, 155}, {2, 58, 242, 157}, {2, 58, 243, 53}, {103, 51, 140, 70}, {103, 51, 140, 74}, {103, 98, 74, 227}, {103, 98, 74, 229}, {103, 98, 75, 71}, {103, 98, 75, 73}}},
{Region: models.SurfsharkRegion("Thailand"), IPs: []net.IP{{45, 64, 186, 132}, {45, 64, 186, 134}, {45, 64, 186, 163}, {103, 253, 74, 3}}},
{Region: models.SurfsharkRegion("Turkey"), IPs: []net.IP{{185, 195, 79, 3}, {185, 195, 79, 5}}},
{Region: models.SurfsharkRegion("UK Glasgow"), IPs: []net.IP{{185, 108, 105, 3}, {185, 108, 105, 5}, {185, 108, 105, 7}, {185, 108, 105, 13}, {185, 108, 105, 15}, {185, 108, 105, 18}, {185, 108, 105, 20}, {185, 108, 105, 38}, {185, 108, 105, 40}, {185, 108, 105, 55}, {185, 108, 105, 57}}},
{Region: models.SurfsharkRegion("UK London st001"), IPs: []net.IP{{217, 146, 82, 83}}},
{Region: models.SurfsharkRegion("UK London st002"), IPs: []net.IP{{185, 134, 22, 80}}},
{Region: models.SurfsharkRegion("UK London st003"), IPs: []net.IP{{185, 134, 22, 92}}},
{Region: models.SurfsharkRegion("UK London st004"), IPs: []net.IP{{185, 44, 76, 186}}},
{Region: models.SurfsharkRegion("UK London st005"), IPs: []net.IP{{185, 44, 76, 188}}},
{Region: models.SurfsharkRegion("UK London"), IPs: []net.IP{{5, 226, 137, 10}, {5, 226, 139, 65}, {5, 226, 139, 149}, {5, 226, 139, 225}, {89, 34, 99, 83}, {178, 239, 166, 218}, {178, 239, 166, 227}, {178, 239, 166, 231}, {178, 239, 166, 234}, {178, 239, 166, 250}, {185, 16, 206, 69}, {185, 16, 206, 75}, {185, 38, 148, 232}, {185, 38, 150, 41}, {185, 38, 150, 88}, {185, 38, 150, 124}, {185, 44, 76, 55}, {185, 44, 76, 167}, {185, 44, 76, 172}, {185, 44, 78, 164}, {185, 114, 224, 53}, {185, 114, 224, 119}, {185, 125, 207, 155}, {185, 125, 207, 177}, {185, 193, 36, 212}}},
{Region: models.SurfsharkRegion("UK Manchester"), IPs: []net.IP{{37, 120, 200, 2}, {86, 106, 136, 69}, {86, 106, 136, 77}, {86, 106, 136, 83}, {89, 238, 130, 196}, {89, 238, 140, 226}, {89, 238, 140, 227}, {89, 238, 140, 229}, {89, 238, 143, 100}, {89, 238, 143, 101}, {89, 238, 143, 103}, {89, 238, 143, 105}, {92, 119, 176, 19}, {92, 119, 176, 21}, {92, 119, 176, 23}, {192, 145, 126, 130}, {192, 145, 126, 131}, {192, 145, 126, 133}, {193, 148, 17, 82}, {193, 148, 17, 130}, {195, 12, 48, 212}, {195, 12, 48, 213}, {195, 12, 48, 215}, {195, 12, 48, 217}, {217, 138, 196, 93}}},
{Region: models.SurfsharkRegion("Ukraine"), IPs: []net.IP{{45, 9, 238, 23}, {45, 9, 238, 30}, {45, 9, 238, 38}, {45, 9, 238, 47}}},
{Region: models.SurfsharkRegion("United Arab Emirates"), IPs: []net.IP{{45, 9, 249, 243}, {45, 9, 249, 245}, {45, 9, 249, 247}, {45, 9, 250, 99}, {45, 9, 250, 101}, {45, 9, 250, 103}}},
{Region: models.SurfsharkRegion("US Atlanta"), IPs: []net.IP{{66, 115, 154, 131}, {66, 115, 154, 135}, {66, 115, 154, 147}, {66, 115, 154, 149}, {66, 115, 154, 151}, {66, 115, 169, 35}, {66, 115, 175, 35}, {66, 115, 175, 37}, {66, 115, 175, 40}, {66, 115, 175, 42}, {66, 115, 175, 45}, {66, 115, 175, 47}, {66, 115, 175, 50}, {66, 115, 175, 52}, {185, 93, 0, 143}, {185, 93, 0, 146}}},
{Region: models.SurfsharkRegion("US Bend"), IPs: []net.IP{{45, 43, 14, 73}, {45, 43, 14, 75}, {45, 43, 14, 83}, {45, 43, 14, 85}, {45, 43, 14, 93}, {45, 43, 14, 95}, {45, 43, 14, 103}, {45, 43, 14, 105}, {154, 16, 168, 184}, {154, 16, 168, 186}, {154, 16, 168, 188}}},
{Region: models.SurfsharkRegion("US Boston"), IPs: []net.IP{{173, 237, 207, 11}, {173, 237, 207, 21}, {173, 237, 207, 23}, {173, 237, 207, 25}, {173, 237, 207, 30}, {173, 237, 207, 36}, {173, 237, 207, 38}, {173, 237, 207, 42}, {173, 237, 207, 44}, {192, 34, 83, 230}, {192, 34, 83, 232}, {192, 34, 83, 234}, {192, 34, 83, 236}, {199, 217, 107, 25}, {199, 217, 107, 27}}},
{Region: models.SurfsharkRegion("US Buffalo"), IPs: []net.IP{{107, 174, 20, 130}, {107, 174, 20, 134}, {107, 175, 104, 82}, {107, 175, 104, 84}, {172, 93, 153, 146}, {172, 93, 153, 148}, {172, 93, 153, 150}}},
{Region: models.SurfsharkRegion("US Charlotte"), IPs: []net.IP{{66, 11, 124, 136}, {66, 11, 124, 138}, {66, 11, 124, 140}, {66, 11, 124, 142}, {66, 11, 124, 144}, {66, 11, 124, 146}, {155, 254, 28, 141}, {155, 254, 29, 163}, {155, 254, 29, 165}, {155, 254, 31, 182}, {155, 254, 31, 184}, {192, 154, 253, 67}, {192, 154, 253, 69}, {192, 154, 254, 135}, {192, 154, 254, 137}, {192, 154, 255, 52}, {192, 154, 255, 54}}},
{Region: models.SurfsharkRegion("US Chicago"), IPs: []net.IP{{74, 119, 146, 115}, {74, 119, 146, 117}, {74, 119, 146, 119}, {74, 119, 146, 131}, {74, 119, 146, 133}, {74, 119, 146, 135}, {74, 119, 146, 181}, {74, 119, 146, 197}, {74, 119, 146, 199}, {74, 119, 146, 211}, {89, 187, 182, 173}, {89, 187, 182, 175}, {107, 152, 100, 19}, {107, 152, 100, 21}, {107, 152, 100, 24}, {107, 152, 100, 26}, {184, 170, 250, 67}, {184, 170, 250, 72}, {184, 170, 250, 74}, {184, 170, 250, 147}, {184, 170, 250, 149}, {184, 170, 250, 152}, {184, 170, 250, 154}}},
{Region: models.SurfsharkRegion("US Dallas"), IPs: []net.IP{{66, 115, 177, 131}, {66, 115, 177, 133}, {66, 115, 177, 136}, {66, 115, 177, 138}, {66, 115, 177, 141}, {66, 115, 177, 143}, {66, 115, 177, 146}, {66, 115, 177, 148}, {66, 115, 177, 151}, {66, 115, 177, 153}, {66, 115, 177, 156}, {66, 115, 177, 158}, {89, 187, 175, 165}, {89, 187, 175, 167}, {107, 181, 173, 163}, {172, 241, 114, 87}, {172, 241, 114, 89}, {212, 102, 40, 66}, {212, 102, 40, 68}, {212, 102, 40, 71}, {212, 102, 40, 73}, {212, 102, 40, 76}, {212, 102, 40, 78}, {212, 102, 40, 81}}},
{Region: models.SurfsharkRegion("US Denver"), IPs: []net.IP{{174, 128, 245, 3}, {174, 128, 245, 5}, {212, 102, 44, 66}, {212, 102, 44, 68}, {212, 102, 44, 71}, {212, 102, 44, 73}, {212, 102, 44, 76}, {212, 102, 44, 78}, {212, 102, 44, 81}, {212, 102, 44, 83}, {212, 102, 44, 86}, {212, 102, 44, 88}, {212, 102, 44, 91}, {212, 102, 44, 93}}},
{Region: models.SurfsharkRegion("US Gahanna"), IPs: []net.IP{{104, 244, 208, 35}, {104, 244, 208, 37}, {104, 244, 208, 99}, {104, 244, 208, 101}, {104, 244, 208, 107}, {104, 244, 208, 109}, {104, 244, 208, 203}, {104, 244, 208, 205}, {104, 244, 208, 229}, {104, 244, 208, 231}, {104, 244, 209, 51}, {104, 244, 209, 53}, {104, 244, 211, 139}, {104, 244, 211, 141}, {104, 244, 211, 171}, {104, 244, 211, 173}, {104, 244, 211, 179}}},
{Region: models.SurfsharkRegion("US Houston"), IPs: []net.IP{{104, 148, 30, 35}, {104, 148, 30, 39}, {104, 148, 30, 55}, {104, 148, 30, 83}, {104, 148, 30, 85}, {199, 10, 64, 67}, {199, 10, 64, 69}, {199, 10, 64, 83}, {199, 10, 64, 85}, {199, 10, 64, 99}, {199, 10, 64, 101}, {199, 10, 64, 115}, {199, 10, 64, 117}}},
{Region: models.SurfsharkRegion("US Kansas City"), IPs: []net.IP{{63, 141, 236, 243}, {63, 141, 236, 245}, {63, 141, 248, 179}, {63, 141, 248, 181}, {107, 150, 39, 43}, {173, 208, 202, 59}, {173, 208, 202, 61}, {198, 204, 231, 147}, {198, 204, 231, 149}, {204, 12, 208, 115}, {204, 12, 208, 117}}},
{Region: models.SurfsharkRegion("US Las Vegas"), IPs: []net.IP{{89, 187, 187, 147}, {89, 187, 187, 149}, {185, 242, 5, 211}, {185, 242, 5, 213}, {185, 242, 5, 215}}},
{Region: models.SurfsharkRegion("US Latham"), IPs: []net.IP{{45, 43, 19, 66}, {45, 43, 19, 68}, {45, 43, 19, 74}, {45, 43, 19, 82}, {45, 43, 19, 84}, {45, 43, 19, 90}, {45, 43, 19, 92}, {154, 16, 169, 3}, {154, 16, 169, 5}, {154, 16, 169, 7}}},
{Region: models.SurfsharkRegion("US Los Angeles"), IPs: []net.IP{{38, 95, 110, 67}, {38, 95, 110, 69}, {38, 95, 110, 71}, {38, 95, 110, 73}, {89, 187, 187, 66}, {89, 187, 187, 68}, {89, 187, 187, 71}, {89, 187, 187, 73}, {89, 187, 187, 78}, {89, 187, 187, 81}, {89, 187, 187, 83}, {89, 187, 187, 88}, {172, 83, 44, 83}, {184, 170, 243, 195}, {184, 170, 243, 199}, {184, 170, 243, 211}, {184, 170, 243, 215}, {192, 111, 134, 67}, {192, 111, 134, 195}, {192, 111, 134, 200}, {192, 111, 134, 215}, {192, 111, 134, 217}, {192, 111, 134, 220}, {212, 103, 49, 147}}},
{Region: models.SurfsharkRegion("US Maryland"), IPs: []net.IP{{23, 82, 8, 173}, {23, 105, 160, 134}, {23, 105, 160, 138}, {23, 105, 160, 144}, {23, 105, 163, 94}, {207, 244, 67, 147}, {207, 244, 67, 149}, {207, 244, 84, 40}, {207, 244, 84, 42}, {207, 244, 84, 44}, {207, 244, 84, 58}, {207, 244, 127, 116}, {207, 244, 127, 118}}},
{Region: models.SurfsharkRegion("US Miami"), IPs: []net.IP{{89, 187, 173, 201}, {89, 187, 173, 250}, {107, 181, 164, 35}, {107, 181, 164, 211}, {172, 83, 42, 19}, {172, 83, 42, 23}, {172, 83, 42, 37}, {172, 83, 42, 53}, {172, 83, 42, 55}, {172, 83, 42, 83}, {172, 83, 42, 85}, {172, 83, 42, 131}, {172, 83, 42, 133}, {172, 83, 42, 136}, {172, 83, 42, 138}, {172, 83, 42, 143}, {172, 83, 42, 146}, {172, 83, 42, 148}, {172, 83, 42, 151}, {172, 83, 42, 153}, {172, 83, 42, 156}, {172, 83, 42, 158}, {193, 37, 252, 195}, {193, 37, 252, 197}}},
{Region: models.SurfsharkRegion("US New York City mp001"), IPs: []net.IP{{45, 55, 60, 159}}},
{Region: models.SurfsharkRegion("US New York City st001"), IPs: []net.IP{{92, 119, 177, 19}}},
{Region: models.SurfsharkRegion("US New York City st002"), IPs: []net.IP{{92, 119, 177, 21}}},
{Region: models.SurfsharkRegion("US New York City st003"), IPs: []net.IP{{92, 119, 177, 23}}},
{Region: models.SurfsharkRegion("US New York City st004"), IPs: []net.IP{{193, 148, 18, 51}}},
{Region: models.SurfsharkRegion("US New York City st005"), IPs: []net.IP{{193, 148, 18, 53}}},
{Region: models.SurfsharkRegion("US New York City"), IPs: []net.IP{{37, 120, 202, 3}, {37, 120, 202, 5}, {84, 17, 35, 66}, {84, 17, 35, 73}, {84, 17, 35, 78}, {84, 17, 35, 83}, {84, 17, 35, 86}, {84, 17, 35, 91}, {84, 17, 35, 93}, {89, 187, 177, 122}, {89, 187, 178, 92}, {89, 187, 178, 94}, {98, 142, 220, 35}, {98, 142, 220, 37}, {107, 152, 101, 163}, {172, 98, 78, 229}, {192, 40, 59, 227}, {192, 40, 59, 229}, {192, 40, 59, 238}, {199, 36, 221, 85}, {199, 36, 221, 101}, {199, 36, 221, 104}, {199, 36, 221, 111}, {199, 36, 221, 114}, {199, 36, 221, 119}}},
{Region: models.SurfsharkRegion("US Orlando"), IPs: []net.IP{{198, 147, 22, 83}, {198, 147, 22, 85}, {198, 147, 22, 87}, {198, 147, 22, 131}, {198, 147, 22, 133}, {198, 147, 22, 135}, {198, 147, 22, 149}, {198, 147, 22, 151}, {198, 147, 22, 163}, {198, 147, 22, 165}, {198, 147, 22, 195}, {198, 147, 22, 197}, {198, 147, 22, 211}, {198, 147, 22, 213}}},
{Region: models.SurfsharkRegion("US Phoenix"), IPs: []net.IP{{23, 83, 128, 233}, {23, 83, 128, 237}, {23, 83, 128, 239}, {23, 83, 128, 241}, {23, 83, 128, 243}, {107, 181, 184, 115}, {107, 181, 184, 117}, {172, 98, 87, 35}, {172, 98, 87, 37}, {184, 170, 240, 147}, {184, 170, 240, 149}, {184, 170, 240, 151}, {184, 170, 240, 179}, {184, 170, 240, 181}, {199, 58, 187, 3}, {199, 58, 187, 5}, {199, 58, 187, 8}, {199, 58, 187, 10}, {199, 58, 187, 15}, {199, 58, 187, 18}, {199, 58, 187, 20}, {199, 58, 187, 23}, {199, 58, 187, 25}, {199, 58, 187, 67}, {199, 58, 187, 69}}},
{Region: models.SurfsharkRegion("US Saint Louis"), IPs: []net.IP{{148, 72, 170, 108}, {148, 72, 174, 36}, {148, 72, 174, 38}, {148, 72, 174, 41}, {148, 72, 174, 43}, {148, 72, 174, 46}, {148, 72, 174, 48}, {148, 72, 174, 51}, {148, 72, 174, 53}}},
{Region: models.SurfsharkRegion("US Salt Lake City"), IPs: []net.IP{{104, 200, 131, 5}, {104, 200, 131, 7}, {104, 200, 131, 9}, {104, 200, 131, 165}, {104, 200, 131, 167}, {104, 200, 131, 170}, {104, 200, 131, 172}}},
{Region: models.SurfsharkRegion("US San Francisco"), IPs: []net.IP{{107, 181, 166, 35}, {107, 181, 166, 37}, {107, 181, 166, 39}, {107, 181, 166, 51}, {107, 181, 166, 55}, {107, 181, 166, 83}, {107, 181, 166, 85}, {107, 181, 166, 227}, {107, 181, 166, 229}, {198, 8, 81, 35}, {198, 8, 81, 37}, {209, 58, 128, 48}, {209, 58, 128, 50}}},
{Region: models.SurfsharkRegion("US Seatle"), IPs: []net.IP{{84, 17, 41, 71}, {84, 17, 41, 73}, {84, 17, 41, 75}, {84, 17, 41, 77}, {84, 17, 41, 79}, {84, 17, 41, 81}, {84, 17, 41, 83}, {104, 200, 129, 243}, {104, 200, 129, 245}, {198, 8, 80, 83}, {198, 8, 80, 85}, {198, 8, 80, 87}, {198, 8, 80, 227}, {198, 8, 80, 229}, {199, 229, 250, 163}, {199, 229, 250, 165}}},
{Region: models.SurfsharkRegion("US Tampa"), IPs: []net.IP{{66, 206, 23, 3}, {66, 206, 23, 5}, {74, 50, 117, 106}, {74, 50, 117, 119}, {74, 50, 117, 121}, {74, 50, 117, 125}, {162, 220, 56, 98}, {162, 220, 56, 100}, {162, 220, 63, 226}, {162, 220, 63, 232}, {162, 220, 63, 248}, {209, 216, 92, 197}, {209, 216, 92, 200}, {209, 216, 92, 202}, {209, 216, 92, 205}, {209, 216, 92, 207}, {209, 216, 92, 210}, {209, 216, 92, 212}, {209, 216, 92, 215}, {209, 216, 92, 217}, {209, 216, 92, 222}, {209, 216, 92, 225}, {209, 216, 92, 227}}},
{Region: models.SurfsharkRegion("Vietnam"), IPs: []net.IP{{202, 143, 110, 37}}},
}
}
func SurfsharkRegionChoices() (choices []string) {
servers := SurfsharkServers()
choices = make([]string, len(servers))
for i := range servers {
choices[i] = string(servers[i].Region)
}
return choices
}

View File

@@ -11,6 +11,8 @@ const (
Mullvad models.VPNProvider = "mullvad"
// Windscribe is a VPN provider
Windscribe models.VPNProvider = "windscribe"
// Surfshark is a VPN provider
Surfshark models.VPNProvider = "surfshark"
)
const (

View File

@@ -19,6 +19,8 @@ type (
MullvadProvider string
// WindscribeCity is used as the region for a Windscribe server
WindscribeRegion string
// SurfsharkRegion is used as the region for a Surfshark server
SurfsharkRegion string
// URL is an HTTP(s) URL address
URL string
// Filepath is a local filesytem file path

View File

@@ -0,0 +1,8 @@
package models
import "net"
type SurfsharkServer struct {
Region SurfsharkRegion
IPs []net.IP
}

View File

@@ -65,6 +65,9 @@ type Reader interface {
GetWindscribeRegion() (country models.WindscribeRegion, err error)
GetWindscribePort(protocol models.NetworkProtocol) (port uint16, err error)
// Surfshark getters
GetSurfsharkRegion() (country models.SurfsharkRegion, err error)
// Shadowsocks getters
GetShadowSocks() (activated bool, err error)
GetShadowSocksLog() (activated bool, err error)
@@ -105,7 +108,7 @@ func NewReader(logger logging.Logger) Reader {
// GetVPNSP obtains the VPN service provider to use from the environment variable VPNSP
func (p *reader) GetVPNSP() (vpnServiceProvider models.VPNProvider, err error) {
s, err := p.envParams.GetValueIfInside("VPNSP", []string{"pia", "private internet access", "mullvad", "windscribe"})
s, err := p.envParams.GetValueIfInside("VPNSP", []string{"pia", "private internet access", "mullvad", "windscribe", "surfshark"})
if s == "pia" {
s = "private internet access"
}

View File

@@ -0,0 +1,15 @@
package params
import (
"strings"
"github.com/qdm12/private-internet-access-docker/internal/constants"
"github.com/qdm12/private-internet-access-docker/internal/models"
)
// GetSurfsharkRegion obtains the region for the Surfshark server from the
// environment variable REGION
func (p *reader) GetSurfsharkRegion() (region models.SurfsharkRegion, err error) {
s, err := p.envParams.GetValueIfInside("REGION", constants.SurfsharkRegionChoices())
return models.SurfsharkRegion(strings.ToLower(s)), err
}

View File

@@ -16,6 +16,7 @@ type Settings struct {
PIA PIA
Mullvad Mullvad
Windscribe Windscribe
Surfshark Surfshark
System System
DNS DNS
Firewall Firewall
@@ -32,6 +33,8 @@ func (s *Settings) String() string {
vpnServiceProviderSettings = s.Mullvad.String()
case constants.Windscribe:
vpnServiceProviderSettings = s.Windscribe.String()
case constants.Surfshark:
vpnServiceProviderSettings = s.Surfshark.String()
}
return strings.Join([]string{
"Settings summary below:",
@@ -46,9 +49,11 @@ func (s *Settings) String() string {
}, "\n")
}
const aes256cbc = "aes-256-cbc"
// GetAllSettings obtains all settings for the program and returns an error as soon
// as an error is encountered reading them.
func GetAllSettings(paramsReader params.Reader) (settings Settings, err error) {
func GetAllSettings(paramsReader params.Reader) (settings Settings, err error) { //nolint:gocyclo
settings.VPNSP, err = paramsReader.GetVPNSP()
if err != nil {
return settings, err
@@ -60,7 +65,7 @@ func GetAllSettings(paramsReader params.Reader) (settings Settings, err error) {
switch settings.VPNSP {
case constants.PrivateInternetAccess:
switch settings.OpenVPN.Cipher {
case "", "aes-128-cbc", "aes-256-cbc", "aes-128-gcm", "aes-256-gcm":
case "", "aes-128-cbc", aes256cbc, "aes-128-gcm", "aes-256-gcm":
default:
return settings, fmt.Errorf("cipher %q is not supported by Private Internet Access", settings.OpenVPN.Cipher)
}
@@ -84,7 +89,7 @@ func GetAllSettings(paramsReader params.Reader) (settings Settings, err error) {
settings.Mullvad, err = GetMullvadSettings(paramsReader)
case constants.Windscribe:
switch settings.OpenVPN.Cipher {
case "", "aes-256-cbc", "aes-256-gcm": // TODO check inside params getters
case "", aes256cbc, "aes-256-gcm": // TODO check inside params getters
default:
return settings, fmt.Errorf("cipher %q is not supported by Windscribe", settings.OpenVPN.Cipher)
}
@@ -94,6 +99,18 @@ func GetAllSettings(paramsReader params.Reader) (settings Settings, err error) {
return settings, fmt.Errorf("auth algorithm %q is not supported by Windscribe", settings.OpenVPN.Auth)
}
settings.Windscribe, err = GetWindscribeSettings(paramsReader, settings.OpenVPN.NetworkProtocol)
case constants.Surfshark:
switch settings.OpenVPN.Cipher {
case "", aes256cbc: // TODO check inside params getters
default:
return settings, fmt.Errorf("cipher %q is not supported by Surfshark", settings.OpenVPN.Cipher)
}
switch settings.OpenVPN.Auth {
case "", "sha512":
default:
return settings, fmt.Errorf("auth algorithm %q is not supported by Surfshark", settings.OpenVPN.Auth)
}
settings.Surfshark, err = GetSurfsharkSettings(paramsReader)
default:
err = fmt.Errorf("VPN service provider %q is not valid", settings.VPNSP)
}

View File

@@ -0,0 +1,42 @@
package settings
import (
"strings"
"github.com/qdm12/private-internet-access-docker/internal/models"
"github.com/qdm12/private-internet-access-docker/internal/params"
)
// Surfshark contains the settings to connect to a Surfshark server
type Surfshark struct {
User string
Password string
Region models.SurfsharkRegion
}
func (s *Surfshark) String() string {
settingsList := []string{
"Surfshark settings:",
"User: [redacted]",
"Password: [redacted]",
"Region: " + strings.Title(string(s.Region)),
}
return strings.Join(settingsList, "\n |--")
}
// GetSurfsharkSettings obtains Surfshark settings from environment variables using the params package.
func GetSurfsharkSettings(paramsReader params.Reader) (settings Surfshark, err error) {
settings.User, err = paramsReader.GetUser()
if err != nil {
return settings, err
}
settings.Password, err = paramsReader.GetPassword()
if err != nil {
return settings, err
}
settings.Region, err = paramsReader.GetSurfsharkRegion()
if err != nil {
return settings, err
}
return settings, nil
}

115
internal/surfshark/conf.go Normal file
View File

@@ -0,0 +1,115 @@
package surfshark
import (
"fmt"
"net"
"strings"
"github.com/qdm12/golibs/files"
"github.com/qdm12/private-internet-access-docker/internal/constants"
"github.com/qdm12/private-internet-access-docker/internal/models"
)
func (c *configurator) GetOpenVPNConnections(region models.SurfsharkRegion, protocol models.NetworkProtocol, targetIP net.IP) (connections []models.OpenVPNConnection, err error) {
var IPs []net.IP
for _, server := range constants.SurfsharkServers() {
if strings.EqualFold(string(server.Region), string(region)) {
IPs = server.IPs
}
}
if len(IPs) == 0 {
return nil, fmt.Errorf("no IP found for region %q", region)
}
if targetIP != nil {
found := false
for i := range IPs {
if IPs[i].Equal(targetIP) {
found = true
break
}
}
if !found {
return nil, fmt.Errorf("target IP address %q not found in IP addresses", targetIP)
}
IPs = []net.IP{targetIP}
}
var port uint16
switch {
case protocol == constants.TCP:
port = 1443
case protocol == constants.UDP:
port = 1194
default:
return nil, fmt.Errorf("protocol %q is unknown", protocol)
}
for _, IP := range IPs {
connections = append(connections, models.OpenVPNConnection{IP: IP, Port: port, Protocol: protocol})
}
return connections, nil
}
func (c *configurator) BuildConf(connections []models.OpenVPNConnection, verbosity, uid, gid int, root bool, cipher, auth string) (err error) {
if len(cipher) == 0 {
cipher = "AES-256-CBC"
}
if len(auth) == 0 {
auth = "SHA512"
}
lines := []string{
"client",
"dev tun",
"nobind",
"persist-key",
"persist-tun",
"remote-cert-tls server",
// Surfshark specific
"resolv-retry infinite",
"tun-mtu 1500",
"tun-mtu-extra 32",
"mssfix 1450",
"ping 15",
"ping-restart 0",
"ping-timer-rem",
"reneg-sec 0",
"fast-io",
"key-direction 1",
// Added constant values
"auth-nocache",
"mute-replay-warnings",
"pull-filter ignore \"auth-token\"", // prevent auth failed loops
"auth-retry nointeract",
"remote-random",
"suppress-timestamps",
// Modified variables
fmt.Sprintf("verb %d", verbosity),
fmt.Sprintf("auth-user-pass %s", constants.OpenVPNAuthConf),
fmt.Sprintf("proto %s", string(connections[0].Protocol)),
fmt.Sprintf("cipher %s", cipher),
fmt.Sprintf("auth %s", auth),
}
if !root {
lines = append(lines, "user nonrootuser")
}
for _, connection := range connections {
lines = append(lines, fmt.Sprintf("remote %s %d", connection.IP.String(), connection.Port))
}
lines = append(lines, []string{
"<ca>",
"-----BEGIN CERTIFICATE-----",
constants.SurfsharkCertificate,
"-----END CERTIFICATE-----",
"</ca>",
}...)
lines = append(lines, []string{
"<tls-auth>",
"-----BEGIN OpenVPN Static key V1-----",
constants.SurfsharkOpenvpnStaticKeyV1,
"-----END OpenVPN Static key V1-----",
"</tls-auth>",
"",
}...)
return c.fileManager.WriteLinesToFile(string(constants.OpenVPNConf), lines, files.Ownership(uid, gid), files.Permissions(0400))
}

View File

@@ -0,0 +1,24 @@
package surfshark
import (
"net"
"github.com/qdm12/golibs/files"
"github.com/qdm12/private-internet-access-docker/internal/models"
)
// Configurator contains methods to read and modify the openvpn configuration to connect as a client
type Configurator interface {
GetOpenVPNConnections(region models.SurfsharkRegion, protocol models.NetworkProtocol, targetIP net.IP) (connections []models.OpenVPNConnection, err error)
BuildConf(connections []models.OpenVPNConnection, verbosity, uid, gid int, root bool, cipher, auth string) (err error)
}
type configurator struct {
fileManager files.FileManager
lookupIP func(host string) ([]net.IP, error)
}
// NewConfigurator returns a new Configurator object
func NewConfigurator(fileManager files.FileManager) Configurator {
return &configurator{fileManager, net.LookupIP}
}