|
63 | 63 | func getNWProtocolTLSOptions() -> NWProtocolTLS.Options { |
64 | 64 | let options = NWProtocolTLS.Options() |
65 | 65 |
|
| 66 | + let useMTELGExplainer = """ |
| 67 | + You can still use this configuration option on macOS if you initialize HTTPClient \ |
| 68 | + with a MultiThreadedEventLoopGroup. Please note that using MultiThreadedEventLoopGroup \ |
| 69 | + will make AsyncHTTPClient use NIO on BSD Sockets and not Network.framework (which is the preferred \ |
| 70 | + platform networking stack). |
| 71 | + """ |
| 72 | + |
66 | 73 | // minimum TLS protocol |
67 | 74 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) { |
68 | 75 | sec_protocol_options_set_min_tls_protocol_version(options.securityProtocolOptions, self.minimumTLSVersion.nwTLSProtocolVersion) |
|
88 | 95 |
|
89 | 96 | // the certificate chain |
90 | 97 | if self.certificateChain.count > 0 { |
91 | | - preconditionFailure("TLSConfiguration.certificateChain is not supported") |
| 98 | + preconditionFailure("TLSConfiguration.certificateChain is not supported. \(useMTELGExplainer)") |
92 | 99 | } |
93 | 100 |
|
94 | 101 | // cipher suites |
|
99 | 106 |
|
100 | 107 | // key log callback |
101 | 108 | if self.keyLogCallback != nil { |
102 | | - preconditionFailure("TLSConfiguration.keyLogCallback is not supported") |
| 109 | + preconditionFailure("TLSConfiguration.keyLogCallback is not supported. \(useMTELGExplainer)") |
103 | 110 | } |
104 | 111 |
|
105 | 112 | // private key |
106 | 113 | if self.privateKey != nil { |
107 | | - preconditionFailure("TLSConfiguration.privateKey is not supported") |
| 114 | + preconditionFailure("TLSConfiguration.privateKey is not supported. \(useMTELGExplainer)") |
108 | 115 | } |
109 | 116 |
|
110 | 117 | // renegotiation support key is unsupported |
111 | 118 |
|
112 | 119 | // trust roots |
113 | 120 | if let trustRoots = self.trustRoots { |
114 | 121 | guard case .default = trustRoots else { |
115 | | - preconditionFailure("TLSConfiguration.trustRoots != .default is not supported") |
| 122 | + preconditionFailure("TLSConfiguration.trustRoots != .default is not supported. \(useMTELGExplainer)") |
116 | 123 | } |
117 | 124 | } |
118 | 125 |
|
|
127 | 134 | ) |
128 | 135 |
|
129 | 136 | case .noHostnameVerification: |
130 | | - precondition(self.certificateVerification != .noHostnameVerification, "TLSConfiguration.certificateVerification = .noHostnameVerification is not supported") |
| 137 | + precondition(self.certificateVerification != .noHostnameVerification, |
| 138 | + "TLSConfiguration.certificateVerification = .noHostnameVerification is not supported. \(useMTELGExplainer)") |
131 | 139 |
|
132 | 140 | case .fullVerification: |
133 | 141 | break |
|
0 commit comments