Present DNS domain in configuration UI

Fixes #48
This commit is contained in:
Davide De Rosa 2019-04-03 14:08:22 +02:00
parent fe669bb3e0
commit ac713bebda
5 changed files with 34 additions and 9 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
### Fixed
- Pushing DOMAIN has no effect. [#48](https://github.com/passepartoutvpn/passepartout-ios/issues/48)
## 1.3.0 (2019-04-03) ## 1.3.0 (2019-04-03)
### Added ### Added

View File

@ -59,18 +59,14 @@ class ConfigurationViewController: UIViewController, TableModelHost {
} }
model.add(.tls) model.add(.tls)
model.add(.compression) model.add(.compression)
if let _ = configuration.dnsServers {
model.add(.dns) model.add(.dns)
}
model.add(.other) model.add(.other)
// headers // headers
model.setHeader(L10n.Configuration.Sections.Communication.header, for: .communication) model.setHeader(L10n.Configuration.Sections.Communication.header, for: .communication)
model.setHeader(L10n.Configuration.Sections.Tls.header, for: .tls) model.setHeader(L10n.Configuration.Sections.Tls.header, for: .tls)
model.setHeader(L10n.Configuration.Sections.Compression.header, for: .compression) model.setHeader(L10n.Configuration.Sections.Compression.header, for: .compression)
if let _ = configuration.dnsServers {
model.setHeader(L10n.Configuration.Sections.Dns.header, for: .dns) model.setHeader(L10n.Configuration.Sections.Dns.header, for: .dns)
}
model.setHeader(L10n.Configuration.Sections.Other.header, for: .other) model.setHeader(L10n.Configuration.Sections.Other.header, for: .other)
// footers // footers
@ -85,9 +81,14 @@ class ConfigurationViewController: UIViewController, TableModelHost {
} }
model.set([.client, .tlsWrapping, .eku], in: .tls) model.set([.client, .tlsWrapping, .eku], in: .tls)
model.set([.compressionFraming, .compressionAlgorithm], in: .compression) model.set([.compressionFraming, .compressionAlgorithm], in: .compression)
var dnsRows: [RowType]
if let dnsServers = configuration.dnsServers { if let dnsServers = configuration.dnsServers {
model.set(.dnsServer, count: dnsServers.count, in: .dns) dnsRows = [RowType](repeating: .dnsServer, count: dnsServers.count)
} else {
dnsRows = []
} }
dnsRows.append(.dnsDomain)
model.set(dnsRows, in: .dns)
model.set([.keepAlive, .renegSeconds, .randomEndpoint], in: .other) model.set([.keepAlive, .renegSeconds, .randomEndpoint], in: .other)
return model return model
@ -196,6 +197,8 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case dnsServer case dnsServer
case dnsDomain
case keepAlive case keepAlive
case renegSeconds case renegSeconds
@ -310,6 +313,12 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
cell.accessoryType = .none cell.accessoryType = .none
cell.isTappable = false cell.isTappable = false
case .dnsDomain:
cell.leftText = L10n.Configuration.Cells.DnsDomain.caption
cell.rightText = configuration.searchDomain ?? L10n.Configuration.Cells.DnsDomain.Value.none
cell.accessoryType = .none
cell.isTappable = false
case .keepAlive: case .keepAlive:
cell.leftText = L10n.Configuration.Cells.KeepAlive.caption cell.leftText = L10n.Configuration.Cells.KeepAlive.caption
if let keepAlive = configuration.keepAliveInterval, keepAlive > 0 { if let keepAlive = configuration.keepAliveInterval, keepAlive > 0 {

View File

@ -168,6 +168,8 @@
"configuration.cells.tls_wrapping.value.crypt" = "Encryption"; "configuration.cells.tls_wrapping.value.crypt" = "Encryption";
"configuration.cells.eku.caption" = "Extended verification"; "configuration.cells.eku.caption" = "Extended verification";
"configuration.cells.dns_server.caption" = "Address"; "configuration.cells.dns_server.caption" = "Address";
"configuration.cells.dns_domain.caption" = "Domain";
"configuration.cells.dns_domain.value.none" = "None";
"configuration.cells.compression_framing.caption" = "Framing"; "configuration.cells.compression_framing.caption" = "Framing";
"configuration.cells.compression_framing.value.lzo" = "--comp-lzo"; "configuration.cells.compression_framing.value.lzo" = "--comp-lzo";
"configuration.cells.compression_framing.value.compress" = "--compress"; "configuration.cells.compression_framing.value.compress" = "--compress";

View File

@ -63,11 +63,11 @@ public struct InfrastructurePreset: Codable {
case tlsWrap = "wrap" case tlsWrap = "wrap"
case usesPIAPatches = "pia"
case checksEKU = "eku" case checksEKU = "eku"
case randomizeEndpoint = "random" case randomizeEndpoint = "random"
case usesPIAPatches = "pia"
} }
public let id: String public let id: String

View File

@ -150,6 +150,14 @@ public enum L10n {
public static let embedded = L10n.tr("Localizable", "configuration.cells.digest.value.embedded") public static let embedded = L10n.tr("Localizable", "configuration.cells.digest.value.embedded")
} }
} }
public enum DnsDomain {
/// Domain
public static let caption = L10n.tr("Localizable", "configuration.cells.dns_domain.caption")
public enum Value {
/// None
public static let `none` = L10n.tr("Localizable", "configuration.cells.dns_domain.value.none")
}
}
public enum DnsServer { public enum DnsServer {
/// Address /// Address
public static let caption = L10n.tr("Localizable", "configuration.cells.dns_server.caption") public static let caption = L10n.tr("Localizable", "configuration.cells.dns_server.caption")