Initial project setup - Phases 1-3 complete
This commit is contained in:
30
ProxyCore/Sources/DataLayer/Models/DNSSpoofRule.swift
Normal file
30
ProxyCore/Sources/DataLayer/Models/DNSSpoofRule.swift
Normal file
@@ -0,0 +1,30 @@
|
||||
import Foundation
|
||||
import GRDB
|
||||
|
||||
public struct DNSSpoofRule: Codable, FetchableRecord, MutablePersistableRecord, Identifiable, Sendable {
|
||||
public var id: Int64?
|
||||
public var sourceDomain: String
|
||||
public var targetDomain: String
|
||||
public var isEnabled: Bool
|
||||
public var createdAt: Double
|
||||
|
||||
public static let databaseTableName = "dns_spoof_rules"
|
||||
|
||||
public mutating func didInsert(_ inserted: InsertionSuccess) {
|
||||
id = inserted.rowID
|
||||
}
|
||||
|
||||
public init(
|
||||
id: Int64? = nil,
|
||||
sourceDomain: String,
|
||||
targetDomain: String,
|
||||
isEnabled: Bool = true,
|
||||
createdAt: Double = Date().timeIntervalSince1970
|
||||
) {
|
||||
self.id = id
|
||||
self.sourceDomain = sourceDomain
|
||||
self.targetDomain = targetDomain
|
||||
self.isEnabled = isEnabled
|
||||
self.createdAt = createdAt
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user