Add the ProtonVPN server networks and addresses to the IP lookup (closes #236)
check / check (push) Successful in 1m27s
check / check (push) Successful in 1m27s
Proton's own server list answers only a logged-in session, so the lists come from the public mirror https://github.com/tn3w/ProtonVPN-IPs, downloaded once a day: `protonvpn`, its /24 networks, and `protonvpn_entry`, its servers' IPv4 and IPv6 addresses. Both feed `flags.is_vpn` and `vpn_providers`. Judgement call: the /24 networks are listed as well as the exact addresses, because coverage matters more than attribution, so neighbouring addresses in those networks count too. Risk: the mirror is one person's repository; if it stops updating, downloads keep succeeding with old data. Model: opus-5-5
This commit was merged in pull request #247.
This commit is contained in:
1 parent
0cbd9cd943
commit
b2553f044d
6 files changed
+116
-1
No files matched your search
@@ -58,6 +58,8 @@ func parse(r io.Reader, format Format) (*netipx.IPSet, error) {
|
||||
return parsePIA(r)
|
||||
case FormatIVPNJSON:
|
||||
return parseIVPN(r)
|
||||
case FormatProtonVPN:
|
||||
return parseProtonVPN(r)
|
||||
default:
|
||||
return nil, errUnknownFormat
|
||||
}
|
||||
@@ -329,6 +331,22 @@ func parseIVPN(r io.Reader) (*netipx.IPSet, error) {
|
||||
return addressSet(texts)
|
||||
}
|
||||
|
||||
// parseProtonVPN returns the addresses or networks in a ProtonVPN-IPs list. A
|
||||
// file with no addresses or networks fails, because the service always has
|
||||
// servers.
|
||||
func parseProtonVPN(r io.Reader) (*netipx.IPSet, error) {
|
||||
addresses, err := parseLines(r, addAddressOrNetwork)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(addresses.Ranges()) == 0 {
|
||||
return nil, errNoAddresses
|
||||
}
|
||||
|
||||
return addresses, nil
|
||||
}
|
||||
|
||||
// readJSON reads r to its end and decodes it, as one JSON document, into v.
|
||||
func readJSON(r io.Reader, v any) error {
|
||||
data, err := io.ReadAll(r)
|
||||
|
||||
Reference in new issue
Block a user