Specify DNS servers also for DNS over TLS

- iOS: retain addresses section
- macOS: use a more convenient stack view
This commit is contained in:
Davide De Rosa 2021-01-26 10:25:04 +01:00
parent 6686184a9f
commit 2eb5aa8d03
5 changed files with 71 additions and 66 deletions

View File

@ -80,7 +80,7 @@ class NetworkSettingsViewController: UITableViewController {
if networkChoices.dns != .server {
sections.append(.manualDNSProtocol)
switch networkSettings.dnsProtocol {
case .https, .tls:
case .https:
break
default:

View File

@ -136,14 +136,14 @@
<objects>
<viewController title="DNS" id="mbI-Io-BZh" userLabel="DNS" customClass="DNSViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="We2-9p-1Vt">
<rect key="frame" x="0.0" y="0.0" width="514" height="440"/>
<rect key="frame" x="0.0" y="0.0" width="610" height="467"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Zao-dc-fzq">
<rect key="frame" x="0.0" y="20" width="494" height="400"/>
<rect key="frame" x="0.0" y="20" width="590" height="427"/>
<subviews>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bFA-yD-Roy">
<rect key="frame" x="147" y="376" width="247" height="25"/>
<rect key="frame" x="147" y="403" width="247" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="euy-38-pqL"/>
</constraints>
@ -163,10 +163,18 @@
</connections>
</popUpButton>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Zfd-mA-qV9">
<rect key="frame" x="0.0" y="0.0" width="494" height="370"/>
<rect key="frame" x="0.0" y="0.0" width="590" height="397"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ef3-Zx-nCS">
<rect key="frame" x="-2" y="379" width="144" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="PROTO" id="lpP-C3-tYW">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CSz-iK-Imy">
<rect key="frame" x="147" y="346" width="247" height="25"/>
<rect key="frame" x="147" y="373" width="247" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="2y9-wd-q0g"/>
</constraints>
@ -185,52 +193,58 @@
<action selector="pickProtocol:" target="mbI-Io-BZh" id="ik0-nd-ODu"/>
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oRM-XY-fH6">
<rect key="frame" x="150" y="309" width="344" height="21"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="pa5-Wv-hRq">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="L6f-kb-mEG">
<rect key="frame" x="150" y="170" width="344" height="160"/>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VB1-6I-men">
<rect key="frame" x="150" y="0.0" width="440" height="357"/>
<subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oRM-XY-fH6">
<rect key="frame" x="0.0" y="336" width="344" height="21"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="pa5-Wv-hRq">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="L6f-kb-mEG">
<rect key="frame" x="0.0" y="168" width="440" height="160"/>
<constraints>
<constraint firstAttribute="height" constant="160" id="zCq-d8-x9i"/>
</constraints>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Baa-Z1-JJJ">
<rect key="frame" x="0.0" y="0.0" width="440" height="160"/>
<constraints>
<constraint firstAttribute="height" constant="160" id="BTk-TZ-Dat"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="160" id="zCq-d8-x9i"/>
<constraint firstItem="Baa-Z1-JJJ" firstAttribute="leading" secondItem="VB1-6I-men" secondAttribute="leading" id="E4U-iU-57G"/>
<constraint firstItem="L6f-kb-mEG" firstAttribute="leading" secondItem="VB1-6I-men" secondAttribute="leading" id="U89-Q1-C6d"/>
<constraint firstAttribute="trailing" secondItem="L6f-kb-mEG" secondAttribute="trailing" id="UN9-uj-ZRd"/>
<constraint firstAttribute="trailing" secondItem="Baa-Z1-JJJ" secondAttribute="trailing" id="g14-fv-nkI"/>
</constraints>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Baa-Z1-JJJ">
<rect key="frame" x="150" y="0.0" width="344" height="160"/>
<constraints>
<constraint firstAttribute="height" constant="160" id="BTk-TZ-Dat"/>
</constraints>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ef3-Zx-nCS">
<rect key="frame" x="-2" y="352" width="144" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="PROTO" id="lpP-C3-tYW">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
<constraints>
<constraint firstItem="CSz-iK-Imy" firstAttribute="top" secondItem="Zfd-mA-qV9" secondAttribute="top" id="0rT-Xa-fsr"/>
<constraint firstItem="CSz-iK-Imy" firstAttribute="leading" secondItem="Baa-Z1-JJJ" secondAttribute="leading" id="4NK-b5-pOE"/>
<constraint firstItem="ef3-Zx-nCS" firstAttribute="leading" secondItem="Zfd-mA-qV9" secondAttribute="leading" id="9hc-Mm-7v7"/>
<constraint firstAttribute="trailing" secondItem="Baa-Z1-JJJ" secondAttribute="trailing" id="Kc3-oq-1nC"/>
<constraint firstItem="Baa-Z1-JJJ" firstAttribute="leading" secondItem="L6f-kb-mEG" secondAttribute="leading" id="OAq-vY-0dj"/>
<constraint firstAttribute="trailing" secondItem="VB1-6I-men" secondAttribute="trailing" id="P3L-ud-eD0"/>
<constraint firstItem="ef3-Zx-nCS" firstAttribute="centerY" secondItem="CSz-iK-Imy" secondAttribute="centerY" id="PLm-Ng-tlW"/>
<constraint firstItem="oRM-XY-fH6" firstAttribute="trailing" secondItem="L6f-kb-mEG" secondAttribute="trailing" id="U5i-6g-z66"/>
<constraint firstAttribute="trailing" secondItem="L6f-kb-mEG" secondAttribute="trailing" id="Ufy-l9-JnV"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="CSz-iK-Imy" secondAttribute="trailing" id="Z6g-uk-L7s"/>
<constraint firstItem="L6f-kb-mEG" firstAttribute="top" secondItem="CSz-iK-Imy" secondAttribute="bottom" constant="20" id="Z8n-Jh-qIx"/>
<constraint firstAttribute="bottom" secondItem="Baa-Z1-JJJ" secondAttribute="bottom" id="ciR-fE-0Bj"/>
<constraint firstItem="Baa-Z1-JJJ" firstAttribute="top" secondItem="oRM-XY-fH6" secondAttribute="bottom" priority="250" constant="10" id="ljr-hl-Iip"/>
<constraint firstAttribute="bottom" secondItem="VB1-6I-men" secondAttribute="bottom" id="hFM-7e-UdP"/>
<constraint firstItem="VB1-6I-men" firstAttribute="leading" secondItem="CSz-iK-Imy" secondAttribute="leading" id="lUN-SE-VwO"/>
<constraint firstItem="CSz-iK-Imy" firstAttribute="leading" secondItem="ef3-Zx-nCS" secondAttribute="trailing" constant="10" id="nOE-xl-CUa"/>
<constraint firstItem="Baa-Z1-JJJ" firstAttribute="top" secondItem="L6f-kb-mEG" secondAttribute="bottom" constant="10" id="qwn-Pc-7xS"/>
<constraint firstItem="oRM-XY-fH6" firstAttribute="leading" secondItem="L6f-kb-mEG" secondAttribute="leading" id="wE8-Cr-8A8"/>
<constraint firstItem="oRM-XY-fH6" firstAttribute="top" secondItem="L6f-kb-mEG" secondAttribute="top" id="xUI-3F-09L"/>
<constraint firstItem="VB1-6I-men" firstAttribute="top" secondItem="CSz-iK-Imy" secondAttribute="bottom" constant="20" id="zYP-pf-qiS"/>
</constraints>
</customView>
</subviews>
@ -240,7 +254,7 @@
<constraint firstItem="Zfd-mA-qV9" firstAttribute="leading" secondItem="Zao-dc-fzq" secondAttribute="leading" id="C1K-EU-y2R"/>
<constraint firstItem="bFA-yD-Roy" firstAttribute="leading" secondItem="Zao-dc-fzq" secondAttribute="leading" constant="150" id="DSy-uq-QJd"/>
<constraint firstAttribute="bottom" secondItem="Zfd-mA-qV9" secondAttribute="bottom" id="IoU-2m-d07"/>
<constraint firstItem="L6f-kb-mEG" firstAttribute="leading" secondItem="bFA-yD-Roy" secondAttribute="leading" id="hqH-9b-APZ"/>
<constraint firstItem="CSz-iK-Imy" firstAttribute="leading" secondItem="bFA-yD-Roy" secondAttribute="leading" id="lTF-D2-GBG"/>
<constraint firstAttribute="trailing" secondItem="Zfd-mA-qV9" secondAttribute="trailing" id="mkp-8f-ZKo"/>
<constraint firstItem="bFA-yD-Roy" firstAttribute="top" secondItem="Zao-dc-fzq" secondAttribute="top" id="suK-gn-ven"/>
<constraint firstItem="Zfd-mA-qV9" firstAttribute="top" secondItem="bFA-yD-Roy" secondAttribute="bottom" constant="10" id="ymz-zd-mjc"/>
@ -255,9 +269,7 @@
</constraints>
</view>
<connections>
<outlet property="constraintAddressesBottom" destination="qwn-Pc-7xS" id="f8K-7g-9N2"/>
<outlet property="constraintChoiceBottom" destination="0mN-72-zeu" id="Lf7-4v-Gae"/>
<outlet property="constraintCustomBottom" destination="ljr-hl-Iip" id="JQK-dK-cqy"/>
<outlet property="constraintSettingsTop" destination="ymz-zd-mjc" id="sN1-KM-hgC"/>
<outlet property="labelDNSProtocol" destination="ef3-Zx-nCS" id="nec-BT-J2J"/>
<outlet property="popupChoice" destination="bFA-yD-Roy" id="lYe-Ho-P0K"/>

View File

@ -46,10 +46,6 @@ class DNSViewController: NSViewController, ProfileCustomization {
@IBOutlet private var constraintSettingsTop: NSLayoutConstraint!
@IBOutlet private var constraintCustomBottom: NSLayoutConstraint!
@IBOutlet private var constraintAddressesBottom: NSLayoutConstraint!
private lazy var tableDNSDomains: TextTableView = .get()
private lazy var tableDNSAddresses: TextTableView = .get()
@ -208,25 +204,22 @@ class DNSViewController: NSViewController, ProfileCustomization {
private func updateProtocolVisibility() {
let isManual = (currentChoice == .manual)
let isCustom: Bool
switch networkSettings.dnsProtocol {
case .https:
isCustom = true
textDNSCustom.placeholderString = isManual ? AppConstants.Placeholders.dohURL : ""
textDNSCustom.stringValue = networkSettings.dnsHTTPSURL?.absoluteString ?? ""
textDNSCustom.isHidden = false
viewDNSAddresses.isHidden = true
case .tls:
isCustom = true
textDNSCustom.placeholderString = isManual ? AppConstants.Placeholders.dotServerName : ""
textDNSCustom.stringValue = networkSettings.dnsTLSServerName ?? ""
textDNSCustom.isHidden = false
viewDNSAddresses.isHidden = false
default:
isCustom = false
textDNSCustom.isHidden = true
viewDNSAddresses.isHidden = false
}
constraintCustomBottom.priority = isCustom ? .defaultHigh : .defaultLow
constraintAddressesBottom.priority = isCustom ? .defaultLow : .defaultHigh
textDNSCustom.isHidden = !isCustom
viewDNSAddresses.isHidden = isCustom
}
}

View File

@ -8,7 +8,7 @@ $tunnelkit_specs = ['Protocols/OpenVPN', 'Extra/LZO']
def shared_pods
#pod_version $tunnelkit_name, $tunnelkit_specs, '~> 3.1.0'
pod_git $tunnelkit_name, $tunnelkit_specs, '5014e65'
pod_git $tunnelkit_name, $tunnelkit_specs, '790ec27'
#pod_path $tunnelkit_name, $tunnelkit_specs, '..'
pod 'SSZipArchive'
pod 'Kvitto', :git => 'https://github.com/keeshux/Kvitto', :branch => 'enable-macos-spec'

View File

@ -52,8 +52,8 @@ DEPENDENCIES:
- Kvitto (from `https://github.com/keeshux/Kvitto`, branch `enable-macos-spec`)
- MBProgressHUD
- SSZipArchive
- TunnelKit/Extra/LZO (from `https://github.com/passepartoutvpn/tunnelkit`, commit `5014e65`)
- TunnelKit/Protocols/OpenVPN (from `https://github.com/passepartoutvpn/tunnelkit`, commit `5014e65`)
- TunnelKit/Extra/LZO (from `https://github.com/passepartoutvpn/tunnelkit`, commit `790ec27`)
- TunnelKit/Protocols/OpenVPN (from `https://github.com/passepartoutvpn/tunnelkit`, commit `790ec27`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
@ -71,7 +71,7 @@ EXTERNAL SOURCES:
:branch: enable-macos-spec
:git: https://github.com/keeshux/Kvitto
TunnelKit:
:commit: '5014e65'
:commit: 790ec27
:git: https://github.com/passepartoutvpn/tunnelkit
CHECKOUT OPTIONS:
@ -82,7 +82,7 @@ CHECKOUT OPTIONS:
:commit: e263fcd1f40a6a482a0f1e424ba98009c4ad2b96
:git: https://github.com/keeshux/Kvitto
TunnelKit:
:commit: '5014e65'
:commit: 790ec27
:git: https://github.com/passepartoutvpn/tunnelkit
SPEC CHECKSUMS:
@ -95,6 +95,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: 2e8acd6fc90c6d0a27055867a290794926d57c02
TunnelKit: 2a6aadea2d772a2760b153aee27d1c334c9ca6db
PODFILE CHECKSUM: 90f34e726cde9553212321b6f95cd79f284e0dca
PODFILE CHECKSUM: cc3df077424e69b4f02e5ed3d26fe4be4786b733
COCOAPODS: 1.10.0