mirror of
https://github.com/kkebo/DNSecure.git
synced 2026-03-11 08:54:36 +00:00
Merge pull request #123 from kkebo/naming-convention
This commit is contained in:
commit
41dfa8b900
6 changed files with 36 additions and 38 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
893AA853258F99630060B022 /* NEOnDemandRuleInterfaceType+CaseIterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA852258F99630060B022 /* NEOnDemandRuleInterfaceType+CaseIterable.swift */; };
|
893AA853258F99630060B022 /* NEOnDemandRuleInterfaceType+CaseIterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA852258F99630060B022 /* NEOnDemandRuleInterfaceType+CaseIterable.swift */; };
|
||||||
893AA858258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA857258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift */; };
|
893AA858258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA857258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift */; };
|
||||||
893AA85D258F997A0060B022 /* NEOnDemandRuleInterfaceType+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA85C258F997A0060B022 /* NEOnDemandRuleInterfaceType+Codable.swift */; };
|
893AA85D258F997A0060B022 /* NEOnDemandRuleInterfaceType+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA85C258F997A0060B022 /* NEOnDemandRuleInterfaceType+Codable.swift */; };
|
||||||
893AA862258F998C0060B022 /* NEOnDemandRuleInterfaceType+ssidIsUsed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA861258F998C0060B022 /* NEOnDemandRuleInterfaceType+ssidIsUsed.swift */; };
|
893AA862258F998C0060B022 /* NEOnDemandRuleInterfaceType+isSSIDUsed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA861258F998C0060B022 /* NEOnDemandRuleInterfaceType+isSSIDUsed.swift */; };
|
||||||
893AA867258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA866258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift */; };
|
893AA867258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA866258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift */; };
|
||||||
893AA86C258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA86B258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift */; };
|
893AA86C258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA86B258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift */; };
|
||||||
893AA871258F99AD0060B022 /* NEOnDemandRuleAction+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA870258F99AD0060B022 /* NEOnDemandRuleAction+Codable.swift */; };
|
893AA871258F99AD0060B022 /* NEOnDemandRuleAction+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893AA870258F99AD0060B022 /* NEOnDemandRuleAction+Codable.swift */; };
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
893AA852258F99630060B022 /* NEOnDemandRuleInterfaceType+CaseIterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleInterfaceType+CaseIterable.swift"; sourceTree = "<group>"; };
|
893AA852258F99630060B022 /* NEOnDemandRuleInterfaceType+CaseIterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleInterfaceType+CaseIterable.swift"; sourceTree = "<group>"; };
|
||||||
893AA857258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleInterfaceType+CustomStringConvertible.swift"; sourceTree = "<group>"; };
|
893AA857258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleInterfaceType+CustomStringConvertible.swift"; sourceTree = "<group>"; };
|
||||||
893AA85C258F997A0060B022 /* NEOnDemandRuleInterfaceType+Codable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleInterfaceType+Codable.swift"; sourceTree = "<group>"; };
|
893AA85C258F997A0060B022 /* NEOnDemandRuleInterfaceType+Codable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleInterfaceType+Codable.swift"; sourceTree = "<group>"; };
|
||||||
893AA861258F998C0060B022 /* NEOnDemandRuleInterfaceType+ssidIsUsed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleInterfaceType+ssidIsUsed.swift"; sourceTree = "<group>"; };
|
893AA861258F998C0060B022 /* NEOnDemandRuleInterfaceType+isSSIDUsed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleInterfaceType+isSSIDUsed.swift"; sourceTree = "<group>"; };
|
||||||
893AA866258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleAction+CaseIterable.swift"; sourceTree = "<group>"; };
|
893AA866258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleAction+CaseIterable.swift"; sourceTree = "<group>"; };
|
||||||
893AA86B258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleAction+CustomStringConvertible.swift"; sourceTree = "<group>"; };
|
893AA86B258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleAction+CustomStringConvertible.swift"; sourceTree = "<group>"; };
|
||||||
893AA870258F99AD0060B022 /* NEOnDemandRuleAction+Codable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleAction+Codable.swift"; sourceTree = "<group>"; };
|
893AA870258F99AD0060B022 /* NEOnDemandRuleAction+Codable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEOnDemandRuleAction+Codable.swift"; sourceTree = "<group>"; };
|
||||||
|
|
@ -142,7 +142,7 @@
|
||||||
893AA852258F99630060B022 /* NEOnDemandRuleInterfaceType+CaseIterable.swift */,
|
893AA852258F99630060B022 /* NEOnDemandRuleInterfaceType+CaseIterable.swift */,
|
||||||
893AA857258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift */,
|
893AA857258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift */,
|
||||||
893AA85C258F997A0060B022 /* NEOnDemandRuleInterfaceType+Codable.swift */,
|
893AA85C258F997A0060B022 /* NEOnDemandRuleInterfaceType+Codable.swift */,
|
||||||
893AA861258F998C0060B022 /* NEOnDemandRuleInterfaceType+ssidIsUsed.swift */,
|
893AA861258F998C0060B022 /* NEOnDemandRuleInterfaceType+isSSIDUsed.swift */,
|
||||||
893AA866258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift */,
|
893AA866258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift */,
|
||||||
893AA86B258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift */,
|
893AA86B258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift */,
|
||||||
893AA870258F99AD0060B022 /* NEOnDemandRuleAction+Codable.swift */,
|
893AA870258F99AD0060B022 /* NEOnDemandRuleAction+Codable.swift */,
|
||||||
|
|
@ -366,7 +366,7 @@
|
||||||
893AA858258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift in Sources */,
|
893AA858258F996F0060B022 /* NEOnDemandRuleInterfaceType+CustomStringConvertible.swift in Sources */,
|
||||||
8940023C24ACBD2700EBE74B /* DNSecureApp.swift in Sources */,
|
8940023C24ACBD2700EBE74B /* DNSecureApp.swift in Sources */,
|
||||||
8998041628DCDED800C8B421 /* DoTSections.swift in Sources */,
|
8998041628DCDED800C8B421 /* DoTSections.swift in Sources */,
|
||||||
893AA862258F998C0060B022 /* NEOnDemandRuleInterfaceType+ssidIsUsed.swift in Sources */,
|
893AA862258F998C0060B022 /* NEOnDemandRuleInterfaceType+isSSIDUsed.swift in Sources */,
|
||||||
893AA867258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift in Sources */,
|
893AA867258F99990060B022 /* NEOnDemandRuleAction+CaseIterable.swift in Sources */,
|
||||||
893AA86C258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift in Sources */,
|
893AA86C258F99A10060B022 /* NEOnDemandRuleAction+CustomStringConvertible.swift in Sources */,
|
||||||
8963FDFB251DF1BC00E3DFE7 /* Bundle+displayName.swift in Sources */,
|
8963FDFB251DF1BC00E3DFE7 /* Bundle+displayName.swift in Sources */,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
//
|
||||||
|
// NEOnDemandRuleInterfaceType+isSSIDUsed.swift
|
||||||
|
// DNSecure
|
||||||
|
//
|
||||||
|
// Created by Kenta Kubo on 12/20/20.
|
||||||
|
//
|
||||||
|
|
||||||
|
import NetworkExtension
|
||||||
|
|
||||||
|
extension NEOnDemandRuleInterfaceType {
|
||||||
|
var isSSIDUsed: Bool {
|
||||||
|
switch self {
|
||||||
|
case .any, .wiFi: true
|
||||||
|
case _: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
//
|
|
||||||
// NEOnDemandRuleInterfaceType+ssidIsUsed.swift
|
|
||||||
// DNSecure
|
|
||||||
//
|
|
||||||
// Created by Kenta Kubo on 12/20/20.
|
|
||||||
//
|
|
||||||
|
|
||||||
import NetworkExtension
|
|
||||||
|
|
||||||
extension NEOnDemandRuleInterfaceType {
|
|
||||||
var ssidIsUsed: Bool {
|
|
||||||
switch self {
|
|
||||||
case .any, .wiFi:
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -133,7 +133,7 @@ extension Array where Self.Element == OnDemandRule {
|
||||||
case .connect:
|
case .connect:
|
||||||
let newRule = NEOnDemandRuleConnect()
|
let newRule = NEOnDemandRuleConnect()
|
||||||
newRule.interfaceTypeMatch = rule.interfaceType
|
newRule.interfaceTypeMatch = rule.interfaceType
|
||||||
if rule.interfaceType.ssidIsUsed {
|
if rule.interfaceType.isSSIDUsed {
|
||||||
newRule.ssidMatch = rule.ssidMatch
|
newRule.ssidMatch = rule.ssidMatch
|
||||||
}
|
}
|
||||||
newRule.dnsSearchDomainMatch = rule.dnsSearchDomainMatch
|
newRule.dnsSearchDomainMatch = rule.dnsSearchDomainMatch
|
||||||
|
|
@ -143,7 +143,7 @@ extension Array where Self.Element == OnDemandRule {
|
||||||
case .disconnect:
|
case .disconnect:
|
||||||
let newRule = NEOnDemandRuleDisconnect()
|
let newRule = NEOnDemandRuleDisconnect()
|
||||||
newRule.interfaceTypeMatch = rule.interfaceType
|
newRule.interfaceTypeMatch = rule.interfaceType
|
||||||
if rule.interfaceType.ssidIsUsed {
|
if rule.interfaceType.isSSIDUsed {
|
||||||
newRule.ssidMatch = rule.ssidMatch
|
newRule.ssidMatch = rule.ssidMatch
|
||||||
}
|
}
|
||||||
newRule.dnsSearchDomainMatch = rule.dnsSearchDomainMatch
|
newRule.dnsSearchDomainMatch = rule.dnsSearchDomainMatch
|
||||||
|
|
@ -153,7 +153,7 @@ extension Array where Self.Element == OnDemandRule {
|
||||||
case .evaluateConnection:
|
case .evaluateConnection:
|
||||||
let newRule = NEOnDemandRuleEvaluateConnection()
|
let newRule = NEOnDemandRuleEvaluateConnection()
|
||||||
newRule.interfaceTypeMatch = rule.interfaceType
|
newRule.interfaceTypeMatch = rule.interfaceType
|
||||||
if rule.interfaceType.ssidIsUsed {
|
if rule.interfaceType.isSSIDUsed {
|
||||||
newRule.ssidMatch = rule.ssidMatch
|
newRule.ssidMatch = rule.ssidMatch
|
||||||
}
|
}
|
||||||
newRule.dnsSearchDomainMatch = rule.dnsSearchDomainMatch
|
newRule.dnsSearchDomainMatch = rule.dnsSearchDomainMatch
|
||||||
|
|
@ -163,7 +163,7 @@ extension Array where Self.Element == OnDemandRule {
|
||||||
case .ignore:
|
case .ignore:
|
||||||
let newRule = NEOnDemandRuleIgnore()
|
let newRule = NEOnDemandRuleIgnore()
|
||||||
newRule.interfaceTypeMatch = rule.interfaceType
|
newRule.interfaceTypeMatch = rule.interfaceType
|
||||||
if rule.interfaceType.ssidIsUsed {
|
if rule.interfaceType.isSSIDUsed {
|
||||||
newRule.ssidMatch = rule.ssidMatch
|
newRule.ssidMatch = rule.ssidMatch
|
||||||
}
|
}
|
||||||
newRule.dnsSearchDomainMatch = rule.dnsSearchDomainMatch
|
newRule.dnsSearchDomainMatch = rule.dnsSearchDomainMatch
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ struct ContentView {
|
||||||
@Binding var usedID: String?
|
@Binding var usedID: String?
|
||||||
@State private var isEnabled = false
|
@State private var isEnabled = false
|
||||||
@State private var selection: Int?
|
@State private var selection: Int?
|
||||||
@State private var alertIsPresented = false
|
@State private var isAlertPresented = false
|
||||||
@State private var alertTitle = ""
|
@State private var alertTitle = ""
|
||||||
@State private var alertMessage = ""
|
@State private var alertMessage = ""
|
||||||
@State private var guideIsPresented = false
|
@State private var isGuidePresented = false
|
||||||
@State private var isRestoring = false
|
@State private var isRestoring = false
|
||||||
|
|
||||||
private func addNewDoTServer() {
|
private func addNewDoTServer() {
|
||||||
|
|
@ -112,7 +112,7 @@ struct ContentView {
|
||||||
self.removeSettings()
|
self.removeSettings()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
logger.debug("DNS settings was saved")
|
//logger.debug("DNS settings was saved")
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +138,7 @@ struct ContentView {
|
||||||
self.alert("Remove Error", removeError.localizedDescription)
|
self.alert("Remove Error", removeError.localizedDescription)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
logger.debug("DNS settings was removed")
|
//logger.debug("DNS settings was removed")
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +146,7 @@ struct ContentView {
|
||||||
private func alert(_ title: String, _ message: String) {
|
private func alert(_ title: String, _ message: String) {
|
||||||
self.alertTitle = title
|
self.alertTitle = title
|
||||||
self.alertMessage = message
|
self.alertMessage = message
|
||||||
self.alertIsPresented = true
|
self.isAlertPresented = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,7 +180,7 @@ extension ContentView: View {
|
||||||
}
|
}
|
||||||
.navigationTitle(Bundle.main.displayName!)
|
.navigationTitle(Bundle.main.displayName!)
|
||||||
.toolbar { self.toolbarContent }
|
.toolbar { self.toolbarContent }
|
||||||
.alert(self.alertTitle, isPresented: self.$alertIsPresented) {
|
.alert(self.alertTitle, isPresented: self.$isAlertPresented) {
|
||||||
} message: {
|
} message: {
|
||||||
Text(self.alertMessage)
|
Text(self.alertMessage)
|
||||||
}
|
}
|
||||||
|
|
@ -263,7 +263,7 @@ extension ContentView: View {
|
||||||
}
|
}
|
||||||
.navigationTitle(Bundle.main.displayName!)
|
.navigationTitle(Bundle.main.displayName!)
|
||||||
.toolbar { self.toolbarContent }
|
.toolbar { self.toolbarContent }
|
||||||
.alert(self.alertTitle, isPresented: self.$alertIsPresented) {
|
.alert(self.alertTitle, isPresented: self.$isAlertPresented) {
|
||||||
} message: {
|
} message: {
|
||||||
Text(self.alertMessage)
|
Text(self.alertMessage)
|
||||||
}
|
}
|
||||||
|
|
@ -331,18 +331,18 @@ extension ContentView: View {
|
||||||
}
|
}
|
||||||
if !self.isEnabled {
|
if !self.isEnabled {
|
||||||
Button {
|
Button {
|
||||||
self.guideIsPresented = true
|
self.isGuidePresented = true
|
||||||
} label: {
|
} label: {
|
||||||
Label("How to Activate", systemImage: "questionmark.circle")
|
Label("How to Activate", systemImage: "questionmark.circle")
|
||||||
}
|
}
|
||||||
.labelStyle(.titleAndIcon)
|
.labelStyle(.titleAndIcon)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.sheet(isPresented: self.$guideIsPresented) {
|
.sheet(isPresented: self.$isGuidePresented) {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
HowToActivateView()
|
HowToActivateView()
|
||||||
.safeAreaInset(edge: .bottom) {
|
.safeAreaInset(edge: .bottom) {
|
||||||
Button("Dismiss") {
|
Button("Dismiss") {
|
||||||
self.guideIsPresented = false
|
self.isGuidePresented = false
|
||||||
}
|
}
|
||||||
.buttonStyle(.borderedProminent)
|
.buttonStyle(.borderedProminent)
|
||||||
.controlSize(.large)
|
.controlSize(.large)
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ extension RuleView: View {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.rule.interfaceType.ssidIsUsed {
|
if self.rule.interfaceType.isSSIDUsed {
|
||||||
Section {
|
Section {
|
||||||
ForEach(0..<self.rule.ssidMatch.count, id: \.self) { i in
|
ForEach(0..<self.rule.ssidMatch.count, id: \.self) { i in
|
||||||
LazyTextField(
|
LazyTextField(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue