chore(updater): move updater packages to pkg/updaters/<name>

This commit is contained in:
Quentin McGaw
2026-04-23 03:47:57 +00:00
parent 5b01324d5f
commit 13503b0ae0
268 changed files with 1602 additions and 1026 deletions
+23 -23
View File
@@ -8,11 +8,11 @@ import (
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/constants/vpn"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/qdm12/gluetun/pkg/updaters/constants"
umodels "github.com/qdm12/gluetun/pkg/updaters/models"
"github.com/stretchr/testify/assert"
)
@@ -21,7 +21,7 @@ func Test_GetConnection(t *testing.T) {
testCases := map[string]struct {
provider string
filteredServers []models.Server
filteredServers []umodels.Server
filterError error
serverSelection settings.ServerSelection
defaults ConnectionDefaults
@@ -35,9 +35,9 @@ func Test_GetConnection(t *testing.T) {
errMessage: "filtering servers: test error",
},
"server without IPs": {
filteredServers: []models.Server{
{VPN: vpn.OpenVPN, UDP: true},
{VPN: vpn.OpenVPN, UDP: true},
filteredServers: []umodels.Server{
{VPN: constants.OpenVPN, UDP: true},
{VPN: constants.OpenVPN, UDP: true},
},
serverSelection: settings.ServerSelection{}.
WithDefaults(providers.Mullvad),
@@ -49,9 +49,9 @@ func Test_GetConnection(t *testing.T) {
errMessage: "no connection to pick from",
},
"OpenVPN server with hostname": {
filteredServers: []models.Server{
filteredServers: []umodels.Server{
{
VPN: vpn.OpenVPN,
VPN: constants.OpenVPN,
UDP: true,
IPs: []netip.Addr{netip.AddrFrom4([4]byte{1, 1, 1, 1})},
Hostname: "name",
@@ -62,7 +62,7 @@ func Test_GetConnection(t *testing.T) {
defaults: NewConnectionDefaults(443, 1194, 58820),
randSource: rand.NewSource(0),
connection: models.Connection{
Type: vpn.OpenVPN,
Type: constants.OpenVPN,
IP: netip.AddrFrom4([4]byte{1, 1, 1, 1}),
Protocol: constants.UDP,
Port: 1194,
@@ -70,9 +70,9 @@ func Test_GetConnection(t *testing.T) {
},
},
"OpenVPN server with x509": {
filteredServers: []models.Server{
filteredServers: []umodels.Server{
{
VPN: vpn.OpenVPN,
VPN: constants.OpenVPN,
UDP: true,
IPs: []netip.Addr{netip.AddrFrom4([4]byte{1, 1, 1, 1})},
Hostname: "hostname",
@@ -84,7 +84,7 @@ func Test_GetConnection(t *testing.T) {
defaults: NewConnectionDefaults(443, 1194, 58820),
randSource: rand.NewSource(0),
connection: models.Connection{
Type: vpn.OpenVPN,
Type: constants.OpenVPN,
IP: netip.AddrFrom4([4]byte{1, 1, 1, 1}),
Protocol: constants.UDP,
Port: 1194,
@@ -92,9 +92,9 @@ func Test_GetConnection(t *testing.T) {
},
},
"server with IPv4 and IPv6": {
filteredServers: []models.Server{
filteredServers: []umodels.Server{
{
VPN: vpn.OpenVPN,
VPN: constants.OpenVPN,
UDP: true,
IPs: []netip.Addr{
netip.AddrFrom4([4]byte{1, 1, 1, 1}),
@@ -112,16 +112,16 @@ func Test_GetConnection(t *testing.T) {
defaults: NewConnectionDefaults(443, 1194, 58820),
randSource: rand.NewSource(0),
connection: models.Connection{
Type: vpn.OpenVPN,
Type: constants.OpenVPN,
IP: netip.AddrFrom4([4]byte{1, 1, 1, 1}),
Protocol: constants.UDP,
Port: 1194,
},
},
"server with IPv4 and IPv6 and ipv6 supported": {
filteredServers: []models.Server{
filteredServers: []umodels.Server{
{
VPN: vpn.OpenVPN,
VPN: constants.OpenVPN,
UDP: true,
IPs: []netip.Addr{
netip.AddrFrom4([4]byte{1, 1, 1, 1}),
@@ -135,28 +135,28 @@ func Test_GetConnection(t *testing.T) {
ipv6Supported: true,
randSource: rand.NewSource(0),
connection: models.Connection{
Type: vpn.OpenVPN,
Type: constants.OpenVPN,
IP: netip.IPv6Unspecified(),
Protocol: constants.UDP,
Port: 1194,
},
},
"mixed servers": {
filteredServers: []models.Server{
filteredServers: []umodels.Server{
{
VPN: vpn.OpenVPN,
VPN: constants.OpenVPN,
UDP: true,
IPs: []netip.Addr{netip.AddrFrom4([4]byte{1, 1, 1, 1})},
OvpnX509: "ovpnx509",
},
{
VPN: vpn.Wireguard,
VPN: constants.Wireguard,
UDP: true,
IPs: []netip.Addr{netip.AddrFrom4([4]byte{2, 2, 2, 2})},
OvpnX509: "ovpnx509",
},
{
VPN: vpn.OpenVPN,
VPN: constants.OpenVPN,
UDP: true,
IPs: []netip.Addr{
netip.AddrFrom4([4]byte{3, 3, 3, 3}),
@@ -170,7 +170,7 @@ func Test_GetConnection(t *testing.T) {
defaults: NewConnectionDefaults(443, 1194, 58820),
randSource: rand.NewSource(0),
connection: models.Connection{
Type: vpn.OpenVPN,
Type: constants.OpenVPN,
IP: netip.AddrFrom4([4]byte{1, 1, 1, 1}),
Protocol: constants.UDP,
Port: 1194,