mirror of
https://github.com/qdm12/gluetun.git
synced 2026-07-28 05:16:28 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 957537c2a6 | |||
| 17f24343d6 | |||
| ebbc630b31 | |||
| 39ac8b3432 |
@@ -44,7 +44,6 @@ jobs:
|
|||||||
locale: "US"
|
locale: "US"
|
||||||
level: error
|
level: error
|
||||||
exclude: |
|
exclude: |
|
||||||
./internal/storage/servers.json
|
|
||||||
./.golangci.yml
|
./.golangci.yml
|
||||||
*.md
|
*.md
|
||||||
|
|
||||||
@@ -98,7 +97,7 @@ jobs:
|
|||||||
github.event_name == 'release' ||
|
github.event_name == 'release' ||
|
||||||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')
|
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')
|
||||||
)
|
)
|
||||||
needs: [ verify ]
|
needs: [verify]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: secrets
|
environment: secrets
|
||||||
steps:
|
steps:
|
||||||
@@ -120,7 +119,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Gluetun container with ProtonVPN Wireguard and port forwarding
|
- name: Run Gluetun container with ProtonVPN Wireguard and port forwarding
|
||||||
configuration
|
configuration
|
||||||
run: echo -e "${{ secrets.PROTONVPN_WIREGUARD_PRIVATE_KEY }}" | ./ci/runner
|
run:
|
||||||
|
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,7 +129,8 @@ jobs:
|
|||||||
secrets.PROTONVPN_OPENVPN_PASSWORD }}" | ./ci/runner
|
secrets.PROTONVPN_OPENVPN_PASSWORD }}" | ./ci/runner
|
||||||
protonvpn-openvpn-port-forwarding
|
protonvpn-openvpn-port-forwarding
|
||||||
|
|
||||||
- name: Run Gluetun container with Private Internet Access OpenVPN and port
|
- name:
|
||||||
|
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
|
||||||
@@ -141,7 +142,8 @@ 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: echo -e "${{ secrets.AIRVPN_OPENVPN_KEY }}\n${{ secrets.AIRVPN_OPENVPN_CERT
|
run:
|
||||||
|
echo -e "${{ secrets.AIRVPN_OPENVPN_KEY }}\n${{ secrets.AIRVPN_OPENVPN_CERT
|
||||||
}}" | ./ci/runner airvpn-openvpn
|
}}" | ./ci/runner airvpn-openvpn
|
||||||
|
|
||||||
codeql:
|
codeql:
|
||||||
@@ -169,7 +171,7 @@ jobs:
|
|||||||
github.event_name == 'release' ||
|
github.event_name == 'release' ||
|
||||||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')
|
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')
|
||||||
)
|
)
|
||||||
needs: [ verify, verify-private, codeql ]
|
needs: [verify, verify-private, codeql]
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
actions: read
|
||||||
contents: read
|
contents: read
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -104,6 +105,10 @@ 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,6 +6,7 @@ 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"
|
||||||
@@ -65,7 +66,11 @@ func modifyConfig(lines []string, connection models.Connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add values
|
// Add values
|
||||||
modified = append(modified, "proto "+connection.Protocol)
|
protocol := 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,32 +1,23 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path/filepath"
|
||||||
|
|
||||||
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed servers.json
|
|
||||||
var allServersEmbedFS embed.FS
|
|
||||||
|
|
||||||
func parseHardcodedServers() (allServers models.AllServers) {
|
func parseHardcodedServers() (allServers models.AllServers) {
|
||||||
f, err := allServersEmbedFS.Open("servers.json")
|
allProviders := providers.All()
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
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 {
|
const version = 1
|
||||||
filename := path.Base(metadata.Filepath)
|
allServers.ProviderToServers = make(map[string]models.Servers, len(allProviders))
|
||||||
|
allServers.Version = version
|
||||||
|
for _, provider := range allProviders {
|
||||||
|
filename := provider + ".json"
|
||||||
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))
|
||||||
@@ -44,7 +35,8 @@ func parseHardcodedServers() (allServers models.AllServers) {
|
|||||||
filename, provider))
|
filename, provider))
|
||||||
}
|
}
|
||||||
|
|
||||||
providerServers.Filepath = metadata.Filepath // inherit filepath from servers.json
|
const serversPath = "/gluetun/servers/"
|
||||||
|
providerServers.Filepath = filepath.Join(serversPath, filename)
|
||||||
allServers.ProviderToServers[provider] = providerServers
|
allServers.ProviderToServers[provider] = providerServers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,5 @@ 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; "+
|
panic(fmt.Sprintf("provider %s not found in hardcoded servers map", provider))
|
||||||
"did you add the provider key in the embedded servers.json?", provider))
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,8 +152,7 @@ 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; "+
|
expectedPanicValue := fmt.Sprintf("provider %s not found in hardcoded servers map", allProviders[1])
|
||||||
"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)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
{
|
|
||||||
"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