chore(storage): remove unneeded VPN default

This commit is contained in:
Quentin McGaw
2022-04-23 10:59:58 +00:00
parent 045ecabb78
commit 1d94f8ab2b
4 changed files with 0 additions and 41 deletions

View File

@@ -2,8 +2,6 @@ package models
import (
"net"
"github.com/qdm12/gluetun/internal/constants/vpn"
)
type Server struct {
@@ -28,11 +26,3 @@ type Server struct {
PortForward bool `json:"port_forward,omitempty"`
IPs []net.IP `json:"ips,omitempty"`
}
func (s *Server) setDefaults() {
// TODO v4 precise these in servers.json rather than here
if s.VPN == "" {
// If the VPN protocol isn't specified, assume it is OpenVPN.
s.VPN = vpn.OpenVPN
}
}

View File

@@ -47,37 +47,8 @@ func (a *AllServers) Count() int {
len(a.Windscribe.Servers)
}
func (a *AllServers) SetDefaults() {
a.Cyberghost.SetDefaults()
a.Expressvpn.SetDefaults()
a.Fastestvpn.SetDefaults()
a.HideMyAss.SetDefaults()
a.Ipvanish.SetDefaults()
a.Ivpn.SetDefaults()
a.Mullvad.SetDefaults()
a.Nordvpn.SetDefaults()
a.Perfectprivacy.SetDefaults()
a.Privado.SetDefaults()
a.Pia.SetDefaults()
a.Privatevpn.SetDefaults()
a.Protonvpn.SetDefaults()
a.Purevpn.SetDefaults()
a.Surfshark.SetDefaults()
a.Torguard.SetDefaults()
a.VPNUnlimited.SetDefaults()
a.Vyprvpn.SetDefaults()
a.Wevpn.SetDefaults()
a.Windscribe.SetDefaults()
}
type Servers struct {
Version uint16 `json:"version"`
Timestamp int64 `json:"timestamp"`
Servers []Server `json:"servers"`
}
func (s *Servers) SetDefaults() {
for i := range s.Servers {
s.Servers[i].setDefaults()
}
}

View File

@@ -204,7 +204,6 @@ func (s *Storage) extractServersFromBytes(b []byte, hardcoded models.AllServers)
if err != nil {
return servers, err
}
element.target.SetDefaults()
}
return servers, nil

View File

@@ -24,7 +24,6 @@ type InfoErrorer interface {
func New(logger InfoErrorer, filepath string) (storage *Storage, err error) {
// error returned covered by unit test
harcodedServers, _ := parseHardcodedServers()
harcodedServers.SetDefaults()
storage = &Storage{
hardcodedServers: harcodedServers,