mirror of
https://gitlab.com/veloren/veloren
synced 2026-08-16 16:26:07 -04:00
update hickary dns ti solve cargo audit
This commit is contained in:
parent
0ba9fd01e7
commit
8ff47e218c
3 changed files with 97 additions and 33 deletions
93
Cargo.lock
generated
93
Cargo.lock
generated
|
|
@ -2274,18 +2274,6 @@ version = "0.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
|
||||
|
||||
[[package]]
|
||||
name = "enum-as-inner"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2 1.0.106",
|
||||
"quote 1.0.45",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enum-map"
|
||||
version = "2.7.3"
|
||||
|
|
@ -3265,23 +3253,22 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "hickory-proto"
|
||||
version = "0.25.2"
|
||||
name = "hickory-net"
|
||||
version = "0.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502"
|
||||
checksum = "e2295ed2f9c31e471e1428a8f88a3f0e1f4b27c15049592138d1eebe9c35b183"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"cfg-if 1.0.4",
|
||||
"data-encoding",
|
||||
"enum-as-inner",
|
||||
"futures-channel",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"hickory-proto",
|
||||
"idna",
|
||||
"ipnet",
|
||||
"once_cell",
|
||||
"rand 0.9.4",
|
||||
"ring",
|
||||
"jni 0.22.4",
|
||||
"rand 0.10.1",
|
||||
"thiserror 2.0.18",
|
||||
"tinyvec",
|
||||
"tokio",
|
||||
|
|
@ -3290,21 +3277,46 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "hickory-resolver"
|
||||
version = "0.25.2"
|
||||
name = "hickory-proto"
|
||||
version = "0.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a"
|
||||
checksum = "0bab31817bfb44672a252e97fe81cd0c18d1b2cf892108922f6818820df8c643"
|
||||
dependencies = [
|
||||
"data-encoding",
|
||||
"idna",
|
||||
"ipnet",
|
||||
"jni 0.22.4",
|
||||
"once_cell",
|
||||
"prefix-trie",
|
||||
"rand 0.10.1",
|
||||
"ring",
|
||||
"thiserror 2.0.18",
|
||||
"tinyvec",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hickory-resolver"
|
||||
version = "0.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0d58d28879ceecde6607729660c2667a081ccdc082e082675042793960f178c"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.4",
|
||||
"futures-util",
|
||||
"hickory-net",
|
||||
"hickory-proto",
|
||||
"ipconfig",
|
||||
"ipnet",
|
||||
"jni 0.22.4",
|
||||
"moka",
|
||||
"ndk-context",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"rand 0.9.4",
|
||||
"rand 0.10.1",
|
||||
"resolv-conf",
|
||||
"smallvec",
|
||||
"system-configuration",
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
"tracing",
|
||||
|
|
@ -3775,6 +3787,9 @@ name = "ipnet"
|
|||
version = "2.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-docker"
|
||||
|
|
@ -5813,6 +5828,17 @@ dependencies = [
|
|||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prefix-trie"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cf6e3177f0684016a5c209b00882e15f8bdd3f3bb48f0491df10cd102d0c6e7"
|
||||
dependencies = [
|
||||
"either",
|
||||
"ipnet",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "presser"
|
||||
version = "0.3.1"
|
||||
|
|
@ -7695,6 +7721,27 @@ dependencies = [
|
|||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
|
||||
dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"core-foundation 0.9.4",
|
||||
"system-configuration-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration-sys"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tagptr"
|
||||
version = "0.2.0"
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ byteorder = "1.3.2"
|
|||
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
||||
quinn = { workspace = true, features = ["rustls"] }
|
||||
rustls = { workspace = true }
|
||||
hickory-resolver = { version = "0.25.2", features = [
|
||||
hickory-resolver = { version = "0.26.1", features = [
|
||||
"system-config",
|
||||
"tokio",
|
||||
] }
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ use common_state::plugin::PluginMgr;
|
|||
use common_systems::add_local_systems;
|
||||
use comp::BuffKind;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use hickory_resolver::{Resolver, config::ResolverConfig, name_server::TokioConnectionProvider};
|
||||
use hickory_resolver::{
|
||||
Resolver, config::ResolverConfig, net::runtime::TokioRuntimeProvider, proto::rr::RData,
|
||||
};
|
||||
use image::DynamicImage;
|
||||
use network::{ConnectAddr, Network, Participant, Pid, Stream};
|
||||
use num::traits::FloatConst;
|
||||
|
|
@ -483,10 +485,13 @@ impl Client {
|
|||
warn!("Falling back to a default configured resolver.");
|
||||
Resolver::builder_with_config(
|
||||
ResolverConfig::default(),
|
||||
TokioConnectionProvider::default(),
|
||||
TokioRuntimeProvider::default(),
|
||||
)
|
||||
})
|
||||
.build();
|
||||
.build()
|
||||
.expect(
|
||||
"Could not get a Hickory DNS resolver, maybe you are missing some tls libs",
|
||||
);
|
||||
|
||||
let quic_service_host = format!("_veloren._udp.{hostname}");
|
||||
let quic_lookup_future = resolver.srv_lookup(quic_service_host);
|
||||
|
|
@ -508,7 +513,13 @@ impl Client {
|
|||
warn!("QUIC SRV lookup failed: {error:?}");
|
||||
},
|
||||
|srv_lookup| {
|
||||
srv_rr.extend(srv_lookup.iter().cloned().map(|srv| (ConnMode::Quic, srv)))
|
||||
srv_rr.extend(srv_lookup.answers().iter().filter_map(|record| {
|
||||
if let RData::SRV(srv) = &record.data {
|
||||
Some((ConnMode::Quic, srv.clone()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}))
|
||||
},
|
||||
);
|
||||
let () = tcp_rr.map_or_else(
|
||||
|
|
@ -516,21 +527,27 @@ impl Client {
|
|||
warn!("TCP SRV lookup failed: {error:?}");
|
||||
},
|
||||
|srv_lookup| {
|
||||
srv_rr.extend(srv_lookup.iter().cloned().map(|srv| (ConnMode::Tcp, srv)))
|
||||
srv_rr.extend(srv_lookup.answers().iter().filter_map(|record| {
|
||||
if let RData::SRV(srv) = &record.data {
|
||||
Some((ConnMode::Tcp, srv.clone()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}))
|
||||
},
|
||||
);
|
||||
|
||||
// SRV records have a priority; lowest priority hosts MUST be contacted first.
|
||||
let srv_rr_slice = srv_rr.as_mut_slice();
|
||||
srv_rr_slice.sort_by_key(|(_, srv)| srv.priority());
|
||||
srv_rr_slice.sort_by_key(|(_, srv)| srv.priority);
|
||||
|
||||
let mut iter = srv_rr_slice.iter();
|
||||
|
||||
// This loops exits as soon as the above iter over `srv_rr_slice` is exhausted
|
||||
loop {
|
||||
if let Some((conn_mode, srv_rr)) = iter.next() {
|
||||
let hostname = format!("{}", srv_rr.target());
|
||||
let port = Some(srv_rr.port());
|
||||
let hostname = format!("{}", srv_rr.target);
|
||||
let port = Some(srv_rr.port);
|
||||
let conn_result = match conn_mode {
|
||||
ConnMode::Quic => {
|
||||
connect_quic(&network, hostname, port, prefer_ipv6, validate_tls)
|
||||
|
|
@ -550,7 +567,7 @@ impl Client {
|
|||
match conn_result {
|
||||
Ok(c) => break c,
|
||||
Err(error) => {
|
||||
warn!("Failed to connect to host {}: {error:?}", srv_rr.target())
|
||||
warn!("Failed to connect to host {}: {error:?}", srv_rr.target)
|
||||
},
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue