hotfix(protonvpn): fix free detection and update p2p->port_forward
This commit is contained in:
@@ -24,6 +24,7 @@ type logicalServer struct {
|
||||
City *string `json:"City"`
|
||||
Servers []physicalServer `json:"Servers"`
|
||||
Features uint16 `json:"Features"`
|
||||
Tier *uint8 `json:"Tier,omitempty"`
|
||||
}
|
||||
|
||||
type physicalServer struct {
|
||||
@@ -31,7 +32,6 @@ type physicalServer struct {
|
||||
ExitIP netip.Addr `json:"ExitIP"`
|
||||
Domain string `json:"Domain"`
|
||||
Status uint8 `json:"Status"`
|
||||
Tier *uint8 `json:"Tier,omitempty"`
|
||||
}
|
||||
|
||||
func fetchAPI(ctx context.Context, client *http.Client) (
|
||||
|
||||
@@ -48,6 +48,15 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) (
|
||||
// ipv6: featuresBits&16 != 0, - unused.
|
||||
}
|
||||
|
||||
//nolint:lll
|
||||
// See https://github.com/ProtonVPN/protonvpn-nm-lib/blob/31d5f99fbc89274e4e977a11e7432c0eab5a3ef8/protonvpn_nm_lib/enums.py#L56-L62
|
||||
free := false
|
||||
if logicalServer.Tier == nil {
|
||||
u.warner.Warn("tier field not set for server " + logicalServer.Name)
|
||||
} else if *logicalServer.Tier == 0 {
|
||||
free = true
|
||||
}
|
||||
|
||||
for _, physicalServer := range logicalServer.Servers {
|
||||
if physicalServer.Status == 0 { // disabled so skip server
|
||||
u.warner.Warn("ignoring server " + physicalServer.Domain + " with status 0")
|
||||
@@ -57,15 +66,6 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) (
|
||||
hostname := physicalServer.Domain
|
||||
entryIP := physicalServer.EntryIP
|
||||
|
||||
//nolint:lll
|
||||
// See https://github.com/ProtonVPN/protonvpn-nm-lib/blob/31d5f99fbc89274e4e977a11e7432c0eab5a3ef8/protonvpn_nm_lib/enums.py#L56-L62
|
||||
free := false
|
||||
if physicalServer.Tier == nil {
|
||||
u.warner.Warn("tier field not set for server " + hostname)
|
||||
} else if *physicalServer.Tier == 0 {
|
||||
free = true
|
||||
}
|
||||
|
||||
// Note: for multi-hop use the server name or hostname
|
||||
// instead of the country
|
||||
countryCode := logicalServer.ExitCountry
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user