Issue #2: Moved BlocklistOption into its own file.

This commit is contained in:
Benjamin Erhart 2026-04-14 18:19:09 +02:00
parent 9d016eea17
commit 3ec25bc247
2 changed files with 69 additions and 61 deletions

69
dns/BlocklistOption.swift Normal file
View file

@ -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"
}
}
}

View file

@ -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