mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2025-01-03 12:39:35 +00:00
update: fix macOS Tor's TLS
On apple-darwin targets there is an issue with the native and rustls tls implementation so this makes it fall back to the openssl variant. https://gitlab.torproject.org/tpo/core/arti/-/issues/715
This commit is contained in:
parent
df37784ad7
commit
380620c050
3 changed files with 44 additions and 4 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -2083,6 +2083,7 @@ dependencies = [
|
||||||
"tar",
|
"tar",
|
||||||
"tls-api",
|
"tls-api",
|
||||||
"tls-api-native-tls",
|
"tls-api-native-tls",
|
||||||
|
"tls-api-openssl",
|
||||||
"tokio",
|
"tokio",
|
||||||
"toml 0.7.4",
|
"toml 0.7.4",
|
||||||
"tor-rtcompat",
|
"tor-rtcompat",
|
||||||
|
@ -4548,6 +4549,21 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tls-api-openssl"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "82155f245c99a3b652627f32abeacd4eae9e0fec996c1090df121e01379d28f3"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"openssl",
|
||||||
|
"openssl-sys",
|
||||||
|
"thiserror",
|
||||||
|
"tls-api",
|
||||||
|
"tls-api-test",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tls-api-test"
|
name = "tls-api-test"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
|
|
13
Cargo.toml
13
Cargo.toml
|
@ -66,7 +66,6 @@ serde = { version = "1.0.163", features = ["rc", "derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
sysinfo = { version = "0.29.0", default-features = false }
|
sysinfo = { version = "0.29.0", default-features = false }
|
||||||
tls-api = "0.9.0"
|
tls-api = "0.9.0"
|
||||||
tls-api-native-tls = "0.9.0"
|
|
||||||
tokio = { version = "1.21.2", features = ["rt", "time", "macros", "process"] }
|
tokio = { version = "1.21.2", features = ["rt", "time", "macros", "process"] }
|
||||||
toml = { version = "0.7.4", features = ["preserve_order"] }
|
toml = { version = "0.7.4", features = ["preserve_order"] }
|
||||||
tor-rtcompat = "0.9.0"
|
tor-rtcompat = "0.9.0"
|
||||||
|
@ -82,6 +81,18 @@ sudo = "0.6.0"
|
||||||
## [glow] backend for Unix.
|
## [glow] backend for Unix.
|
||||||
eframe = { version = "0.19.0", default-features = false, features = ["glow"] }
|
eframe = { version = "0.19.0", default-features = false, features = ["glow"] }
|
||||||
|
|
||||||
|
# macOS Tor
|
||||||
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
|
# On apple-darwin targets there is an issue with the native and rustls
|
||||||
|
# tls implementation so this makes it fall back to the openssl variant.
|
||||||
|
#
|
||||||
|
# https://gitlab.torproject.org/tpo/core/arti/-/issues/715
|
||||||
|
tls-api-openssl = "0.9.0"
|
||||||
|
|
||||||
|
# Windows/Linux Tor
|
||||||
|
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
||||||
|
tls-api-native-tls = "0.9.0"
|
||||||
|
|
||||||
# Windows dependencies
|
# Windows dependencies
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
zip = "0.6.6"
|
zip = "0.6.6"
|
||||||
|
|
|
@ -45,10 +45,23 @@ use rand::{thread_rng, Rng};
|
||||||
use serde::{Serialize,Deserialize};
|
use serde::{Serialize,Deserialize};
|
||||||
use std::path::{Path,PathBuf};
|
use std::path::{Path,PathBuf};
|
||||||
use std::sync::{Arc,Mutex};
|
use std::sync::{Arc,Mutex};
|
||||||
use tls_api::{TlsConnector, TlsConnectorBuilder};
|
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
|
// On apple-darwin targets there is an issue with the native and rustls
|
||||||
|
// tls implementation so this makes it fall back to the openssl variant.
|
||||||
|
//
|
||||||
|
// https://gitlab.torproject.org/tpo/core/arti/-/issues/715
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
use tls_api_openssl::TlsConnector;
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
use tls_api_native_tls::TlsConnector;
|
||||||
|
|
||||||
|
use tls_api::{
|
||||||
|
TlsConnector as TlsConnectorTrait,
|
||||||
|
TlsConnectorBuilder,
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
use zip::ZipArchive;
|
use zip::ZipArchive;
|
||||||
//#[cfg(target_family = "unix")]
|
//#[cfg(target_family = "unix")]
|
||||||
|
@ -297,7 +310,7 @@ impl Update {
|
||||||
let tor = TorClient::builder().bootstrap_behavior(arti_client::BootstrapBehavior::OnDemand).create_unbootstrapped()?;
|
let tor = TorClient::builder().bootstrap_behavior(arti_client::BootstrapBehavior::OnDemand).create_unbootstrapped()?;
|
||||||
// This makes sure the Tor circuit is different each time
|
// This makes sure the Tor circuit is different each time
|
||||||
let tor = TorClient::isolated_client(&tor);
|
let tor = TorClient::isolated_client(&tor);
|
||||||
let tls = tls_api_native_tls::TlsConnector::builder()?.build()?;
|
let tls = TlsConnector::builder()?.build()?;
|
||||||
let connector = ArtiHttpConnector::new(tor, tls);
|
let connector = ArtiHttpConnector::new(tor, tls);
|
||||||
let client = ClientEnum::Tor(Client::builder().build(connector));
|
let client = ClientEnum::Tor(Client::builder().build(connector));
|
||||||
Ok(client)
|
Ok(client)
|
||||||
|
@ -764,7 +777,7 @@ impl Update {
|
||||||
|
|
||||||
#[derive(Debug,Clone)]
|
#[derive(Debug,Clone)]
|
||||||
pub enum ClientEnum {
|
pub enum ClientEnum {
|
||||||
Tor(hyper::Client<ArtiHttpConnector<tor_rtcompat::PreferredRuntime, tls_api_native_tls::TlsConnector>>),
|
Tor(hyper::Client<ArtiHttpConnector<tor_rtcompat::PreferredRuntime, TlsConnector>>),
|
||||||
Https(hyper::Client<hyper_tls::HttpsConnector<hyper::client::HttpConnector>>),
|
Https(hyper::Client<hyper_tls::HttpsConnector<hyper::client::HttpConnector>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue