chore(models): streamline all server models IPs (#942)
- Use `IPs []net.IP` for all server models - Use `ips` JSON field for all server models - Merge IPv4 and IPv6 addresses together for Mullvad
This commit is contained in:
@@ -108,7 +108,6 @@ func (a *AllServers) GetMullvad() (servers []MullvadServer) {
|
||||
for i, serverToCopy := range a.Mullvad.Servers {
|
||||
servers[i] = serverToCopy
|
||||
servers[i].IPs = copyIPs(serverToCopy.IPs)
|
||||
servers[i].IPsV6 = copyIPs(serverToCopy.IPsV6)
|
||||
}
|
||||
return servers
|
||||
}
|
||||
@@ -120,7 +119,7 @@ func (a *AllServers) GetNordvpn() (servers []NordvpnServer) {
|
||||
servers = make([]NordvpnServer, len(a.Nordvpn.Servers))
|
||||
for i, serverToCopy := range a.Nordvpn.Servers {
|
||||
servers[i] = serverToCopy
|
||||
servers[i].IP = copyIP(serverToCopy.IP)
|
||||
servers[i].IPs = copyIPs(serverToCopy.IPs)
|
||||
}
|
||||
return servers
|
||||
}
|
||||
@@ -156,7 +155,7 @@ func (a *AllServers) GetPrivado() (servers []PrivadoServer) {
|
||||
servers = make([]PrivadoServer, len(a.Privado.Servers))
|
||||
for i, serverToCopy := range a.Privado.Servers {
|
||||
servers[i] = serverToCopy
|
||||
servers[i].IP = copyIP(serverToCopy.IP)
|
||||
servers[i].IPs = copyIPs(serverToCopy.IPs)
|
||||
}
|
||||
return servers
|
||||
}
|
||||
@@ -180,7 +179,7 @@ func (a *AllServers) GetProtonvpn() (servers []ProtonvpnServer) {
|
||||
servers = make([]ProtonvpnServer, len(a.Protonvpn.Servers))
|
||||
for i, serverToCopy := range a.Protonvpn.Servers {
|
||||
servers[i] = serverToCopy
|
||||
servers[i].EntryIP = copyIP(serverToCopy.EntryIP)
|
||||
servers[i].IPs = copyIPs(serverToCopy.IPs)
|
||||
}
|
||||
return servers
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func Test_AllServers_GetCopy(t *testing.T) {
|
||||
},
|
||||
Nordvpn: NordvpnServers{
|
||||
Servers: []NordvpnServer{{
|
||||
IP: net.IP{1, 2, 3, 4},
|
||||
IPs: []net.IP{{1, 2, 3, 4}},
|
||||
}},
|
||||
},
|
||||
Perfectprivacy: PerfectprivacyServers{
|
||||
@@ -58,7 +58,7 @@ func Test_AllServers_GetCopy(t *testing.T) {
|
||||
},
|
||||
Privado: PrivadoServers{
|
||||
Servers: []PrivadoServer{{
|
||||
IP: net.IP{1, 2, 3, 4},
|
||||
IPs: []net.IP{{1, 2, 3, 4}},
|
||||
}},
|
||||
},
|
||||
Pia: PiaServers{
|
||||
@@ -73,7 +73,7 @@ func Test_AllServers_GetCopy(t *testing.T) {
|
||||
},
|
||||
Protonvpn: ProtonvpnServers{
|
||||
Servers: []ProtonvpnServer{{
|
||||
EntryIP: net.IP{1, 2, 3, 4},
|
||||
IPs: []net.IP{{1, 2, 3, 4}},
|
||||
}},
|
||||
},
|
||||
Purevpn: PurevpnServers{
|
||||
|
||||
@@ -63,7 +63,6 @@ type IvpnServer struct {
|
||||
type MullvadServer struct {
|
||||
VPN string `json:"vpn,omitempty"`
|
||||
IPs []net.IP `json:"ips,omitempty"`
|
||||
IPsV6 []net.IP `json:"ipsv6,omitempty"`
|
||||
Country string `json:"country,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
@@ -73,12 +72,12 @@ type MullvadServer struct {
|
||||
}
|
||||
|
||||
type NordvpnServer struct { //nolint:maligned
|
||||
Region string `json:"region,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Number uint16 `json:"number,omitempty"`
|
||||
IP net.IP `json:"ip,omitempty"`
|
||||
TCP bool `json:"tcp,omitempty"`
|
||||
UDP bool `json:"udp,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Number uint16 `json:"number,omitempty"`
|
||||
IPs []net.IP `json:"ips,omitempty"`
|
||||
TCP bool `json:"tcp,omitempty"`
|
||||
UDP bool `json:"udp,omitempty"`
|
||||
}
|
||||
|
||||
type PerfectprivacyServer struct {
|
||||
@@ -89,11 +88,11 @@ type PerfectprivacyServer struct {
|
||||
}
|
||||
|
||||
type PrivadoServer struct {
|
||||
Country string `json:"country,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
IP net.IP `json:"ip,omitempty"`
|
||||
Country string `json:"country,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
IPs []net.IP `json:"ips,omitempty"`
|
||||
}
|
||||
|
||||
type PIAServer struct {
|
||||
@@ -110,16 +109,16 @@ type PrivatevpnServer struct {
|
||||
Country string `json:"country,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
IPs []net.IP `json:"ip,omitempty"`
|
||||
IPs []net.IP `json:"ips,omitempty"`
|
||||
}
|
||||
|
||||
type ProtonvpnServer struct {
|
||||
Country string `json:"country,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Name string `json:"server_name,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
EntryIP net.IP `json:"entry_ip,omitempty"`
|
||||
Country string `json:"country,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Name string `json:"server_name,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
IPs []net.IP `json:"ips,omitempty"`
|
||||
}
|
||||
|
||||
type PurevpnServer struct {
|
||||
|
||||
Reference in New Issue
Block a user