@@ -100,7 +100,7 @@ extern crate log;
100100
101101use std:: fmt:: { self , Debug , Formatter } ;
102102
103- #[ cfg( any( feature = "use-rustls" , feature = "websocket" ) ) ]
103+ #[ cfg( any( feature = "use-rustls-no-provider " , feature = "websocket" ) ) ]
104104use std:: sync:: Arc ;
105105
106106use std:: time:: Duration ;
@@ -112,7 +112,7 @@ pub mod mqttbytes;
112112mod state;
113113pub mod v5;
114114
115- #[ cfg( any( feature = "use-rustls" , feature = "use-native-tls" ) ) ]
115+ #[ cfg( any( feature = "use-rustls-no-provider " , feature = "use-native-tls" ) ) ]
116116mod tls;
117117
118118#[ cfg( feature = "websocket" ) ]
@@ -140,18 +140,18 @@ pub use client::{
140140pub use eventloop:: { ConnectionError , Event , EventLoop } ;
141141pub use mqttbytes:: v4:: * ;
142142pub use mqttbytes:: * ;
143- #[ cfg( feature = "use-rustls" ) ]
143+ #[ cfg( feature = "use-rustls-no-provider " ) ]
144144use rustls_native_certs:: load_native_certs;
145145pub use state:: { MqttState , StateError } ;
146- #[ cfg( any( feature = "use-rustls" , feature = "use-native-tls" ) ) ]
146+ #[ cfg( any( feature = "use-rustls-no-provider " , feature = "use-native-tls" ) ) ]
147147pub use tls:: Error as TlsError ;
148148#[ cfg( feature = "use-native-tls" ) ]
149149pub use tokio_native_tls;
150150#[ cfg( feature = "use-native-tls" ) ]
151151use tokio_native_tls:: native_tls:: TlsConnector ;
152- #[ cfg( feature = "use-rustls" ) ]
152+ #[ cfg( feature = "use-rustls-no-provider " ) ]
153153pub use tokio_rustls;
154- #[ cfg( feature = "use-rustls" ) ]
154+ #[ cfg( feature = "use-rustls-no-provider " ) ]
155155use tokio_rustls:: rustls:: { ClientConfig , RootCertStore } ;
156156
157157#[ cfg( feature = "proxy" ) ]
@@ -226,15 +226,18 @@ impl From<Unsubscribe> for Request {
226226#[ derive( Clone ) ]
227227pub enum Transport {
228228 Tcp ,
229- #[ cfg( any( feature = "use-rustls" , feature = "use-native-tls" ) ) ]
229+ #[ cfg( any( feature = "use-rustls-no-provider " , feature = "use-native-tls" ) ) ]
230230 Tls ( TlsConfiguration ) ,
231231 #[ cfg( unix) ]
232232 Unix ,
233233 #[ cfg( feature = "websocket" ) ]
234234 #[ cfg_attr( docsrs, doc( cfg( feature = "websocket" ) ) ) ]
235235 Ws ,
236- #[ cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ]
237- #[ cfg_attr( docsrs, doc( cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ) ) ]
236+ #[ cfg( all( feature = "use-rustls-no-provider" , feature = "websocket" ) ) ]
237+ #[ cfg_attr(
238+ docsrs,
239+ doc( cfg( all( feature = "use-rustls-no-provider" , feature = "websocket" ) ) )
240+ ) ]
238241 Wss ( TlsConfiguration ) ,
239242}
240243
@@ -250,13 +253,13 @@ impl Transport {
250253 Self :: Tcp
251254 }
252255
253- #[ cfg( feature = "use-rustls" ) ]
256+ #[ cfg( feature = "use-rustls-no-provider " ) ]
254257 pub fn tls_with_default_config ( ) -> Self {
255258 Self :: tls_with_config ( Default :: default ( ) )
256259 }
257260
258261 /// Use secure tcp with tls as transport
259- #[ cfg( feature = "use-rustls" ) ]
262+ #[ cfg( feature = "use-rustls-no-provider " ) ]
260263 pub fn tls (
261264 ca : Vec < u8 > ,
262265 client_auth : Option < ( Vec < u8 > , Vec < u8 > ) > ,
@@ -271,7 +274,7 @@ impl Transport {
271274 Self :: tls_with_config ( config)
272275 }
273276
274- #[ cfg( any( feature = "use-rustls" , feature = "use-native-tls" ) ) ]
277+ #[ cfg( any( feature = "use-rustls-no-provider " , feature = "use-native-tls" ) ) ]
275278 pub fn tls_with_config ( tls_config : TlsConfiguration ) -> Self {
276279 Self :: Tls ( tls_config)
277280 }
@@ -289,8 +292,11 @@ impl Transport {
289292 }
290293
291294 /// Use secure websockets with tls as transport
292- #[ cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ]
293- #[ cfg_attr( docsrs, doc( cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ) ) ]
295+ #[ cfg( all( feature = "use-rustls-no-provider" , feature = "websocket" ) ) ]
296+ #[ cfg_attr(
297+ docsrs,
298+ doc( cfg( all( feature = "use-rustls-no-provider" , feature = "websocket" ) ) )
299+ ) ]
294300 pub fn wss (
295301 ca : Vec < u8 > ,
296302 client_auth : Option < ( Vec < u8 > , Vec < u8 > ) > ,
@@ -305,24 +311,30 @@ impl Transport {
305311 Self :: wss_with_config ( config)
306312 }
307313
308- #[ cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ]
309- #[ cfg_attr( docsrs, doc( cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ) ) ]
314+ #[ cfg( all( feature = "use-rustls-no-provider" , feature = "websocket" ) ) ]
315+ #[ cfg_attr(
316+ docsrs,
317+ doc( cfg( all( feature = "use-rustls-no-provider" , feature = "websocket" ) ) )
318+ ) ]
310319 pub fn wss_with_config ( tls_config : TlsConfiguration ) -> Self {
311320 Self :: Wss ( tls_config)
312321 }
313322
314- #[ cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ]
315- #[ cfg_attr( docsrs, doc( cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ) ) ]
323+ #[ cfg( all( feature = "use-rustls-no-provider" , feature = "websocket" ) ) ]
324+ #[ cfg_attr(
325+ docsrs,
326+ doc( cfg( all( feature = "use-rustls-no-provider" , feature = "websocket" ) ) )
327+ ) ]
316328 pub fn wss_with_default_config ( ) -> Self {
317329 Self :: Wss ( Default :: default ( ) )
318330 }
319331}
320332
321333/// TLS configuration method
322334#[ derive( Clone , Debug ) ]
323- #[ cfg( any( feature = "use-rustls" , feature = "use-native-tls" ) ) ]
335+ #[ cfg( any( feature = "use-rustls-no-provider " , feature = "use-native-tls" ) ) ]
324336pub enum TlsConfiguration {
325- #[ cfg( feature = "use-rustls" ) ]
337+ #[ cfg( feature = "use-rustls-no-provider " ) ]
326338 Simple {
327339 /// ca certificate
328340 ca : Vec < u8 > ,
@@ -339,7 +351,7 @@ pub enum TlsConfiguration {
339351 /// password for use with der
340352 client_auth : Option < ( Vec < u8 > , String ) > ,
341353 } ,
342- #[ cfg( feature = "use-rustls" ) ]
354+ #[ cfg( feature = "use-rustls-no-provider " ) ]
343355 /// Injected rustls ClientConfig for TLS, to allow more customisation.
344356 Rustls ( Arc < ClientConfig > ) ,
345357 #[ cfg( feature = "use-native-tls" ) ]
@@ -350,7 +362,7 @@ pub enum TlsConfiguration {
350362 NativeConnector ( TlsConnector ) ,
351363}
352364
353- #[ cfg( feature = "use-rustls" ) ]
365+ #[ cfg( feature = "use-rustls-no-provider " ) ]
354366impl Default for TlsConfiguration {
355367 fn default ( ) -> Self {
356368 let mut root_cert_store = RootCertStore :: empty ( ) ;
@@ -365,7 +377,7 @@ impl Default for TlsConfiguration {
365377 }
366378}
367379
368- #[ cfg( feature = "use-rustls" ) ]
380+ #[ cfg( feature = "use-rustls-no-provider " ) ]
369381impl From < ClientConfig > for TlsConfiguration {
370382 fn from ( config : ClientConfig ) -> Self {
371383 TlsConfiguration :: Rustls ( Arc :: new ( config) )
@@ -788,12 +800,12 @@ impl std::convert::TryFrom<url::Url> for MqttOptions {
788800 // Encrypted connections are supported, but require explicit TLS configuration. We fall
789801 // back to the unencrypted transport layer, so that `set_transport` can be used to
790802 // configure the encrypted transport layer with the provided TLS configuration.
791- #[ cfg( feature = "use-rustls" ) ]
803+ #[ cfg( feature = "use-rustls-no-provider " ) ]
792804 "mqtts" | "ssl" => ( Transport :: tls_with_default_config ( ) , 8883 ) ,
793805 "mqtt" | "tcp" => ( Transport :: Tcp , 1883 ) ,
794806 #[ cfg( feature = "websocket" ) ]
795807 "ws" => ( Transport :: Ws , 8000 ) ,
796- #[ cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ]
808+ #[ cfg( all( feature = "use-rustls-no-provider " , feature = "websocket" ) ) ]
797809 "wss" => ( Transport :: wss_with_default_config ( ) , 8000 ) ,
798810 _ => return Err ( OptionError :: Scheme ) ,
799811 } ;
@@ -927,7 +939,7 @@ mod test {
927939 use super :: * ;
928940
929941 #[ test]
930- #[ cfg( all( feature = "use-rustls" , feature = "websocket" ) ) ]
942+ #[ cfg( all( feature = "use-rustls-no-provider " , feature = "websocket" ) ) ]
931943 fn no_scheme ( ) {
932944 let mut mqttoptions = MqttOptions :: new ( "client_a" , "a3f8czas.iot.eu-west-1.amazonaws.com/mqtt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=MyCreds%2F20201001%2Feu-west-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20201001T130812Z&X-Amz-Expires=7200&X-Amz-Signature=9ae09b49896f44270f2707551581953e6cac71a4ccf34c7c3415555be751b2d1&X-Amz-SignedHeaders=host" , 443 ) ;
933945
0 commit comments