Fix: version diff for VPN server information
This commit is contained in:
@@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/qdm12/gluetun/internal/models"
|
"github.com/qdm12/gluetun/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *storage) logVersionDiff(provider string, diff uint16) {
|
func (s *storage) logVersionDiff(provider string, diff int) {
|
||||||
diffString := strconv.Itoa(int(diff))
|
diffString := strconv.Itoa(diff)
|
||||||
|
|
||||||
message := provider + " servers from file discarded because they are " +
|
message := provider + " servers from file discarded because they are " +
|
||||||
diffString + " version"
|
diffString + " version"
|
||||||
@@ -58,7 +58,7 @@ func (s *storage) mergeCyberghost(hardcoded, persisted models.CyberghostServers)
|
|||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
|
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Cyberghost", versionDiff)
|
s.logVersionDiff("Cyberghost", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -72,7 +72,7 @@ func (s *storage) mergeFastestvpn(hardcoded, persisted models.FastestvpnServers)
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("FastestVPN", versionDiff)
|
s.logVersionDiff("FastestVPN", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -85,7 +85,7 @@ func (s *storage) mergeHideMyAss(hardcoded, persisted models.HideMyAssServers) m
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("HideMyAss", versionDiff)
|
s.logVersionDiff("HideMyAss", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -98,7 +98,7 @@ func (s *storage) mergeIpvanish(hardcoded, persisted models.IpvanishServers) mod
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Ipvanish", versionDiff)
|
s.logVersionDiff("Ipvanish", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -111,7 +111,7 @@ func (s *storage) mergeIvpn(hardcoded, persisted models.IvpnServers) models.Ivpn
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Ivpn", versionDiff)
|
s.logVersionDiff("Ivpn", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -125,7 +125,7 @@ func (s *storage) mergeMullvad(hardcoded, persisted models.MullvadServers) model
|
|||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
|
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Mullvad", versionDiff)
|
s.logVersionDiff("Mullvad", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -140,7 +140,7 @@ func (s *storage) mergeNordVPN(hardcoded, persisted models.NordvpnServers) model
|
|||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
|
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("NordVPN", versionDiff)
|
s.logVersionDiff("NordVPN", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -154,7 +154,7 @@ func (s *storage) mergePrivado(hardcoded, persisted models.PrivadoServers) model
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Privado", versionDiff)
|
s.logVersionDiff("Privado", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -168,7 +168,7 @@ func (s *storage) mergePIA(hardcoded, persisted models.PiaServers) models.PiaSer
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Private Internet Access", versionDiff)
|
s.logVersionDiff("Private Internet Access", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -182,7 +182,7 @@ func (s *storage) mergePrivatevpn(hardcoded, persisted models.PrivatevpnServers)
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("PrivateVPN", versionDiff)
|
s.logVersionDiff("PrivateVPN", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -196,7 +196,7 @@ func (s *storage) mergeProtonvpn(hardcoded, persisted models.ProtonvpnServers) m
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("ProtonVPN", versionDiff)
|
s.logVersionDiff("ProtonVPN", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -211,7 +211,7 @@ func (s *storage) mergePureVPN(hardcoded, persisted models.PurevpnServers) model
|
|||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
|
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("PureVPN", versionDiff)
|
s.logVersionDiff("PureVPN", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -226,7 +226,7 @@ func (s *storage) mergeSurfshark(hardcoded, persisted models.SurfsharkServers) m
|
|||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
|
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Surfshark", versionDiff)
|
s.logVersionDiff("Surfshark", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -240,7 +240,7 @@ func (s *storage) mergeTorguard(hardcoded, persisted models.TorguardServers) mod
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Torguard", versionDiff)
|
s.logVersionDiff("Torguard", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -254,7 +254,7 @@ func (s *storage) mergeVPNUnlimited(hardcoded, persisted models.VPNUnlimitedServ
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff(constants.VPNUnlimited, versionDiff)
|
s.logVersionDiff(constants.VPNUnlimited, versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -269,7 +269,7 @@ func (s *storage) mergeVyprvpn(hardcoded, persisted models.VyprvpnServers) model
|
|||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
|
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("VyprVPN", versionDiff)
|
s.logVersionDiff("VyprVPN", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
@@ -283,7 +283,8 @@ func (s *storage) mergeWindscribe(hardcoded, persisted models.WindscribeServers)
|
|||||||
if persisted.Timestamp <= hardcoded.Timestamp {
|
if persisted.Timestamp <= hardcoded.Timestamp {
|
||||||
return hardcoded
|
return hardcoded
|
||||||
}
|
}
|
||||||
versionDiff := hardcoded.Version - persisted.Version
|
|
||||||
|
versionDiff := int(hardcoded.Version) - int(persisted.Version)
|
||||||
if versionDiff > 0 {
|
if versionDiff > 0 {
|
||||||
s.logVersionDiff("Windscribe", versionDiff)
|
s.logVersionDiff("Windscribe", versionDiff)
|
||||||
return hardcoded
|
return hardcoded
|
||||||
|
|||||||
Reference in New Issue
Block a user