Merge branch 'support-legacy-lzo'

This commit is contained in:
Davide De Rosa 2019-03-19 15:24:10 +01:00
commit cbcda11ee0
7 changed files with 113 additions and 51 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- Support for legacy `--comp-lzo` compression. [tunnelkit#69](https://github.com/keeshux/tunnelkit/pull/69)
## 1.1.0 Beta 1407 (2019-03-18)
### Added

View File

@ -58,6 +58,7 @@ class ConfigurationViewController: UIViewController, TableModelHost {
model.add(.reset)
}
model.add(.tls)
model.add(.compression)
if let _ = configuration.dnsServers {
model.add(.dns)
}
@ -66,6 +67,7 @@ class ConfigurationViewController: UIViewController, TableModelHost {
// headers
model.setHeader(L10n.Configuration.Sections.Communication.header, for: .communication)
model.setHeader(L10n.Configuration.Sections.Tls.header, for: .tls)
model.setHeader(L10n.Configuration.Sections.Compression.header, for: .compression)
if let _ = configuration.dnsServers {
model.setHeader(L10n.Configuration.Sections.Dns.header, for: .dns)
}
@ -77,15 +79,16 @@ class ConfigurationViewController: UIViewController, TableModelHost {
}
// rows
model.set([.cipher, .digest, .compressionFrame], in: .communication)
model.set([.cipher, .digest], in: .communication)
if isEditable {
model.set([.resetOriginal], in: .reset)
}
model.set([.client, .tlsWrapping], in: .tls)
model.set([.compressionFraming, .compressionAlgorithm], in: .compression)
if let dnsServers = configuration.dnsServers {
model.set(.dnsServer, count: dnsServers.count, in: .dns)
}
model.set([.compressionAlgorithm, .keepAlive, .renegSeconds], in: .other)
model.set([.keepAlive, .renegSeconds], in: .other)
return model
}()
@ -167,6 +170,8 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case tls
case compression
case dns
case other
@ -177,18 +182,18 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case digest
case compressionFrame
case resetOriginal
case client
case tlsWrapping
case dnsServer
case compressionFraming
case compressionAlgorithm
case dnsServer
case keepAlive
case renegSeconds
@ -243,10 +248,6 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
cell.isTappable = false
}
case .compressionFrame:
cell.leftText = L10n.Configuration.Cells.CompressionFrame.caption
cell.rightText = configuration.compressionFraming.cellDescription
case .resetOriginal:
cell.leftText = L10n.Configuration.Cells.ResetOriginal.caption
cell.applyAction(Theme.current)
@ -274,6 +275,23 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
cell.accessoryType = .none
cell.isTappable = false
case .compressionFraming:
cell.leftText = L10n.Configuration.Cells.CompressionFraming.caption
cell.rightText = configuration.compressionFraming.cellDescription
cell.accessoryType = .none
cell.isTappable = false
case .compressionAlgorithm:
cell.leftText = L10n.Configuration.Cells.CompressionAlgorithm.caption
let V = L10n.Configuration.Cells.CompressionAlgorithm.Value.self
if let compressionAlgorithm = configuration.compressionAlgorithm {
cell.rightText = compressionAlgorithm.cellDescription
} else {
cell.rightText = V.disabled
}
cell.accessoryType = .none
cell.isTappable = false
case .dnsServer:
guard let dnsServers = configuration.dnsServers else {
fatalError("Showing DNS section without any custom server")
@ -283,12 +301,6 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
cell.accessoryType = .none
cell.isTappable = false
case .compressionAlgorithm:
cell.leftText = L10n.Configuration.Cells.CompressionAlgorithm.caption
cell.rightText = L10n.Configuration.Cells.CompressionAlgorithm.Value.disabled // hardcoded because compression unsupported
cell.accessoryType = .none
cell.isTappable = false
case .keepAlive:
cell.leftText = L10n.Configuration.Cells.KeepAlive.caption
let V = L10n.Configuration.Cells.KeepAlive.Value.self
@ -350,17 +362,17 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
}
navigationController?.pushViewController(vc, animated: true)
case .compressionFrame:
let vc = OptionViewController<SessionProxy.CompressionFraming>()
vc.title = settingCell?.leftText
vc.options = [.disabled, .compLZO, .compress]
vc.selectedOption = configuration.compressionFraming
vc.descriptionBlock = { $0.cellDescription }
vc.selectionBlock = { [weak self] in
self?.configuration.compressionFraming = $0
self?.popAndCheckRefresh()
}
navigationController?.pushViewController(vc, animated: true)
// case .compressionFraming:
// let vc = OptionViewController<SessionProxy.CompressionFraming>()
// vc.title = settingCell?.leftText
// vc.options = [.disabled, .compLZO, .compress]
// vc.selectedOption = configuration.compressionFraming
// vc.descriptionBlock = { $0.cellDescription }
// vc.selectionBlock = { [weak self] in
// self?.configuration.compressionFraming = $0
// self?.popAndCheckRefresh()
// }
// navigationController?.pushViewController(vc, animated: true)
case .resetOriginal:
tableView.deselectRow(at: indexPath, animated: true)
@ -386,7 +398,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
private extension SessionProxy.CompressionFraming {
var cellDescription: String {
let V = L10n.Configuration.Cells.CompressionFrame.Value.self
let V = L10n.Configuration.Cells.CompressionFraming.Value.self
switch self {
case .disabled:
return V.disabled
@ -399,3 +411,19 @@ private extension SessionProxy.CompressionFraming {
}
}
}
private extension SessionProxy.CompressionAlgorithm {
var cellDescription: String {
let V = L10n.Configuration.Cells.CompressionAlgorithm.Value.self
switch self {
case .disabled:
return V.disabled
case .LZO:
return V.lzo
case .other:
return V.other
}
}
}

View File

@ -139,15 +139,12 @@
"configuration.sections.communication.header" = "Communication";
"configuration.sections.reset.footer" = "If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration.";
"configuration.sections.tls.header" = "TLS";
"configuration.sections.compression.header" = "Compression";
"configuration.sections.dns.header" = "DNS";
"configuration.sections.other.header" = "Other";
"configuration.cells.cipher.caption" = "Cipher";
"configuration.cells.digest.caption" = "Authentication";
"configuration.cells.digest.value.embedded" = "Embedded";
"configuration.cells.compression_frame.caption" = "Framing";
"configuration.cells.compression_frame.value.disabled" = "None";
"configuration.cells.compression_frame.value.lzo" = "LZO";
"configuration.cells.compression_frame.value.compress" = "Compress";
"configuration.cells.reset_original.caption" = "Reset configuration";
"configuration.cells.client.caption" = "Client certificate";
"configuration.cells.client.value.enabled" = "Verified";
@ -157,8 +154,14 @@
"configuration.cells.tls_wrapping.value.crypt" = "Encryption";
"configuration.cells.tls_wrapping.value.disabled" = "Disabled";
"configuration.cells.dns_server.caption" = "Address";
"configuration.cells.compression_algorithm.caption" = "Compression";
"configuration.cells.compression_framing.caption" = "Framing";
"configuration.cells.compression_framing.value.disabled" = "None";
"configuration.cells.compression_framing.value.lzo" = "--comp-lzo";
"configuration.cells.compression_framing.value.compress" = "--compress";
"configuration.cells.compression_algorithm.caption" = "Algorithm";
"configuration.cells.compression_algorithm.value.disabled" = "Disabled";
"configuration.cells.compression_algorithm.value.lzo" = "LZO";
"configuration.cells.compression_algorithm.value.other" = "Unsupported";
"configuration.cells.keep_alive.caption" = "Keep-alive";
"configuration.cells.keep_alive.value.seconds" = "%d seconds";
"configuration.cells.keep_alive.value.never" = "Disabled";

View File

@ -239,6 +239,11 @@ public class AppConstants {
"SwiftyBeaver",
"MIT",
"https://raw.githubusercontent.com/SwiftyBeaver/SwiftyBeaver/master/LICENSE"
),
License(
"lzo",
"GPLv2",
"https://www.gnu.org/licenses/gpl-2.0.txt"
)
]

View File

@ -109,23 +109,27 @@ public enum L10n {
}
}
public enum CompressionAlgorithm {
/// Compression
/// Algorithm
public static let caption = L10n.tr("Localizable", "configuration.cells.compression_algorithm.caption")
public enum Value {
/// Disabled
public static let disabled = L10n.tr("Localizable", "configuration.cells.compression_algorithm.value.disabled")
/// LZO
public static let lzo = L10n.tr("Localizable", "configuration.cells.compression_algorithm.value.lzo")
/// Unsupported
public static let other = L10n.tr("Localizable", "configuration.cells.compression_algorithm.value.other")
}
}
public enum CompressionFrame {
public enum CompressionFraming {
/// Framing
public static let caption = L10n.tr("Localizable", "configuration.cells.compression_frame.caption")
public static let caption = L10n.tr("Localizable", "configuration.cells.compression_framing.caption")
public enum Value {
/// Compress
public static let compress = L10n.tr("Localizable", "configuration.cells.compression_frame.value.compress")
/// --compress
public static let compress = L10n.tr("Localizable", "configuration.cells.compression_framing.value.compress")
/// None
public static let disabled = L10n.tr("Localizable", "configuration.cells.compression_frame.value.disabled")
/// LZO
public static let lzo = L10n.tr("Localizable", "configuration.cells.compression_frame.value.lzo")
public static let disabled = L10n.tr("Localizable", "configuration.cells.compression_framing.value.disabled")
/// --comp-lzo
public static let lzo = L10n.tr("Localizable", "configuration.cells.compression_framing.value.lzo")
}
}
public enum Digest {
@ -186,6 +190,10 @@ public enum L10n {
/// Communication
public static let header = L10n.tr("Localizable", "configuration.sections.communication.header")
}
public enum Compression {
/// Compression
public static let header = L10n.tr("Localizable", "configuration.sections.compression.header")
}
public enum Dns {
/// DNS
public static let header = L10n.tr("Localizable", "configuration.sections.dns.header")

View File

@ -3,8 +3,9 @@ platform :ios, '11.0'
use_frameworks!
def shared_pods
pod 'TunnelKit', '~> 1.4.3'
#pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '08b04c8'
#pod 'TunnelKit', '~> 1.4.3'
pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '8e99c91'
pod 'TunnelKit/LZO', :git => 'https://github.com/keeshux/tunnelkit', :commit => '8e99c91'
#pod 'TunnelKit', :path => '../../personal/tunnelkit'
end

View File

@ -2,33 +2,44 @@ PODS:
- MBProgressHUD (1.1.0)
- OpenSSL-Apple (1.1.0i.2)
- SwiftyBeaver (1.6.2)
- TunnelKit (1.4.3):
- TunnelKit/AppExtension (= 1.4.3)
- TunnelKit/Core (= 1.4.3)
- TunnelKit/AppExtension (1.4.3):
- TunnelKit (1.5.0):
- TunnelKit/AppExtension (= 1.5.0)
- TunnelKit/Core (= 1.5.0)
- TunnelKit/AppExtension (1.5.0):
- SwiftyBeaver
- TunnelKit/Core
- TunnelKit/Core (1.4.3):
- TunnelKit/Core (1.5.0):
- OpenSSL-Apple (~> 1.1.0i.2)
- SwiftyBeaver
- TunnelKit/LZO (1.5.0)
DEPENDENCIES:
- MBProgressHUD
- TunnelKit (~> 1.4.3)
- TunnelKit (from `https://github.com/keeshux/tunnelkit`, commit `8e99c91`)
- TunnelKit/LZO (from `https://github.com/keeshux/tunnelkit`, commit `8e99c91`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- MBProgressHUD
- OpenSSL-Apple
- SwiftyBeaver
- TunnelKit
EXTERNAL SOURCES:
TunnelKit:
:commit: 8e99c91
:git: https://github.com/keeshux/tunnelkit
CHECKOUT OPTIONS:
TunnelKit:
:commit: 8e99c91
:git: https://github.com/keeshux/tunnelkit
SPEC CHECKSUMS:
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
OpenSSL-Apple: 37a8c0b04df4bb8971deef4671cc29222861319c
SwiftyBeaver: 8e67ab3cd94389cbbb7a9c7cc02748d98bfee68e
TunnelKit: 194e6f60cf5cbddfee1a24be6c7c540f70bdeb5f
TunnelKit: a1ec190379cba7c74be68635ad1dd4b59ceaf5ad
PODFILE CHECKSUM: 64d514eec14e2f21c3da54f71cb0057d921db90d
PODFILE CHECKSUM: 4485846865fff02ed2dd427b2a7f2388c6eded71
COCOAPODS: 1.6.1