mirror of
https://github.com/qdm12/gluetun.git
synced 2026-07-24 19:36:24 +02:00
chore(updater): move updater packages to pkg/updaters/<name>
This commit is contained in:
@@ -8,11 +8,12 @@ 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"
|
||||
updaters "github.com/qdm12/gluetun/pkg/updaters/common"
|
||||
"github.com/qdm12/gluetun/pkg/updaters/constants"
|
||||
umodels "github.com/qdm12/gluetun/pkg/updaters/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -22,7 +23,7 @@ func Test_Provider_GetConnection(t *testing.T) {
|
||||
const provider = providers.Ivpn
|
||||
|
||||
testCases := map[string]struct {
|
||||
filteredServers []models.Server
|
||||
filteredServers []umodels.Server
|
||||
storageErr error
|
||||
selection settings.ServerSelection
|
||||
ipv6Supported bool
|
||||
@@ -34,7 +35,7 @@ func Test_Provider_GetConnection(t *testing.T) {
|
||||
errMessage: "filtering servers: test error",
|
||||
},
|
||||
"default OpenVPN TCP port": {
|
||||
filteredServers: []models.Server{
|
||||
filteredServers: []umodels.Server{
|
||||
{IPs: []netip.Addr{netip.AddrFrom4([4]byte{1, 1, 1, 1})}},
|
||||
},
|
||||
selection: settings.ServerSelection{
|
||||
@@ -43,14 +44,14 @@ func Test_Provider_GetConnection(t *testing.T) {
|
||||
},
|
||||
}.WithDefaults(provider),
|
||||
connection: models.Connection{
|
||||
Type: vpn.OpenVPN,
|
||||
Type: constants.OpenVPN,
|
||||
IP: netip.AddrFrom4([4]byte{1, 1, 1, 1}),
|
||||
Port: 443,
|
||||
Protocol: constants.TCP,
|
||||
},
|
||||
},
|
||||
"default OpenVPN UDP port": {
|
||||
filteredServers: []models.Server{
|
||||
filteredServers: []umodels.Server{
|
||||
{IPs: []netip.Addr{netip.AddrFrom4([4]byte{1, 1, 1, 1})}},
|
||||
},
|
||||
selection: settings.ServerSelection{
|
||||
@@ -59,21 +60,21 @@ func Test_Provider_GetConnection(t *testing.T) {
|
||||
},
|
||||
}.WithDefaults(provider),
|
||||
connection: models.Connection{
|
||||
Type: vpn.OpenVPN,
|
||||
Type: constants.OpenVPN,
|
||||
IP: netip.AddrFrom4([4]byte{1, 1, 1, 1}),
|
||||
Port: 1194,
|
||||
Protocol: constants.UDP,
|
||||
},
|
||||
},
|
||||
"default Wireguard port": {
|
||||
filteredServers: []models.Server{
|
||||
filteredServers: []umodels.Server{
|
||||
{IPs: []netip.Addr{netip.AddrFrom4([4]byte{1, 1, 1, 1})}, WgPubKey: "x"},
|
||||
},
|
||||
selection: settings.ServerSelection{
|
||||
VPN: vpn.Wireguard,
|
||||
VPN: constants.Wireguard,
|
||||
}.WithDefaults(provider),
|
||||
connection: models.Connection{
|
||||
Type: vpn.Wireguard,
|
||||
Type: constants.Wireguard,
|
||||
IP: netip.AddrFrom4([4]byte{1, 1, 1, 1}),
|
||||
Port: 58237,
|
||||
Protocol: constants.UDP,
|
||||
@@ -92,8 +93,8 @@ func Test_Provider_GetConnection(t *testing.T) {
|
||||
Return(testCase.filteredServers, testCase.storageErr)
|
||||
|
||||
client := (*http.Client)(nil)
|
||||
warner := (common.Warner)(nil)
|
||||
parallelResolver := (common.ParallelResolver)(nil)
|
||||
warner := (updaters.Warner)(nil)
|
||||
parallelResolver := (updaters.ParallelResolver)(nil)
|
||||
provider := New(storage, client, warner, parallelResolver)
|
||||
|
||||
connection, err := provider.GetConnection(testCase.selection, testCase.ipv6Supported)
|
||||
|
||||
Reference in New Issue
Block a user