forked from Silverfish/proton-bridge
fix: add missing OS to x-pm-appversion
This commit is contained in:
@ -18,6 +18,7 @@
|
|||||||
package pmapi
|
package pmapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -31,10 +32,24 @@ var rootScheme = "https" //nolint[gochecknoglobals]
|
|||||||
|
|
||||||
func GetAPIConfig(configName, appVersion string) *ClientConfig {
|
func GetAPIConfig(configName, appVersion string) *ClientConfig {
|
||||||
return &ClientConfig{
|
return &ClientConfig{
|
||||||
AppVersion: strings.Title(configName) + "_" + appVersion,
|
AppVersion: getAPIOS() + strings.Title(configName) + "_" + appVersion,
|
||||||
ClientID: configName,
|
ClientID: configName,
|
||||||
Timeout: 25 * time.Minute, // Overall request timeout (~25MB / 25 mins => ~16kB/s, should be reasonable).
|
Timeout: 25 * time.Minute, // Overall request timeout (~25MB / 25 mins => ~16kB/s, should be reasonable).
|
||||||
FirstReadTimeout: 30 * time.Second, // 30s to match 30s response header timeout.
|
FirstReadTimeout: 30 * time.Second, // 30s to match 30s response header timeout.
|
||||||
MinBytesPerSecond: 1 << 10, // Enforce minimum download speed of 1kB/s.
|
MinBytesPerSecond: 1 << 10, // Enforce minimum download speed of 1kB/s.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getAPIOS returns actual operating system.
|
||||||
|
func getAPIOS() string {
|
||||||
|
switch os := runtime.GOOS; os {
|
||||||
|
case "darwin": // nolint: goconst
|
||||||
|
return "macOS"
|
||||||
|
case "linux":
|
||||||
|
return "Linux"
|
||||||
|
case "windows":
|
||||||
|
return "Windows"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Linux"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user