punchnet-macos/Tun/Session/Session.swift
2026-05-21 14:39:41 +08:00

37 lines
907 B
Swift

//
// Session.swift
// sdlan
// Session
// Created by on 2025/7/14.
//
import Foundation
import NIOCore
struct Session {
enum AddressType: String, Hashable {
case v4
case v6
}
// ip,
let dstMac: Data
// nat
let natAddress: SocketAddress
//
let addressType: AddressType
// 使
var lastTimestamp: Int32
init?(dstMac: Data, natAddress: SocketAddress, addressType: AddressType) {
self.dstMac = dstMac
self.natAddress = natAddress
self.addressType = addressType
self.lastTimestamp = Int32(Date().timeIntervalSince1970)
}
mutating func updateLastTimestamp(_ lastTimestamp: Int32) {
self.lastTimestamp = lastTimestamp
}
}