Extend peer info with IV_PLAT_VER

Will then make them conditional based on --push-peer-info

See #202
This commit is contained in:
Davide De Rosa 2021-02-11 18:18:05 +01:00
parent 4114605520
commit 3ba63e9a88
2 changed files with 13 additions and 1 deletions

View File

@ -65,6 +65,7 @@ extension CoreConfiguration {
static func peerInfo(extra: [String: String]? = nil) -> String { static func peerInfo(extra: [String: String]? = nil) -> String {
let platform: String let platform: String
let platformVersion = ProcessInfo.processInfo.operatingSystemVersion
#if os(iOS) #if os(iOS)
platform = "ios" platform = "ios"
#else #else
@ -77,12 +78,18 @@ extension CoreConfiguration {
"IV_UI_VER=\(uiVersion)", "IV_UI_VER=\(uiVersion)",
"IV_PROTO=2", "IV_PROTO=2",
"IV_NCP=2", "IV_NCP=2",
"IV_SSL=\(CryptoBox.version())",
"IV_LZO_STUB=1", "IV_LZO_STUB=1",
] ]
if LZOIsSupported() { if LZOIsSupported() {
info.append("IV_LZO=1") info.append("IV_LZO=1")
} }
// XXX: always do --push-peer-info
// however, MAC is inaccessible and IFAD is deprecated, skip IV_HWADDR
// if pushPeerInfo {
if true {
info.append("IV_SSL=\(CryptoBox.version())")
info.append("IV_PLAT_VER=\(platformVersion.majorVersion).\(platformVersion.minorVersion)")
}
if let extra = extra { if let extra = extra {
info.append(contentsOf: extra.map { "\($0)=\($1)" }) info.append(contentsOf: extra.map { "\($0)=\($1)" })
} }

View File

@ -169,4 +169,9 @@ class PushTests: XCTestCase {
let reply = try? OpenVPN.PushReply(message: msg)! let reply = try? OpenVPN.PushReply(message: msg)!
reply?.debug() reply?.debug()
} }
func testPeerInfo() {
let peerInfo = CoreConfiguration.OpenVPN.peerInfo()
print(peerInfo)
}
} }