mirror of
https://github.com/qdm12/gluetun.git
synced 2026-07-22 02:16:29 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b4040d3d3f |
@@ -44,6 +44,7 @@ jobs:
|
|||||||
locale: "US"
|
locale: "US"
|
||||||
level: error
|
level: error
|
||||||
exclude: |
|
exclude: |
|
||||||
|
./internal/storage/servers.json
|
||||||
./.golangci.yml
|
./.golangci.yml
|
||||||
*.md
|
*.md
|
||||||
|
|
||||||
@@ -119,8 +120,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Gluetun container with ProtonVPN Wireguard and port forwarding
|
- name: Run Gluetun container with ProtonVPN Wireguard and port forwarding
|
||||||
configuration
|
configuration
|
||||||
run:
|
run: echo -e "${{ secrets.PROTONVPN_WIREGUARD_PRIVATE_KEY }}" | ./ci/runner
|
||||||
echo -e "${{ secrets.PROTONVPN_WIREGUARD_PRIVATE_KEY }}" | ./ci/runner
|
|
||||||
protonvpn-wireguard-port-forwarding
|
protonvpn-wireguard-port-forwarding
|
||||||
|
|
||||||
- name: Run Gluetun container with ProtonVPN OpenVPN and port forwarding
|
- name: Run Gluetun container with ProtonVPN OpenVPN and port forwarding
|
||||||
@@ -129,8 +129,7 @@ jobs:
|
|||||||
secrets.PROTONVPN_OPENVPN_PASSWORD }}" | ./ci/runner
|
secrets.PROTONVPN_OPENVPN_PASSWORD }}" | ./ci/runner
|
||||||
protonvpn-openvpn-port-forwarding
|
protonvpn-openvpn-port-forwarding
|
||||||
|
|
||||||
- name:
|
- name: Run Gluetun container with Private Internet Access OpenVPN and port
|
||||||
Run Gluetun container with Private Internet Access OpenVPN and port
|
|
||||||
forwarding configuration
|
forwarding configuration
|
||||||
run: echo -e "${{ secrets.PRIVATEINTERNETACCESS_OPENVPN_USER }}\n${{
|
run: echo -e "${{ secrets.PRIVATEINTERNETACCESS_OPENVPN_USER }}\n${{
|
||||||
secrets.PRIVATEINTERNETACCESS_OPENVPN_PASSWORD }}" | ./ci/runner
|
secrets.PRIVATEINTERNETACCESS_OPENVPN_PASSWORD }}" | ./ci/runner
|
||||||
@@ -142,8 +141,7 @@ jobs:
|
|||||||
secrets.AIRVPN_WIREGUARD_ADDRESSES }}" | ./ci/runner airvpn-wireguard
|
secrets.AIRVPN_WIREGUARD_ADDRESSES }}" | ./ci/runner airvpn-wireguard
|
||||||
|
|
||||||
- name: Run Gluetun container with AirVPN OpenVPN configuration
|
- name: Run Gluetun container with AirVPN OpenVPN configuration
|
||||||
run:
|
run: echo -e "${{ secrets.AIRVPN_OPENVPN_KEY }}\n${{ secrets.AIRVPN_OPENVPN_CERT
|
||||||
echo -e "${{ secrets.AIRVPN_OPENVPN_KEY }}\n${{ secrets.AIRVPN_OPENVPN_CERT
|
|
||||||
}}" | ./ci/runner airvpn-openvpn
|
}}" | ./ci/runner airvpn-openvpn
|
||||||
|
|
||||||
codeql:
|
codeql:
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -105,10 +104,6 @@ func (c *CLI) Update(ctx context.Context, args []string, logger UpdaterLogger) e
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating DoH dialer: %w", err)
|
return fmt.Errorf("creating DoH dialer: %w", err)
|
||||||
}
|
}
|
||||||
net.DefaultResolver = &net.Resolver{
|
|
||||||
PreferGo: true,
|
|
||||||
Dial: dnsDialer.Dial,
|
|
||||||
}
|
|
||||||
|
|
||||||
const clientTimeout = 10 * time.Second
|
const clientTimeout = 10 * time.Second
|
||||||
httpClient := &http.Client{Timeout: clientTimeout}
|
httpClient := &http.Client{Timeout: clientTimeout}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||||
"github.com/qdm12/gluetun/internal/constants"
|
|
||||||
"github.com/qdm12/gluetun/internal/constants/openvpn"
|
"github.com/qdm12/gluetun/internal/constants/openvpn"
|
||||||
"github.com/qdm12/gluetun/internal/models"
|
"github.com/qdm12/gluetun/internal/models"
|
||||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||||
@@ -66,11 +65,7 @@ func modifyConfig(lines []string, connection models.Connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add values
|
// Add values
|
||||||
protocol := connection.Protocol
|
modified = append(modified, "proto "+connection.Protocol)
|
||||||
if protocol == constants.TCP {
|
|
||||||
protocol = "tcp-client"
|
|
||||||
}
|
|
||||||
modified = append(modified, "proto "+protocol)
|
|
||||||
modified = append(modified, fmt.Sprintf("remote %s %d", connection.IP, connection.Port))
|
modified = append(modified, fmt.Sprintf("remote %s %d", connection.IP, connection.Port))
|
||||||
modified = append(modified, "dev "+settings.Interface)
|
modified = append(modified, "dev "+settings.Interface)
|
||||||
modified = append(modified, "mute-replay-warnings")
|
modified = append(modified, "mute-replay-warnings")
|
||||||
|
|||||||
@@ -1,23 +1,32 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path"
|
||||||
|
|
||||||
serversmodule "github.com/qdm12/gluetun-servers/pkg/servers"
|
serversmodule "github.com/qdm12/gluetun-servers/pkg/servers"
|
||||||
"github.com/qdm12/gluetun/internal/constants/providers"
|
|
||||||
"github.com/qdm12/gluetun/internal/models"
|
"github.com/qdm12/gluetun/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseHardcodedServers() (allServers models.AllServers) {
|
//go:embed servers.json
|
||||||
allProviders := providers.All()
|
var allServersEmbedFS embed.FS
|
||||||
|
|
||||||
const version = 1
|
func parseHardcodedServers() (allServers models.AllServers) {
|
||||||
allServers.ProviderToServers = make(map[string]models.Servers, len(allProviders))
|
f, err := allServersEmbedFS.Open("servers.json")
|
||||||
allServers.Version = version
|
if err != nil {
|
||||||
for _, provider := range allProviders {
|
panic(err)
|
||||||
filename := provider + ".json"
|
}
|
||||||
|
defer f.Close() // no-op
|
||||||
|
decoder := json.NewDecoder(f)
|
||||||
|
err = decoder.Decode(&allServers)
|
||||||
|
if err != nil {
|
||||||
|
panic("decoding servers.json: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
for provider, metadata := range allServers.ProviderToServers {
|
||||||
|
filename := path.Base(metadata.Filepath)
|
||||||
providerFile, err := serversmodule.Files.Open(filename)
|
providerFile, err := serversmodule.Files.Open(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("reading embedded provider file %s for %s: %s", filename, provider, err))
|
panic(fmt.Sprintf("reading embedded provider file %s for %s: %s", filename, provider, err))
|
||||||
@@ -35,8 +44,7 @@ func parseHardcodedServers() (allServers models.AllServers) {
|
|||||||
filename, provider))
|
filename, provider))
|
||||||
}
|
}
|
||||||
|
|
||||||
const serversPath = "/gluetun/servers/"
|
providerServers.Filepath = metadata.Filepath // inherit filepath from servers.json
|
||||||
providerServers.Filepath = filepath.Join(serversPath, filename)
|
|
||||||
allServers.ProviderToServers[provider] = providerServers
|
allServers.ProviderToServers[provider] = providerServers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ package storage
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
func panicOnProviderMissingHardcoded(provider string) {
|
func panicOnProviderMissingHardcoded(provider string) {
|
||||||
panic(fmt.Sprintf("provider %s not found in hardcoded servers map", provider))
|
panic(fmt.Sprintf("provider %s not found in hardcoded servers map; "+
|
||||||
|
"did you add the provider key in the embedded servers.json?", provider))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,8 @@ func Test_extractServersFromBytes(t *testing.T) {
|
|||||||
allProviders[0]: 1,
|
allProviders[0]: 1,
|
||||||
// Missing provider allProviders[1]
|
// Missing provider allProviders[1]
|
||||||
}
|
}
|
||||||
expectedPanicValue := fmt.Sprintf("provider %s not found in hardcoded servers map", allProviders[1])
|
expectedPanicValue := fmt.Sprintf("provider %s not found in hardcoded servers map; "+
|
||||||
|
"did you add the provider key in the embedded servers.json?", allProviders[1])
|
||||||
assert.PanicsWithValue(t, expectedPanicValue, func() {
|
assert.PanicsWithValue(t, expectedPanicValue, func() {
|
||||||
_, _ = s.extractServersFromBytes(b, hardcodedVersions)
|
_, _ = s.extractServersFromBytes(b, hardcodedVersions)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"airvpn": {
|
||||||
|
"filepath": "/gluetun/servers/airvpn.json"
|
||||||
|
},
|
||||||
|
"cyberghost": {
|
||||||
|
"filepath": "/gluetun/servers/cyberghost.json"
|
||||||
|
},
|
||||||
|
"expressvpn": {
|
||||||
|
"filepath": "/gluetun/servers/expressvpn.json"
|
||||||
|
},
|
||||||
|
"fastestvpn": {
|
||||||
|
"filepath": "/gluetun/servers/fastestvpn.json"
|
||||||
|
},
|
||||||
|
"giganews": {
|
||||||
|
"filepath": "/gluetun/servers/giganews.json"
|
||||||
|
},
|
||||||
|
"hidemyass": {
|
||||||
|
"filepath": "/gluetun/servers/hidemyass.json"
|
||||||
|
},
|
||||||
|
"ipvanish": {
|
||||||
|
"filepath": "/gluetun/servers/ipvanish.json"
|
||||||
|
},
|
||||||
|
"ivpn": {
|
||||||
|
"filepath": "/gluetun/servers/ivpn.json"
|
||||||
|
},
|
||||||
|
"mullvad": {
|
||||||
|
"filepath": "/gluetun/servers/mullvad.json"
|
||||||
|
},
|
||||||
|
"nordvpn": {
|
||||||
|
"filepath": "/gluetun/servers/nordvpn.json"
|
||||||
|
},
|
||||||
|
"perfect privacy": {
|
||||||
|
"filepath": "/gluetun/servers/perfect privacy.json"
|
||||||
|
},
|
||||||
|
"privado": {
|
||||||
|
"filepath": "/gluetun/servers/privado.json"
|
||||||
|
},
|
||||||
|
"private internet access": {
|
||||||
|
"filepath": "/gluetun/servers/private internet access.json"
|
||||||
|
},
|
||||||
|
"privatevpn": {
|
||||||
|
"filepath": "/gluetun/servers/privatevpn.json"
|
||||||
|
},
|
||||||
|
"protonvpn": {
|
||||||
|
"filepath": "/gluetun/servers/protonvpn.json"
|
||||||
|
},
|
||||||
|
"purevpn": {
|
||||||
|
"filepath": "/gluetun/servers/purevpn.json"
|
||||||
|
},
|
||||||
|
"slickvpn": {
|
||||||
|
"filepath": "/gluetun/servers/slickvpn.json"
|
||||||
|
},
|
||||||
|
"surfshark": {
|
||||||
|
"filepath": "/gluetun/servers/surfshark.json"
|
||||||
|
},
|
||||||
|
"torguard": {
|
||||||
|
"filepath": "/gluetun/servers/torguard.json"
|
||||||
|
},
|
||||||
|
"vpn unlimited": {
|
||||||
|
"filepath": "/gluetun/servers/vpn unlimited.json"
|
||||||
|
},
|
||||||
|
"vpnsecure": {
|
||||||
|
"filepath": "/gluetun/servers/vpnsecure.json"
|
||||||
|
},
|
||||||
|
"vyprvpn": {
|
||||||
|
"filepath": "/gluetun/servers/vyprvpn.json"
|
||||||
|
},
|
||||||
|
"windscribe": {
|
||||||
|
"filepath": "/gluetun/servers/windscribe.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user