1#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg))]
2#![doc = include_str!("../README.md")]
3#![allow(renamed_and_removed_lints)] #![allow(unknown_lints)] #![warn(missing_docs)]
7#![warn(noop_method_call)]
8#![warn(unreachable_pub)]
9#![warn(clippy::all)]
10#![deny(clippy::await_holding_lock)]
11#![deny(clippy::cargo_common_metadata)]
12#![deny(clippy::cast_lossless)]
13#![deny(clippy::checked_conversions)]
14#![warn(clippy::cognitive_complexity)]
15#![deny(clippy::debug_assert_with_mut_call)]
16#![deny(clippy::exhaustive_enums)]
17#![deny(clippy::exhaustive_structs)]
18#![deny(clippy::expl_impl_clone_on_copy)]
19#![deny(clippy::fallible_impl_from)]
20#![deny(clippy::implicit_clone)]
21#![deny(clippy::large_stack_arrays)]
22#![warn(clippy::manual_ok_or)]
23#![deny(clippy::missing_docs_in_private_items)]
24#![warn(clippy::needless_borrow)]
25#![warn(clippy::needless_pass_by_value)]
26#![warn(clippy::option_option)]
27#![deny(clippy::print_stderr)]
28#![deny(clippy::print_stdout)]
29#![warn(clippy::rc_buffer)]
30#![deny(clippy::ref_option_ref)]
31#![warn(clippy::semicolon_if_nothing_returned)]
32#![warn(clippy::trait_duplication_in_bounds)]
33#![deny(clippy::unchecked_duration_subtraction)]
34#![deny(clippy::unnecessary_wraps)]
35#![warn(clippy::unseparated_literal_suffix)]
36#![deny(clippy::unwrap_used)]
37#![deny(clippy::mod_module_files)]
38#![allow(clippy::let_unit_value)] #![allow(clippy::uninlined_format_args)]
40#![allow(clippy::significant_drop_in_scrutinee)] #![allow(clippy::result_large_err)] #![allow(clippy::needless_raw_string_hashes)] #![allow(clippy::needless_lifetimes)] use std::sync::{Arc, Mutex};
47
48use arti_client::{IntoTorAddr, TorClient};
49use ureq::{
50 http::{uri::Scheme, Uri},
51 tls::TlsProvider as UreqTlsProvider,
52 unversioned::{
53 resolver::{ArrayVec, ResolvedSocketAddrs, Resolver as UreqResolver},
54 transport::{Buffers, Connector as UreqConnector, LazyBuffers, NextTimeout, Transport},
55 },
56};
57
58use educe::Educe;
59use thiserror::Error;
60use tor_proto::stream::{DataReader, DataWriter};
61use tor_rtcompat::{Runtime, ToplevelBlockOn};
62
63#[cfg(feature = "rustls")]
64use ureq::unversioned::transport::RustlsConnector;
65
66#[cfg(feature = "native-tls")]
67use ureq::unversioned::transport::NativeTlsConnector;
68
69use futures::io::{AsyncReadExt, AsyncWriteExt};
70
71pub use arti_client;
73
74pub use tor_rtcompat;
76
77pub use ureq;
79
80pub fn default_agent() -> Result<ureq::Agent, Error> {
97 Ok(Connector::new()?.agent())
98}
99
100#[derive(Educe)]
161#[educe(Debug)]
162pub struct Connector<R: Runtime> {
163 #[educe(Debug(ignore))]
165 client: TorClient<R>,
166
167 tls_provider: UreqTlsProvider,
169}
170
171pub struct ConnectorBuilder<R: Runtime> {
189 client: Option<TorClient<R>>,
191
192 runtime: R,
200
201 tls_provider: Option<UreqTlsProvider>,
203}
204
205#[derive(Educe)]
208#[educe(Debug)]
209struct HttpTransport<R: Runtime> {
210 r: Arc<Mutex<DataReader>>,
213
214 w: Arc<Mutex<DataWriter>>, #[educe(Debug(ignore))]
219 buffer: LazyBuffers,
220
221 rt: R,
223}
224
225#[derive(Educe)]
249#[educe(Debug)]
250pub struct Resolver<R: Runtime> {
251 #[educe(Debug(ignore))]
255 client: TorClient<R>,
256}
257
258#[derive(Error, Debug)]
260#[non_exhaustive]
261pub enum Error {
262 #[error("unsupported URI scheme in {uri:?}")]
264 UnsupportedUriScheme {
265 uri: Uri,
267 },
268
269 #[error("Missing hostname in {uri:?}")]
271 MissingHostname {
272 uri: Uri,
274 },
275
276 #[error("Tor connection failed")]
278 Arti(#[from] arti_client::Error),
279
280 #[error("General I/O error")]
282 Io(#[from] std::io::Error),
283
284 #[error("TLS provider in config does not match the one in Connector.")]
286 TlsConfigMismatch,
287}
288
289impl tor_error::HasKind for Error {
291 #[rustfmt::skip]
292 fn kind(&self) -> tor_error::ErrorKind {
293 use tor_error::ErrorKind as EK;
294 match self {
295 Error::UnsupportedUriScheme{..} => EK::NotImplemented,
296 Error::MissingHostname{..} => EK::BadApiUsage,
297 Error::Arti(e) => e.kind(),
298 Error::Io(..) => EK::Other,
299 Error::TlsConfigMismatch => EK::BadApiUsage,
300 }
301 }
302}
303
304impl std::convert::From<Error> for ureq::Error {
306 fn from(err: Error) -> Self {
307 match err {
308 Error::MissingHostname { uri } => {
309 ureq::Error::BadUri(format!("Missing hostname in {uri:?}"))
310 }
311 Error::UnsupportedUriScheme { uri } => {
312 ureq::Error::BadUri(format!("Unsupported URI scheme in {uri:?}"))
313 }
314 Error::Arti(e) => ureq::Error::Io(std::io::Error::other(e)), Error::Io(e) => ureq::Error::Io(e),
316 Error::TlsConfigMismatch => {
317 ureq::Error::Tls("TLS provider in config does not match the one in Connector.")
318 }
319 }
320 }
321}
322
323impl<R: Runtime + ToplevelBlockOn> Transport for HttpTransport<R> {
333 fn buffers(&mut self) -> &mut dyn Buffers {
335 &mut self.buffer
336 }
337
338 fn transmit_output(&mut self, amount: usize, _timeout: NextTimeout) -> Result<(), ureq::Error> {
340 let mut writer = self.w.lock().expect("lock poisoned");
341
342 let buffer = self.buffer.output();
343 let data_to_write = &buffer[..amount];
344
345 self.rt.block_on(async {
346 writer.write_all(data_to_write).await?;
347 writer.flush().await?;
348 Ok(())
349 })
350 }
351
352 fn await_input(&mut self, _timeout: NextTimeout) -> Result<bool, ureq::Error> {
354 let mut reader = self.r.lock().expect("lock poisoned");
355
356 let buffers = self.buffer.input_append_buf();
357 let size = self.rt.block_on(reader.read(buffers))?;
358 self.buffer.input_appended(size);
359
360 Ok(size > 0)
361 }
362
363 fn is_open(&mut self) -> bool {
365 self.r.lock().is_ok_and(|guard| {
369 guard
370 .client_stream_ctrl()
371 .is_some_and(|ctrl| ctrl.is_connected())
372 })
373 }
374}
375
376impl<R: Runtime> ConnectorBuilder<R> {
377 pub fn new() -> Result<ConnectorBuilder<tor_rtcompat::PreferredRuntime>, Error> {
379 Ok(ConnectorBuilder {
380 client: None,
381 runtime: tor_rtcompat::PreferredRuntime::create()?,
382 tls_provider: None,
383 })
384 }
385
386 pub fn build(self) -> Result<Connector<R>, Error> {
388 let client = match self.client {
389 Some(client) => client,
390 None => TorClient::with_runtime(self.runtime).create_unbootstrapped()?,
391 };
392
393 let tls_provider = self.tls_provider.unwrap_or(get_default_tls_provider());
394
395 Ok(Connector {
396 client,
397 tls_provider,
398 })
399 }
400
401 pub fn with_runtime(runtime: R) -> Result<ConnectorBuilder<R>, Error> {
405 Ok(ConnectorBuilder {
406 client: None,
407 runtime,
408 tls_provider: None,
409 })
410 }
411
412 pub fn tor_client(mut self, client: TorClient<R>) -> ConnectorBuilder<R> {
419 self.runtime = client.runtime().clone();
420 self.client = Some(client);
421 self
422 }
423
424 pub fn tls_provider(mut self, tls_provider: UreqTlsProvider) -> Self {
426 self.tls_provider = Some(tls_provider);
427 self
428 }
429}
430
431impl<R: Runtime + ToplevelBlockOn> UreqResolver for Resolver<R> {
439 fn resolve(
441 &self,
442 uri: &Uri,
443 _config: &ureq::config::Config,
444 _timeout: NextTimeout,
445 ) -> Result<ResolvedSocketAddrs, ureq::Error> {
446 let (host, port) = uri_to_host_port(uri)?;
449 let ips = self
450 .client
451 .runtime()
452 .block_on(async { self.client.resolve(&host).await })
453 .map_err(Error::from)?;
454
455 let mut array_vec: ArrayVec<core::net::SocketAddr, 16> = ArrayVec::from_fn(|_| {
456 core::net::SocketAddr::new(core::net::IpAddr::V4(core::net::Ipv4Addr::UNSPECIFIED), 0)
457 });
458
459 for ip in ips {
460 let socket_addr = core::net::SocketAddr::new(ip, port);
461 array_vec.push(socket_addr);
462 }
463
464 Ok(array_vec)
465 }
466}
467
468impl<R: Runtime + ToplevelBlockOn> Connector<R> {
469 pub fn with_tor_client(client: TorClient<R>) -> Connector<R> {
471 Connector {
472 client,
473 tls_provider: get_default_tls_provider(),
474 }
475 }
476}
477
478impl<R: Runtime + ToplevelBlockOn> UreqConnector<()> for Connector<R> {
479 type Out = Box<dyn Transport>;
480
481 fn connect(
485 &self,
486 details: &ureq::unversioned::transport::ConnectionDetails,
487 _chained: Option<()>,
488 ) -> Result<Option<Self::Out>, ureq::Error> {
489 let (host, port) = uri_to_host_port(details.uri)?;
491
492 let addr = (host.as_str(), port)
494 .into_tor_addr()
495 .map_err(|e| Error::Arti(e.into()))?;
496
497 let stream = self
499 .client
500 .runtime()
501 .block_on(async { self.client.connect(addr).await })
502 .map_err(Error::from)?;
503
504 let (r, w) = stream.split();
506 Ok(Some(Box::new(HttpTransport {
507 r: Arc::new(Mutex::new(r)),
508 w: Arc::new(Mutex::new(w)),
509 buffer: LazyBuffers::new(2048, 2048),
510 rt: self.client.runtime().clone(),
511 })))
512 }
513}
514
515impl Connector<tor_rtcompat::PreferredRuntime> {
516 pub fn new() -> Result<Self, Error> {
524 Self::builder()?.build()
525 }
526}
527
528impl<R: Runtime + ToplevelBlockOn> Connector<R> {
529 pub fn resolver(&self) -> Resolver<R> {
531 Resolver {
532 client: self.client.clone(),
533 }
534 }
535
536 pub fn agent(self) -> ureq::Agent {
555 let resolver = self.resolver();
556
557 let ureq_config = ureq::config::Config::builder()
558 .tls_config(
559 ureq::tls::TlsConfig::builder()
560 .provider(self.tls_provider)
561 .build(),
562 )
563 .build();
564
565 ureq::Agent::with_parts(ureq_config, self.connector_chain(), resolver)
566 }
567
568 pub fn agent_with_ureq_config(
572 self,
573 config: ureq::config::Config,
574 ) -> Result<ureq::Agent, Error> {
575 let resolver = self.resolver();
576
577 if self.tls_provider != config.tls_config().provider() {
578 return Err(Error::TlsConfigMismatch);
579 }
580
581 Ok(ureq::Agent::with_parts(
582 config,
583 self.connector_chain(),
584 resolver,
585 ))
586 }
587
588 fn connector_chain(self) -> impl UreqConnector {
590 let chain = self;
591
592 #[cfg(feature = "rustls")]
593 let chain = chain.chain(RustlsConnector::default());
594
595 #[cfg(feature = "native-tls")]
596 let chain = chain.chain(NativeTlsConnector::default());
597
598 chain
599 }
600}
601
602pub fn get_default_tls_provider() -> UreqTlsProvider {
604 if cfg!(feature = "native-tls") {
605 UreqTlsProvider::NativeTls
606 } else {
607 UreqTlsProvider::Rustls
608 }
609}
610
611impl<R: Runtime> Connector<R> {
631 pub fn builder() -> Result<ConnectorBuilder<tor_rtcompat::PreferredRuntime>, Error> {
633 ConnectorBuilder::<R>::new()
634 }
635}
636
637fn uri_to_host_port(uri: &Uri) -> Result<(String, u16), Error> {
641 let host = uri
642 .host()
643 .ok_or_else(|| Error::MissingHostname { uri: uri.clone() })?;
644
645 let port = match uri.scheme() {
646 Some(scheme) if scheme == &Scheme::HTTPS => Ok(443),
647 Some(scheme) if scheme == &Scheme::HTTP => Ok(80),
648 Some(_) => Err(Error::UnsupportedUriScheme { uri: uri.clone() }),
649 None => Err(Error::UnsupportedUriScheme { uri: uri.clone() }),
650 }?;
651
652 Ok((host.to_owned(), port))
653}
654
655#[cfg(test)]
656mod arti_ureq_test {
657 #![allow(clippy::bool_assert_comparison)]
659 #![allow(clippy::clone_on_copy)]
660 #![allow(clippy::dbg_macro)]
661 #![allow(clippy::mixed_attributes_style)]
662 #![allow(clippy::print_stderr)]
663 #![allow(clippy::print_stdout)]
664 #![allow(clippy::single_char_pattern)]
665 #![allow(clippy::unwrap_used)]
666 #![allow(clippy::unchecked_duration_subtraction)]
667 #![allow(clippy::useless_vec)]
668 #![allow(clippy::needless_pass_by_value)]
669 use super::*;
672 use arti_client::config::TorClientConfigBuilder;
673 use std::str::FromStr;
674 use test_temp_dir::test_temp_dir;
675
676 const ARTI_TEST_LIVE_NETWORK: &str = "ARTI_TEST_LIVE_NETWORK";
677 const ARTI_TESTING_ON_LOCAL: &str = "ARTI_TESTING_ON_LOCAL";
678
679 fn assert_equal_types<T>(_: &T, _: &T) {}
682
683 fn test_live_network() -> bool {
686 let run_test = std::env::var(ARTI_TEST_LIVE_NETWORK).is_ok_and(|v| v == "1");
687 if !run_test {
688 println!("Skipping test, set {}=1 to run.", ARTI_TEST_LIVE_NETWORK);
689 }
690
691 run_test
692 }
693
694 fn testing_on_local() -> bool {
698 let run_test = std::env::var(ARTI_TESTING_ON_LOCAL).is_ok_and(|v| v == "1");
699 if !run_test {
700 println!("Skipping test, set {}=1 to run.", ARTI_TESTING_ON_LOCAL);
701 }
702
703 run_test
704 }
705
706 fn test_with_tor_client<R: Runtime>(rt: R, f: impl FnOnce(TorClient<R>)) {
708 let temp_dir = test_temp_dir!();
709 temp_dir.used_by(move |temp_dir| {
710 let arti_config = TorClientConfigBuilder::from_directories(
711 temp_dir.join("state"),
712 temp_dir.join("cache"),
713 )
714 .build()
715 .expect("Failed to build TorClientConfig");
716
717 let tor_client = arti_client::TorClient::with_runtime(rt)
718 .config(arti_config)
719 .create_unbootstrapped()
720 .expect("Error creating Tor Client.");
721
722 f(tor_client);
723 });
724 }
725
726 fn request_is_tor(agent: ureq::Agent, https: bool) -> bool {
729 let mut request = agent
730 .get(format!(
731 "http{}://check.torproject.org/api/ip",
732 if https { "s" } else { "" }
733 ))
734 .call()
735 .expect("Failed to make request.");
736 let response = request
737 .body_mut()
738 .read_to_string()
739 .expect("Failed to read body.");
740 let json_response: serde_json::Value =
741 serde_json::from_str(&response).expect("Failed to parse JSON.");
742 let is_tor = json_response
743 .get("IsTor")
744 .expect("Failed to retrieve IsTor property from response")
745 .as_bool()
746 .expect("Failed to convert IsTor to bool");
747
748 is_tor
749 }
750
751 #[test]
754 fn test_equal_types() {
755 assert_equal_types(&1, &i32::MIN);
756 assert_equal_types(&1, &i64::MIN);
757 assert_equal_types(&String::from("foo"), &String::with_capacity(1));
758 }
759
760 #[test]
763 #[cfg(all(feature = "rustls", not(feature = "native-tls")))]
764 fn articonnector_new_returns_default() {
765 if !testing_on_local() {
766 return;
767 }
768
769 let actual_connector = Connector::new().expect("Failed to create Connector.");
770 let expected_connector = Connector {
771 client: TorClient::with_runtime(
772 tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime."),
773 )
774 .create_unbootstrapped()
775 .expect("Error creating Tor Client."),
776 tls_provider: UreqTlsProvider::Rustls,
777 };
778
779 assert_equal_types(&expected_connector, &actual_connector);
780 assert_equal_types(
781 &actual_connector.client.runtime().clone(),
782 &tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime."),
783 );
784 assert_eq!(
785 &actual_connector.tls_provider,
786 &ureq::tls::TlsProvider::Rustls,
787 );
788 }
789
790 #[test]
793 #[cfg(all(feature = "rustls", not(feature = "native-tls")))]
794 fn articonnector_with_tor_client() {
795 if !testing_on_local() {
796 return;
797 }
798
799 let tor_client = TorClient::with_runtime(
800 tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime."),
801 )
802 .create_unbootstrapped()
803 .expect("Error creating Tor Client.");
804
805 let actual_connector = Connector::with_tor_client(tor_client);
806 let expected_connector = Connector {
807 client: TorClient::with_runtime(
808 tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime."),
809 )
810 .create_unbootstrapped()
811 .expect("Error creating Tor Client."),
812 tls_provider: UreqTlsProvider::Rustls,
813 };
814
815 assert_equal_types(&expected_connector, &actual_connector);
816 assert_equal_types(
817 &actual_connector.client.runtime().clone(),
818 &tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime."),
819 );
820 assert_eq!(
821 &actual_connector.tls_provider,
822 &ureq::tls::TlsProvider::Rustls,
823 );
824 }
825
826 #[test]
829 fn articonnectorbuilder_new_returns_default() {
830 if !testing_on_local() {
831 return;
832 }
833
834 let expected = Connector::new().expect("Failed to create Connector.");
835 let actual = Connector::<tor_rtcompat::PreferredRuntime>::builder()
836 .expect("Failed to create ConnectorBuilder.")
837 .build()
838 .expect("Failed to create Connector.");
839
840 assert_equal_types(&expected, &actual);
841 assert_equal_types(&expected.client.runtime(), &actual.client.runtime());
842 assert_eq!(&expected.tls_provider, &actual.tls_provider);
843 }
844
845 #[cfg(all(feature = "tokio", feature = "rustls"))]
848 #[test]
849 fn articonnectorbuilder_with_runtime() {
850 if !testing_on_local() {
851 return;
852 }
853
854 let arti_connector = ConnectorBuilder::with_runtime(
855 tor_rtcompat::tokio::TokioRustlsRuntime::create().expect("Failed to create runtime."),
856 )
857 .expect("Failed to create ConnectorBuilder.")
858 .build()
859 .expect("Failed to create Connector.");
860
861 assert_equal_types(
862 &arti_connector.client.runtime().clone(),
863 &tor_rtcompat::tokio::TokioRustlsRuntime::create().expect("Failed to create runtime."),
864 );
865
866 let arti_connector = ConnectorBuilder::with_runtime(
867 tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime."),
868 )
869 .expect("Failed to create ConnectorBuilder.")
870 .build()
871 .expect("Failed to create Connector.");
872
873 assert_equal_types(
874 &arti_connector.client.runtime().clone(),
875 &tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime."),
876 );
877 }
878
879 #[cfg(all(feature = "tokio", feature = "rustls"))]
881 #[test]
882 fn articonnectorbuilder_set_tor_client() {
883 let rt =
884 tor_rtcompat::tokio::TokioRustlsRuntime::create().expect("Failed to create runtime.");
885
886 test_with_tor_client(rt.clone(), move |tor_client| {
887 let arti_connector = ConnectorBuilder::with_runtime(rt)
888 .expect("Failed to create ConnectorBuilder.")
889 .tor_client(tor_client.clone().isolated_client())
890 .build()
891 .expect("Failed to create Connector.");
892
893 assert_equal_types(
894 &arti_connector.client.runtime().clone(),
895 &tor_rtcompat::tokio::TokioRustlsRuntime::create()
896 .expect("Failed to create runtime."),
897 );
898 });
899 }
900
901 #[test]
903 fn test_uri_to_host_port() {
904 let uri = Uri::from_str("http://torproject.org").expect("Error parsing uri.");
905 let (host, port) = uri_to_host_port(&uri).expect("Error parsing uri.");
906
907 assert_eq!(host, "torproject.org");
908 assert_eq!(port, 80);
909
910 let uri = Uri::from_str("https://torproject.org").expect("Error parsing uri.");
911 let (host, port) = uri_to_host_port(&uri).expect("Error parsing uri.");
912
913 assert_eq!(host, "torproject.org");
914 assert_eq!(port, 443);
915
916 let uri = Uri::from_str("https://www.torproject.org/test").expect("Error parsing uri.");
917 let (host, port) = uri_to_host_port(&uri).expect("Error parsing uri.");
918
919 assert_eq!(host, "www.torproject.org");
920 assert_eq!(port, 443);
921 }
922
923 #[test]
926 fn request_goes_over_tor() {
927 if !test_live_network() {
928 return;
929 }
930
931 let is_tor = request_is_tor(
932 default_agent().expect("Failed to retrieve default agent."),
933 true,
934 );
935
936 assert_eq!(is_tor, true);
937 }
938
939 #[test]
944 #[cfg(all(feature = "rustls", not(feature = "native-tls")))]
945 fn request_goes_over_tor_with_unsafe_check() {
946 if !test_live_network() {
947 return;
948 }
949
950 let is_tor = request_is_tor(ureq::Agent::new_with_defaults(), true);
951 assert_eq!(is_tor, false);
952
953 let is_tor = request_is_tor(
954 default_agent().expect("Failed to retrieve default agent."),
955 true,
956 );
957 assert_eq!(is_tor, true);
958 }
959
960 #[test]
963 fn request_with_bare_http() {
964 if !test_live_network() {
965 return;
966 }
967
968 let rt = tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime.");
969
970 test_with_tor_client(rt, |tor_client| {
971 let arti_connector = Connector::with_tor_client(tor_client);
972 let is_tor = request_is_tor(arti_connector.agent(), false);
973
974 assert_eq!(is_tor, true);
975 });
976 }
977
978 #[test]
980 fn test_get_default_tls_provider() {
981 #[cfg(feature = "native-tls")]
982 assert_eq!(get_default_tls_provider(), UreqTlsProvider::NativeTls);
983
984 #[cfg(not(feature = "native-tls"))]
985 assert_eq!(get_default_tls_provider(), UreqTlsProvider::Rustls);
986 }
987
988 #[test]
992 fn test_tor_client_with_get_default_tls_provider() {
993 if !testing_on_local() {
994 return;
995 }
996
997 let tor_client = TorClient::with_runtime(
998 tor_rtcompat::PreferredRuntime::create().expect("Failed to create runtime."),
999 )
1000 .create_unbootstrapped()
1001 .expect("Error creating Tor Client.");
1002
1003 let arti_connector = Connector::<tor_rtcompat::PreferredRuntime>::builder()
1004 .expect("Failed to create ConnectorBuilder.")
1005 .tor_client(tor_client.clone().isolated_client())
1006 .tls_provider(get_default_tls_provider())
1007 .build()
1008 .expect("Failed to create Connector.");
1009
1010 #[cfg(feature = "native-tls")]
1011 assert_eq!(
1012 &arti_connector.tls_provider,
1013 &ureq::tls::TlsProvider::NativeTls,
1014 );
1015
1016 #[cfg(not(feature = "native-tls"))]
1017 assert_eq!(
1018 &arti_connector.tls_provider,
1019 &ureq::tls::TlsProvider::Rustls,
1020 );
1021 }
1022}