chore(constants): internal/constants/vpn package

This commit is contained in:
Quentin McGaw
2022-04-18 09:15:20 +00:00
parent d51514015f
commit 934fafb64b
25 changed files with 193 additions and 183 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/vpn"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/openvpn/extract"
"github.com/qdm12/gluetun/internal/provider/utils"
@@ -19,9 +20,9 @@ var (
func (p *Provider) GetConnection(selection settings.ServerSelection) (
connection models.Connection, err error) {
switch selection.VPN {
case constants.OpenVPN:
case vpn.OpenVPN:
return getOpenVPNConnection(p.extractor, selection)
case constants.Wireguard:
case vpn.Wireguard:
return getWireguardConnection(selection), nil
default:
return connection, fmt.Errorf("%w: %s", ErrVPNTypeNotSupported, selection.VPN)
@@ -44,7 +45,7 @@ func getWireguardConnection(selection settings.ServerSelection) (
connection models.Connection) {
port := getPort(*selection.Wireguard.EndpointPort, selection)
return models.Connection{
Type: constants.Wireguard,
Type: vpn.Wireguard,
IP: selection.Wireguard.EndpointIP,
Port: port,
Protocol: constants.UDP,