punchnet-macos/Tun/Punchnet/Policy/IdentityRuleMap.swift
2026-02-05 15:25:22 +08:00

26 lines
497 B
Swift

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