Opt out of platform info in peer info (#409)

This commit is contained in:
Davide De Rosa 2024-01-27 10:27:46 +01:00 committed by GitHub
parent 5e0d044bd3
commit 8f8abcdade
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 11 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- OpenVPN: Opt out of platform info in peer info. [#409](https://github.com/passepartoutvpn/tunnelkit/pull/409)
## 6.3.2 (2024-01-05) ## 6.3.2 (2024-01-05)
### Fixed ### Fixed

View File

@ -64,18 +64,10 @@ extension CoreConfiguration {
// MARK: Authentication // MARK: Authentication
static func peerInfo(extra: [String: String]? = nil) -> String { static func peerInfo(withPlatform: Bool = true, extra: [String: String]? = nil) -> String {
let platform: String
let platformVersion = ProcessInfo.processInfo.operatingSystemVersion
#if os(iOS)
platform = "ios"
#else
platform = "mac"
#endif
let uiVersion = versionIdentifier ?? "\(identifier) \(version)" let uiVersion = versionIdentifier ?? "\(identifier) \(version)"
var info = [ var info = [
"IV_VER=2.4", "IV_VER=2.4",
"IV_PLAT=\(platform)",
"IV_UI_VER=\(uiVersion)", "IV_UI_VER=\(uiVersion)",
"IV_PROTO=2", "IV_PROTO=2",
"IV_NCP=2", "IV_NCP=2",
@ -89,10 +81,24 @@ extension CoreConfiguration {
// if pushPeerInfo { // if pushPeerInfo {
if true { if true {
info.append("IV_SSL=\(CryptoBox.version())") info.append("IV_SSL=\(CryptoBox.version())")
}
if withPlatform {
let platform: String
let platformVersion = ProcessInfo.processInfo.operatingSystemVersion
#if os(iOS)
platform = "ios"
#elseif os(tvOS)
platform = "tvos"
#else
platform = "mac"
#endif
info.append("IV_PLAT=\(platform)")
info.append("IV_PLAT_VER=\(platformVersion.majorVersion).\(platformVersion.minorVersion)") info.append("IV_PLAT_VER=\(platformVersion.majorVersion).\(platformVersion.minorVersion)")
} }
if let extra = extra { if let extra {
info.append(contentsOf: extra.map { "\($0)=\($1)" }) info.append(contentsOf: extra.map {
"\($0)=\($1)"
})
} }
info.append("") info.append("")
return info.joined(separator: "\n") return info.joined(separator: "\n")