Remove un-needed tokio-tungstenite features, prepare for fixing reqwest to use our root certs
This commit is contained in:
parent
fd7920d551
commit
27887c2e82
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -1194,12 +1194,8 @@ checksum = "06cda1232a49558c46f8a504d5b93101d42c0bf7f911f12a105ba48168f821ae"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"log",
|
"log",
|
||||||
"rustls",
|
|
||||||
"rustls-native-certs",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-rustls",
|
|
||||||
"tungstenite",
|
"tungstenite",
|
||||||
"webpki",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1327,12 +1323,10 @@ dependencies = [
|
|||||||
"httparse",
|
"httparse",
|
||||||
"log",
|
"log",
|
||||||
"rand",
|
"rand",
|
||||||
"rustls",
|
|
||||||
"sha-1",
|
"sha-1",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"url",
|
"url",
|
||||||
"utf-8",
|
"utf-8",
|
||||||
"webpki",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -57,9 +57,7 @@ rustls = { version = "0.20.2", optional = true }
|
|||||||
rustls-pemfile = { version = "1.0.0", optional = true }
|
rustls-pemfile = { version = "1.0.0", optional = true }
|
||||||
|
|
||||||
# websocket deps
|
# websocket deps
|
||||||
# todo: fix up the situation with these roots
|
tokio-tungstenite = { version = "0.17", optional = true, default-features = false }
|
||||||
#tokio-tungstenite = { version = "0.17", optional = true, features = ["rustls-tls-webpki-roots"] }
|
|
||||||
tokio-tungstenite = { version = "0.17", optional = true, features = ["rustls-tls-native-roots"] }
|
|
||||||
futures-util = { version = "0.3", default-features = false, features = ["async-await", "sink", "std"], optional = true }
|
futures-util = { version = "0.3", default-features = false, features = ["async-await", "sink", "std"], optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
16
src/srv.rs
16
src/srv.rs
@ -13,6 +13,7 @@ use crate::{
|
|||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
use data_encoding::BASE64;
|
use data_encoding::BASE64;
|
||||||
use log::{debug, error, trace};
|
use log::{debug, error, trace};
|
||||||
|
use reqwest::Client;
|
||||||
use ring::digest::{Algorithm, Context as DigestContext, SHA256, SHA512};
|
use ring::digest::{Algorithm, Context as DigestContext, SHA256, SHA512};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::{
|
use std::{
|
||||||
@ -31,6 +32,7 @@ use trust_dns_resolver::{
|
|||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
static ref RESOLVER: TokioAsyncResolver = make_resolver();
|
static ref RESOLVER: TokioAsyncResolver = make_resolver();
|
||||||
|
static ref HTTPS_CLIENT: Client = make_https_client();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_resolver() -> TokioAsyncResolver {
|
fn make_resolver() -> TokioAsyncResolver {
|
||||||
@ -39,6 +41,15 @@ fn make_resolver() -> TokioAsyncResolver {
|
|||||||
TokioAsyncResolver::tokio(config, options).unwrap()
|
TokioAsyncResolver::tokio(config, options).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn make_https_client() -> Client {
|
||||||
|
// todo: configure our root certs here
|
||||||
|
Client::builder().https_only(true).build().expect("failed to make https client?")
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn https_get<T: reqwest::IntoUrl>(url: T) -> reqwest::Result<reqwest::Response> {
|
||||||
|
HTTPS_CLIENT.get(url).send().await
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
enum XmppConnectionType {
|
enum XmppConnectionType {
|
||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
@ -706,11 +717,6 @@ async fn collect_host_meta_xml(ret: &mut Vec<XmppConnection>, domain: &str, is_c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn https_get<T: reqwest::IntoUrl>(url: T) -> reqwest::Result<reqwest::Response> {
|
|
||||||
// todo: resolve URL with our resolver
|
|
||||||
reqwest::Client::builder().https_only(true).build()?.get(url).send().await
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://datatracker.ietf.org/doc/html/rfc7711
|
// https://datatracker.ietf.org/doc/html/rfc7711
|
||||||
// https://www.iana.org/assignments/posh-service-names/posh-service-names.xhtml
|
// https://www.iana.org/assignments/posh-service-names/posh-service-names.xhtml
|
||||||
async fn collect_posh(domain: &str) -> Result<Posh> {
|
async fn collect_posh(domain: &str) -> Result<Posh> {
|
||||||
|
Loading…
Reference in New Issue
Block a user