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 { if networkChoices.dns != .server {
sections.append(.manualDNSProtocol) sections.append(.manualDNSProtocol)
switch networkSettings.dnsProtocol { switch networkSettings.dnsProtocol {
case .https, .tls: case .https:
break break
default: default:

View File

@ -136,14 +136,14 @@
<objects> <objects>
<viewController title="DNS" id="mbI-Io-BZh" userLabel="DNS" customClass="DNSViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController"> <viewController title="DNS" id="mbI-Io-BZh" userLabel="DNS" customClass="DNSViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="We2-9p-1Vt"> <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"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Zao-dc-fzq"> <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> <subviews>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bFA-yD-Roy"> <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> <constraints>
<constraint firstAttribute="width" constant="240" id="euy-38-pqL"/> <constraint firstAttribute="width" constant="240" id="euy-38-pqL"/>
</constraints> </constraints>
@ -163,10 +163,18 @@
</connections> </connections>
</popUpButton> </popUpButton>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Zfd-mA-qV9"> <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> <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"> <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> <constraints>
<constraint firstAttribute="width" constant="240" id="2y9-wd-q0g"/> <constraint firstAttribute="width" constant="240" id="2y9-wd-q0g"/>
</constraints> </constraints>
@ -185,52 +193,58 @@
<action selector="pickProtocol:" target="mbI-Io-BZh" id="ik0-nd-ODu"/> <action selector="pickProtocol:" target="mbI-Io-BZh" id="ik0-nd-ODu"/>
</connections> </connections>
</popUpButton> </popUpButton>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oRM-XY-fH6"> <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="309" width="344" height="21"/> <rect key="frame" x="150" y="0.0" width="440" height="357"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="pa5-Wv-hRq"> <subviews>
<font key="font" metaFont="system"/> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oRM-XY-fH6">
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <rect key="frame" x="0.0" y="336" width="344" height="21"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="pa5-Wv-hRq">
</textFieldCell> <font key="font" metaFont="system"/>
</textField> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="L6f-kb-mEG"> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<rect key="frame" x="150" y="170" width="344" height="160"/> </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> <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> </constraints>
</customView> <visibilityPriorities>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Baa-Z1-JJJ"> <integer value="1000"/>
<rect key="frame" x="150" y="0.0" width="344" height="160"/> <integer value="1000"/>
<constraints> <integer value="1000"/>
<constraint firstAttribute="height" constant="160" id="BTk-TZ-Dat"/> </visibilityPriorities>
</constraints> <customSpacing>
</customView> <real value="3.4028234663852886e+38"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ef3-Zx-nCS"> <real value="3.4028234663852886e+38"/>
<rect key="frame" x="-2" y="352" width="144" height="16"/> <real value="3.4028234663852886e+38"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="PROTO" id="lpP-C3-tYW"> </customSpacing>
<font key="font" usesAppearanceFont="YES"/> </stackView>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="CSz-iK-Imy" firstAttribute="top" secondItem="Zfd-mA-qV9" secondAttribute="top" id="0rT-Xa-fsr"/> <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 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 firstAttribute="trailing" secondItem="VB1-6I-men" secondAttribute="trailing" id="P3L-ud-eD0"/>
<constraint firstItem="Baa-Z1-JJJ" firstAttribute="leading" secondItem="L6f-kb-mEG" secondAttribute="leading" id="OAq-vY-0dj"/>
<constraint firstItem="ef3-Zx-nCS" firstAttribute="centerY" secondItem="CSz-iK-Imy" secondAttribute="centerY" id="PLm-Ng-tlW"/> <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 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="VB1-6I-men" secondAttribute="bottom" id="hFM-7e-UdP"/>
<constraint firstAttribute="bottom" secondItem="Baa-Z1-JJJ" secondAttribute="bottom" id="ciR-fE-0Bj"/> <constraint firstItem="VB1-6I-men" firstAttribute="leading" secondItem="CSz-iK-Imy" secondAttribute="leading" id="lUN-SE-VwO"/>
<constraint firstItem="Baa-Z1-JJJ" firstAttribute="top" secondItem="oRM-XY-fH6" secondAttribute="bottom" priority="250" constant="10" id="ljr-hl-Iip"/>
<constraint firstItem="CSz-iK-Imy" firstAttribute="leading" secondItem="ef3-Zx-nCS" secondAttribute="trailing" constant="10" id="nOE-xl-CUa"/> <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="VB1-6I-men" firstAttribute="top" secondItem="CSz-iK-Imy" secondAttribute="bottom" constant="20" id="zYP-pf-qiS"/>
<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"/>
</constraints> </constraints>
</customView> </customView>
</subviews> </subviews>
@ -240,7 +254,7 @@
<constraint firstItem="Zfd-mA-qV9" firstAttribute="leading" secondItem="Zao-dc-fzq" secondAttribute="leading" id="C1K-EU-y2R"/> <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 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 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 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="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"/> <constraint firstItem="Zfd-mA-qV9" firstAttribute="top" secondItem="bFA-yD-Roy" secondAttribute="bottom" constant="10" id="ymz-zd-mjc"/>
@ -255,9 +269,7 @@
</constraints> </constraints>
</view> </view>
<connections> <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="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="constraintSettingsTop" destination="ymz-zd-mjc" id="sN1-KM-hgC"/>
<outlet property="labelDNSProtocol" destination="ef3-Zx-nCS" id="nec-BT-J2J"/> <outlet property="labelDNSProtocol" destination="ef3-Zx-nCS" id="nec-BT-J2J"/>
<outlet property="popupChoice" destination="bFA-yD-Roy" id="lYe-Ho-P0K"/> <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 constraintSettingsTop: NSLayoutConstraint!
@IBOutlet private var constraintCustomBottom: NSLayoutConstraint!
@IBOutlet private var constraintAddressesBottom: NSLayoutConstraint!
private lazy var tableDNSDomains: TextTableView = .get() private lazy var tableDNSDomains: TextTableView = .get()
private lazy var tableDNSAddresses: TextTableView = .get() private lazy var tableDNSAddresses: TextTableView = .get()
@ -208,25 +204,22 @@ class DNSViewController: NSViewController, ProfileCustomization {
private func updateProtocolVisibility() { private func updateProtocolVisibility() {
let isManual = (currentChoice == .manual) let isManual = (currentChoice == .manual)
let isCustom: Bool
switch networkSettings.dnsProtocol { switch networkSettings.dnsProtocol {
case .https: case .https:
isCustom = true
textDNSCustom.placeholderString = isManual ? AppConstants.Placeholders.dohURL : "" textDNSCustom.placeholderString = isManual ? AppConstants.Placeholders.dohURL : ""
textDNSCustom.stringValue = networkSettings.dnsHTTPSURL?.absoluteString ?? "" textDNSCustom.stringValue = networkSettings.dnsHTTPSURL?.absoluteString ?? ""
textDNSCustom.isHidden = false
viewDNSAddresses.isHidden = true
case .tls: case .tls:
isCustom = true
textDNSCustom.placeholderString = isManual ? AppConstants.Placeholders.dotServerName : "" textDNSCustom.placeholderString = isManual ? AppConstants.Placeholders.dotServerName : ""
textDNSCustom.stringValue = networkSettings.dnsTLSServerName ?? "" textDNSCustom.stringValue = networkSettings.dnsTLSServerName ?? ""
textDNSCustom.isHidden = false
viewDNSAddresses.isHidden = false
default: 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 def shared_pods
#pod_version $tunnelkit_name, $tunnelkit_specs, '~> 3.1.0' #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_path $tunnelkit_name, $tunnelkit_specs, '..'
pod 'SSZipArchive' pod 'SSZipArchive'
pod 'Kvitto', :git => 'https://github.com/keeshux/Kvitto', :branch => 'enable-macos-spec' 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`) - Kvitto (from `https://github.com/keeshux/Kvitto`, branch `enable-macos-spec`)
- MBProgressHUD - MBProgressHUD
- SSZipArchive - SSZipArchive
- TunnelKit/Extra/LZO (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 `5014e65`) - TunnelKit/Protocols/OpenVPN (from `https://github.com/passepartoutvpn/tunnelkit`, commit `790ec27`)
SPEC REPOS: SPEC REPOS:
https://github.com/cocoapods/specs.git: https://github.com/cocoapods/specs.git:
@ -71,7 +71,7 @@ EXTERNAL SOURCES:
:branch: enable-macos-spec :branch: enable-macos-spec
:git: https://github.com/keeshux/Kvitto :git: https://github.com/keeshux/Kvitto
TunnelKit: TunnelKit:
:commit: '5014e65' :commit: 790ec27
:git: https://github.com/passepartoutvpn/tunnelkit :git: https://github.com/passepartoutvpn/tunnelkit
CHECKOUT OPTIONS: CHECKOUT OPTIONS:
@ -82,7 +82,7 @@ CHECKOUT OPTIONS:
:commit: e263fcd1f40a6a482a0f1e424ba98009c4ad2b96 :commit: e263fcd1f40a6a482a0f1e424ba98009c4ad2b96
:git: https://github.com/keeshux/Kvitto :git: https://github.com/keeshux/Kvitto
TunnelKit: TunnelKit:
:commit: '5014e65' :commit: 790ec27
:git: https://github.com/passepartoutvpn/tunnelkit :git: https://github.com/passepartoutvpn/tunnelkit
SPEC CHECKSUMS: SPEC CHECKSUMS:
@ -95,6 +95,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: 2e8acd6fc90c6d0a27055867a290794926d57c02 SwiftyBeaver: 2e8acd6fc90c6d0a27055867a290794926d57c02
TunnelKit: 2a6aadea2d772a2760b153aee27d1c334c9ca6db TunnelKit: 2a6aadea2d772a2760b153aee27d1c334c9ca6db
PODFILE CHECKSUM: 90f34e726cde9553212321b6f95cd79f284e0dca PODFILE CHECKSUM: cc3df077424e69b4f02e5ed3d26fe4be4786b733
COCOAPODS: 1.10.0 COCOAPODS: 1.10.0