-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9876623
commit 4e63d94
Showing
1 changed file
with
10 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -993,9 +993,15 @@ func protonLogicalsUrl() string { | |
return protonBaseUrl + serversV1UrlPath | ||
} | ||
|
||
func protonHeaders(req *http.Request) { | ||
func protonContentHeaders(req *http.Request) { | ||
req.Header.Set("Content-Type", "application/vnd.protonmail.v1+json") | ||
req.Header.Set("Accept", "application/vnd.protonmail.v1+json") | ||
} | ||
|
||
func protonHeaders(req *http.Request) { | ||
protonContentHeaders(req) | ||
// using x-pm-appversion with some APIs like logicals | ||
// will result in 401; but omitting it will work fine | ||
req.Header.Set("x-pm-appversion", "[email protected]") | ||
req.Header.Set("x-pm-locale", "en-US") | ||
req.Header.Set("User-Agent", "ProtonVPN/5.6.38 (Android 34b5; Google Pixel9") | ||
|
@@ -1236,7 +1242,7 @@ func protonServersFrom(allServersFilePath string, c *http.Client) []ProtonLogica | |
} | ||
} | ||
if len(all.R) == 0 { | ||
//curl -X GET "https://vpn-api.proton.me/vpn/v1/logicals?WithState=true&Tier=2&WithEntriesForProtocols=WireGuard" \ | ||
// curl -X GET "https://vpn-api.proton.me/vpn/v1/logicals?WithState=true&Tier=2&WithEntriesForProtocols=WireGuard" \ | ||
// -H "Content-Type: application/vnd.protonmail.v1+json" \ | ||
// -H "x-pm-netzone: 1.1.0.0" \ | ||
// -H "x-pm-country: us" \ | ||
|
@@ -1246,7 +1252,8 @@ func protonServersFrom(allServersFilePath string, c *http.Client) []ProtonLogica | |
if err != nil { | ||
log.E("proton: servers: req: %v", err) | ||
} else { | ||
protonHeaders(req) | ||
// protonHeaders (esp x-pm-appversion) results in 401 | ||
protonContentHeaders(req) | ||
protonNetZoneHeaders(req) | ||
res, err := c.Do(req) | ||
if err != nil || res == nil { | ||
|