Skip to content
This repository was archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
Opt out of platform info in peer info (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux authored Jan 27, 2024
1 parent 5e0d044 commit 8f8abcd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/),
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)

### Fixed
Expand Down
28 changes: 17 additions & 11 deletions Sources/TunnelKitOpenVPNProtocol/CoreConfiguration+OpenVPN.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,10 @@ extension CoreConfiguration {

// MARK: Authentication

static func peerInfo(extra: [String: String]? = nil) -> String {
let platform: String
let platformVersion = ProcessInfo.processInfo.operatingSystemVersion
#if os(iOS)
platform = "ios"
#else
platform = "mac"
#endif
static func peerInfo(withPlatform: Bool = true, extra: [String: String]? = nil) -> String {
let uiVersion = versionIdentifier ?? "\(identifier) \(version)"
var info = [
"IV_VER=2.4",
"IV_PLAT=\(platform)",
"IV_UI_VER=\(uiVersion)",
"IV_PROTO=2",
"IV_NCP=2",
Expand All @@ -89,10 +81,24 @@ extension CoreConfiguration {
// if pushPeerInfo {
if true {
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)")
}
if let extra = extra {
info.append(contentsOf: extra.map { "\($0)=\($1)" })
if let extra {
info.append(contentsOf: extra.map {
"\($0)=\($1)"
})
}
info.append("")
return info.joined(separator: "\n")
Expand Down

0 comments on commit 8f8abcd

Please sign in to comment.