Skip to content

Commit 588f164

Browse files
committed
Update IpAddrMask.swift to match mobile client
1 parent 06092f1 commit 588f164

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

swift/plugin/Sources/Defguard/IpAddrMask.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ struct IpAddrMask: Codable, Equatable {
1515
separator: "/",
1616
maxSplits: 1,
1717
)
18+
let default_cidr: UInt8
1819
if let ipv4 = IPv4Address(String(parts[0])) {
1920
address = ipv4
21+
default_cidr = 32
2022
} else if let ipv6 = IPv6Address(String(parts[0])) {
2123
address = ipv6
24+
default_cidr = 128
2225
} else {
2326
return nil
2427
}
2528
if parts.count > 1 {
2629
cidr = UInt8(parts[1]) ?? 0
2730
} else {
28-
cidr = 0
31+
cidr = default_cidr
2932
}
3033
}
3134

0 commit comments

Comments
 (0)