File tree Expand file tree Collapse file tree 1 file changed +9
-23
lines changed Expand file tree Collapse file tree 1 file changed +9
-23
lines changed Original file line number Diff line number Diff line change 1515import NIO
1616import NIOHTTP1
1717
18- #if canImport(Network)
19- import Network
20-
21- internal extension String {
22- var isIPAddress : Bool {
23- if IPv4Address ( self ) != nil || IPv6Address ( self ) != nil {
24- return true
25- }
26- return false
18+ internal extension String {
19+ var isIPAddress : Bool {
20+ var ipv4Addr = in_addr ( )
21+ var ipv6Addr = in6_addr ( )
22+
23+ return self . withCString { ptr in
24+ inet_pton ( AF_INET, ptr, & ipv4Addr) == 1 ||
25+ inet_pton ( AF_INET6, ptr, & ipv6Addr) == 1
2726 }
2827 }
29-
30- #else
31- internal extension String {
32- var isIPAddress : Bool {
33- var ipv4Addr = in_addr ( )
34- var ipv6Addr = in6_addr ( )
35-
36- return self . withCString { ptr in
37- inet_pton ( AF_INET, ptr, & ipv4Addr) == 1 ||
38- inet_pton ( AF_INET6, ptr, & ipv6Addr) == 1
39- }
40- }
41- }
42- #endif
28+ }
4329
4430public final class HTTPClientCopyingDelegate : HTTPClientResponseDelegate {
4531 public typealias Response = Void
You can’t perform that action at this time.
0 commit comments