Show proxy servers in configuration

This commit is contained in:
Davide De Rosa 2019-04-13 09:30:53 +02:00
parent 9a6d6c009e
commit 6aa3ec2e76
3 changed files with 46 additions and 20 deletions

View File

@ -59,14 +59,14 @@ class ConfigurationViewController: UIViewController, TableModelHost {
}
model.add(.tls)
model.add(.compression)
model.add(.dns)
model.add(.network)
model.add(.other)
// 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)
model.setHeader(L10n.Configuration.Sections.Dns.header, for: .dns)
model.setHeader(L10n.Configuration.Sections.Network.header, for: .network)
model.setHeader(L10n.Configuration.Sections.Other.header, for: .other)
// footers
@ -81,14 +81,16 @@ class ConfigurationViewController: UIViewController, TableModelHost {
}
model.set([.client, .tlsWrapping, .eku], in: .tls)
model.set([.compressionFraming, .compressionAlgorithm], in: .compression)
var dnsRows: [RowType]
var networkRows: [RowType]
if let dnsServers = configuration.dnsServers {
dnsRows = [RowType](repeating: .dnsServer, count: dnsServers.count)
networkRows = [RowType](repeating: .dnsServer, count: dnsServers.count)
} else {
dnsRows = []
networkRows = []
}
dnsRows.append(.dnsDomain)
model.set(dnsRows, in: .dns)
networkRows.append(.dnsDomain)
networkRows.append(.httpProxy)
networkRows.append(.httpsProxy)
model.set(networkRows, in: .network)
model.set([.keepAlive, .renegSeconds, .randomEndpoint], in: .other)
return model
@ -173,7 +175,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case compression
case dns
case network
case other
}
@ -199,6 +201,10 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case dnsDomain
case httpProxy
case httpsProxy
case keepAlive
case renegSeconds
@ -309,10 +315,22 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case .dnsDomain:
cell.leftText = L10n.Configuration.Cells.DnsDomain.caption
cell.rightText = configuration.searchDomain ?? L10n.Configuration.Cells.DnsDomain.Value.none
cell.rightText = configuration.searchDomain ?? L10n.Configuration.Cells.All.Value.none
cell.accessoryType = .none
cell.isTappable = false
case .httpProxy:
cell.leftText = L10n.Configuration.Cells.ProxyHttp.caption
cell.rightText = configuration.httpProxy?.description ?? L10n.Configuration.Cells.All.Value.none
cell.accessoryType = .none
cell.isTappable = false
case .httpsProxy:
cell.leftText = L10n.Configuration.Cells.ProxyHttps.caption
cell.rightText = configuration.httpsProxy?.description ?? L10n.Configuration.Cells.All.Value.none
cell.accessoryType = .none
cell.isTappable = false
case .keepAlive:
cell.leftText = L10n.Configuration.Cells.KeepAlive.caption
if let keepAlive = configuration.keepAliveInterval, keepAlive > 0 {

View File

@ -169,7 +169,7 @@
"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.network.header" = "Network";
"configuration.sections.other.header" = "Other";
"configuration.cells.cipher.caption" = "Cipher";
"configuration.cells.digest.caption" = "Authentication";
@ -182,9 +182,10 @@
"configuration.cells.tls_wrapping.value.auth" = "Authentication";
"configuration.cells.tls_wrapping.value.crypt" = "Encryption";
"configuration.cells.eku.caption" = "Extended verification";
"configuration.cells.dns_server.caption" = "Address";
"configuration.cells.dns_server.caption" = "DNS";
"configuration.cells.dns_domain.caption" = "Domain";
"configuration.cells.dns_domain.value.none" = "None";
"configuration.cells.proxy_http.caption" = "Proxy";
"configuration.cells.proxy_https.caption" = "Proxy (HTTPS)";
"configuration.cells.compression_framing.caption" = "Framing";
"configuration.cells.compression_framing.value.lzo" = "--comp-lzo";
"configuration.cells.compression_framing.value.compress" = "--compress";
@ -198,6 +199,7 @@
"configuration.cells.random_endpoint.caption" = "Randomize endpoint";
"configuration.cells.all.value.enabled" = "Enabled";
"configuration.cells.all.value.disabled" = "Disabled";
"configuration.cells.all.value.none" = "None";
"debug_log.buttons.previous" = "Previous";
"debug_log.buttons.next" = "Next";

View File

@ -142,6 +142,8 @@ public enum L10n {
public static let disabled = L10n.tr("Localizable", "configuration.cells.all.value.disabled")
/// Enabled
public static let enabled = L10n.tr("Localizable", "configuration.cells.all.value.enabled")
/// None
public static let `none` = L10n.tr("Localizable", "configuration.cells.all.value.none")
}
}
public enum Cipher {
@ -189,13 +191,9 @@ public enum L10n {
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 {
/// Address
/// DNS
public static let caption = L10n.tr("Localizable", "configuration.cells.dns_server.caption")
}
public enum Eku {
@ -212,6 +210,14 @@ public enum L10n {
}
}
}
public enum ProxyHttp {
/// Proxy
public static let caption = L10n.tr("Localizable", "configuration.cells.proxy_http.caption")
}
public enum ProxyHttps {
/// Proxy (HTTPS)
public static let caption = L10n.tr("Localizable", "configuration.cells.proxy_https.caption")
}
public enum RandomEndpoint {
/// Randomize endpoint
public static let caption = L10n.tr("Localizable", "configuration.cells.random_endpoint.caption")
@ -250,9 +256,9 @@ public enum L10n {
/// 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")
public enum Network {
/// Network
public static let header = L10n.tr("Localizable", "configuration.sections.network.header")
}
public enum Other {
/// Other