File tree 1 file changed +9
-23
lines changed
1 file changed +9
-23
lines changed Original file line number Diff line number Diff line change 15
15
import NIO
16
16
import NIOHTTP1
17
17
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
27
26
}
28
27
}
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
+ }
43
29
44
30
public final class HTTPClientCopyingDelegate : HTTPClientResponseDelegate {
45
31
public typealias Response = Void
You can’t perform that action at this time.
0 commit comments