diff --git a/dns/BlocklistOption.swift b/dns/BlocklistOption.swift new file mode 100644 index 0000000..452b679 --- /dev/null +++ b/dns/BlocklistOption.swift @@ -0,0 +1,69 @@ +// +// BlocklistOption.swift +// dns +// +// Created by Benjamin Erhart on 14.04.26. +// + +import Foundation + +enum BlocklistOption: String, CaseIterable, Identifiable { + case secure = "Secure" + case securePlusAdblock = "Secure + Adblock" + + var id: String { rawValue } + + var enabled: Bool { + switch self { + case .secure: + return true + case .securePlusAdblock: + return true //false + } + } + + var description: String { + switch self { + case .secure: + return "Malware and phishing protection" + case .securePlusAdblock: + return "Security plus ad and tracker blocking" + } + } + + var icon: String { + switch self { + case .secure: + return "shield" + case .securePlusAdblock: + return "shield.righthalf.filled" + } + } + + var server: String { + switch self { + case .secure: + return "dns.sr2.uk" + case .securePlusAdblock: + return "dnsplus.sr2.uk" + } + } + + var ipv4: String { + switch self { + case .secure: + return "144.76.160.194" + case .securePlusAdblock: + return "192.0.2.1" + } + } + + var ipv6: String { + switch self { + case .secure: + return "2a01:4f8:2210:23ea::4" + case .securePlusAdblock: + return "2001:db8::1" + } + } +} diff --git a/dns/HomeView.swift b/dns/HomeView.swift index 0bdd24a..a79c2c9 100644 --- a/dns/HomeView.swift +++ b/dns/HomeView.swift @@ -1,67 +1,6 @@ import SwiftUI -enum BlocklistOption: String, CaseIterable, Identifiable { - case secure = "Secure" - case securePlusAdblock = "Secure + Adblock" - - var id: String { rawValue } - - var enabled: Bool { - switch self { - case .secure: - return true - case .securePlusAdblock: - return false - } - } - - var description: String { - switch self { - case .secure: - return "Malware and phishing protection" - case .securePlusAdblock: - return "Security plus ad and tracker blocking" - } - } - - var icon: String { - switch self { - case .secure: - return "shield" - case .securePlusAdblock: - return "shield.righthalf.filled" - } - } - - var server: String { - switch self { - case .secure: - return "dns.sr2.uk" - case .securePlusAdblock: - return "dnsplus.sr2.uk" - } - } - - var ipv4: String { - switch self { - case .secure: - return "144.76.160.194" - case .securePlusAdblock: - return "192.0.2.1" - } - } - - var ipv6: String { - switch self { - case .secure: - return "2a01:4f8:2210:23ea::4" - case .securePlusAdblock: - return "2001:db8::1" - } - } -} - enum ServiceStatus { case pending case operational