// // RuleMap.swift // punchnet // // Created by 安礼成 on 2026/2/5. // struct IdentityRuleMap { // map[proto][port] let ruleMap: [UInt8: [UInt16: Bool]] init(ruleMap: [UInt8: [UInt16: Bool]]) { self.ruleMap = ruleMap } func isAllow(proto: UInt8, port: UInt16) -> Bool { if let portMap = self.ruleMap[proto], let allowed = portMap[port] { return allowed } else { return false } } }