mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-22 18:43:43 +08:00
feat: merge to reqwest:0.12.0
remove hyper
This commit is contained in:
parent
6c8c7a0273
commit
8622a5068b
@ -12,14 +12,13 @@ crate-type = ["cdylib", "staticlib"]
|
||||
|
||||
[dependencies]
|
||||
flutter_rust_bridge = "=2.0.0-dev.28"
|
||||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros","process"] }
|
||||
url = "2.5.0"
|
||||
async-std = "1.12.0"
|
||||
hyper = { version = "0.14.28"}
|
||||
once_cell = "1.19.0"
|
||||
reqwest = { version = "0.11", features = ["rustls-tls-webpki-roots", "cookies", "gzip", "json","stream"] }
|
||||
hickory-resolver = {version = "0.24.0"}
|
||||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "process"] }
|
||||
url = "2.5"
|
||||
async-std = "1.12"
|
||||
once_cell = "1.19"
|
||||
reqwest = { version = "0.12", features = ["rustls-tls-webpki-roots", "cookies", "gzip", "json", "stream"] }
|
||||
hickory-resolver = { version = "0.24" }
|
||||
anyhow = "1.0"
|
||||
win32job = "2"
|
||||
lazy_static = "1.4.0"
|
||||
scopeguard = "1.2.0"
|
||||
lazy_static = "1.4"
|
||||
scopeguard = "1.2"
|
||||
|
@ -1,5 +1,5 @@
|
||||
use std::collections::HashMap;
|
||||
use hyper::Method;
|
||||
use reqwest::Method;
|
||||
use crate::http_package;
|
||||
use crate::http_package::RustHttpResponse;
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
use hickory_resolver::config::{NameServerConfigGroup, ResolverConfig, ResolverOpts};
|
||||
use hickory_resolver::{lookup_ip::LookupIpIntoIter, TokioAsyncResolver};
|
||||
use hyper::client::connect::dns::Name;
|
||||
use once_cell::sync::OnceCell;
|
||||
use reqwest::dns::{Addrs, Resolve, Resolving};
|
||||
use reqwest::dns::{Addrs, Name, Resolve, Resolving};
|
||||
use std::collections::HashMap;
|
||||
use std::io;
|
||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||
@ -29,8 +28,8 @@ struct SocketAddrs {
|
||||
impl Resolve for MyHickoryDnsResolver {
|
||||
fn resolve(&self, name: Name) -> Resolving {
|
||||
let my_hosts = MY_HOSTS_MAP.read().unwrap();
|
||||
let name_str = name.to_string();
|
||||
if let Some(ip) = my_hosts.get(name_str.as_str()) {
|
||||
let name_str = name.as_str();
|
||||
if let Some(ip) = my_hosts.get(name_str) {
|
||||
let addrs: Addrs = Box::new(std::iter::once(SocketAddr::new(*ip, 0)));
|
||||
println!("using host map === {:?}", name_str);
|
||||
return Box::pin(async move { Ok(addrs) });
|
||||
@ -89,7 +88,7 @@ fn new_resolver() -> io::Result<TokioAsyncResolver> {
|
||||
IpAddr::V4(Ipv4Addr::new(166, 111, 8, 28)),
|
||||
IpAddr::V4(Ipv4Addr::new(101, 226, 4, 6)),
|
||||
IpAddr::V4(Ipv4Addr::new(114, 114, 114, 114)),
|
||||
], 53, true,
|
||||
], 53, false,
|
||||
);
|
||||
let cfg = ResolverConfig::from_parts(None, vec![], group);
|
||||
let mut opts = ResolverOpts::default();
|
||||
|
@ -2,13 +2,13 @@ pub mod dns;
|
||||
|
||||
use scopeguard::defer;
|
||||
use lazy_static::lazy_static;
|
||||
use hyper::Uri;
|
||||
use reqwest::header::{HeaderMap, HeaderName, HeaderValue};
|
||||
use reqwest::{Method, RequestBuilder};
|
||||
use std::collections::HashMap;
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::time::Duration;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(non_camel_case_types)]
|
||||
@ -88,7 +88,7 @@ pub async fn fetch(
|
||||
if address_clone.is_some() {
|
||||
let addr = std::net::IpAddr::from_str(with_ip_address.unwrap().as_str()).unwrap();
|
||||
let mut hosts = dns::MY_HOSTS_MAP.write().unwrap();
|
||||
let url_host = Uri::from_str(url.as_str()).unwrap().host().unwrap().to_string();
|
||||
let url_host = Url::from_str(url.as_str()).unwrap().host().unwrap().to_string();
|
||||
hosts.insert(url_host, addr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user