From 71d54e2dc323db42ca7a428ba14c1a2a40c7cd25 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 25 Mar 2019 10:07:57 +0100 Subject: [PATCH] Send IV_LZO only if supported --- .../Sources/Core/CoreConfiguration.swift | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/TunnelKit/Sources/Core/CoreConfiguration.swift b/TunnelKit/Sources/Core/CoreConfiguration.swift index 19db18e..28401a8 100644 --- a/TunnelKit/Sources/Core/CoreConfiguration.swift +++ b/TunnelKit/Sources/Core/CoreConfiguration.swift @@ -77,17 +77,22 @@ struct CoreConfiguration { // MARK: Authentication - static let peerInfo = [ - "IV_VER=2.4", - "IV_PLAT=mac", - "IV_UI_VER=\(identifier) \(version)", - "IV_PROTO=2", - "IV_NCP=2", - "IV_SSL=\(CryptoBox.version())", - "IV_LZO=1", - "IV_LZO_STUB=1", - "" - ].joined(separator: "\n") + static let peerInfo: String = { + var info = [ + "IV_VER=2.4", + "IV_PLAT=mac", + "IV_UI_VER=\(identifier) \(version)", + "IV_PROTO=2", + "IV_NCP=2", + "IV_SSL=\(CryptoBox.version())", + "IV_LZO_STUB=1", + ] + if LZOIsSupported() { + info.append("IV_LZO=1") + } + info.append("") + return info.joined(separator: "\n") + }() static let randomLength = 32