iOS 1.0.3 source candidate only; no Apple build or installation acceptance
This commit is contained in:
@@ -1,6 +1,20 @@
|
||||
import Foundation
|
||||
|
||||
enum NetworkAddress {
|
||||
static func isAuthorizedInternalIPv4(_ value: String) -> Bool {
|
||||
let parts = value.split(separator: ".", omittingEmptySubsequences: false)
|
||||
guard parts.count == 4 else { return false }
|
||||
let octets = parts.compactMap { UInt8($0) }
|
||||
guard octets.count == 4,
|
||||
octets.map({ String($0) }).joined(separator: ".") == value,
|
||||
octets[0] == 100,
|
||||
(64...127).contains(octets[1])
|
||||
else { return false }
|
||||
return value != "100.64.0.0"
|
||||
&& value != "100.127.255.255"
|
||||
&& value != "100.100.100.100"
|
||||
}
|
||||
|
||||
static func isPublicIPv4(_ value: String) -> Bool {
|
||||
let parts = value.split(separator: ".", omittingEmptySubsequences: false)
|
||||
guard parts.count == 4,
|
||||
|
||||
Reference in New Issue
Block a user