Files
Termind/Frameworks/TermindPersistence/TermindSchemaV19ForwardingModels.swift

33 lines
1.1 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// SPDX-FileCopyrightText: 2026 Kaede Akino
// SPDX-License-Identifier: GPL-3.0-only
import Foundation
import SwiftData
import TermindDomain
/// Freeze the V1–V19 forwarding entity before adding its optional color in V20.
public enum TermindSchemaV19ForwardingModels {
@Model
public final class PersistentPortForwardingRule {
@Attribute(.unique) public var id: UUID = UUID()
public var hostID: UUID = UUID()
public var kind = PortForwardingRule.Kind.local.rawValue
public var bindHost = "127.0.0.1"
public var bindPort = 8080
public var targetHost: String?
public var targetPort: Int?
public var label = ""
public init(_ value: PortForwardingRule) {
id = value.id
hostID = value.hostID
kind = value.kind.rawValue
bindHost = value.bindHost
bindPort = value.bindPort
targetHost = value.kind == .dynamic ? nil : value.targetHost
targetPort = value.kind == .dynamic ? nil : value.targetPort
label = value.label
}
}
}