Skip to content

Commit 3b14fea

Browse files
authored
🎨 Sync upstream hickory-dns
1 parent d61697d commit 3b14fea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+586
-406
lines changed

Diff for: Cargo.lock

+245-177
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+17-22
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
name = "smartdns"
33
version = "0.9.2-alpha.1"
44
authors = ["YISH <[email protected]>"]
5-
edition = "2021"
6-
rust-version = "1.75.0"
5+
edition = "2024"
6+
rust-version = "1.85.0"
77

88
keywords = ["DNS", "BIND", "dig", "SmartDNS", "Dnsmasq"]
99
categories = ["network-programming"]
@@ -45,27 +45,23 @@ self-update = ["dep:self_update"]
4545

4646
resolve-cli = ["dep:console"]
4747

48-
dns-over-tls = []
49-
dns-over-https = ["dns-over-https-rustls"]
48+
dns-over-tls = [
49+
"hickory-proto/tls-ring",
50+
"hickory-resolver/tls-ring",
51+
]
52+
dns-over-https = [
53+
"hickory-proto/https-ring",
54+
"hickory-resolver/https-ring"
55+
]
5056
dns-over-quic = [
51-
"dns-over-rustls",
52-
"hickory-proto/dns-over-quic",
53-
"hickory-resolver/dns-over-quic",
57+
"hickory-proto/quic-ring",
58+
"hickory-resolver/quic-ring",
5459
]
5560
dns-over-h3 = [
56-
"dns-over-rustls",
57-
"hickory-proto/dns-over-h3",
58-
"hickory-resolver/dns-over-h3"
61+
"hickory-proto/h3-ring",
62+
"hickory-resolver/h3-ring"
5963
]
6064

61-
dns-over-https-rustls = [
62-
"dns-over-rustls",
63-
"hickory-proto/dns-over-https-rustls",
64-
"hickory-resolver/dns-over-https-rustls",
65-
]
66-
67-
dns-over-rustls = []
68-
6965
mdns = []
7066

7167
service = [
@@ -162,12 +158,11 @@ tracing-subscriber = { version = "0.3", features = [
162158
# tracing-appender = "0.2"
163159

164160
# hickory dns
165-
hickory-proto = { git = "https://github.com/mokeyish/hickory-dns.git", rev = "0.25.0-smartdns.6", version = "0.25.0-alpha.4", features = ["serde"]}
166-
hickory-resolver = { git = "https://github.com/mokeyish/hickory-dns.git", rev = "0.25.0-smartdns.6", version = "0.25.0-alpha.4", features = [
161+
hickory-proto = { git = "https://github.com/mokeyish/hickory-dns.git", rev = "0.25.0-smartdns.7", features = ["serde"]}
162+
hickory-resolver = { git = "https://github.com/mokeyish/hickory-dns.git", rev = "0.25.0-smartdns.7", features = [
167163
"serde",
168164
"system-config",
169165
] }
170-
# hickory-server = { git = "https://github.com/mokeyish/hickory-dns.git", rev = "0.25.0-smartdns.5", version = "0.25.0-alpha.2", features = ["resolver"], optional = true }
171166
quinn = { version = "0.11.2", default-features = false }
172167

173168
# ssl
@@ -244,7 +239,7 @@ anyhow = "1.0"
244239

245240
[target.'cfg(target_os = "linux")'.build-dependencies]
246241
cc = "1.2"
247-
bindgen = "0.70"
242+
bindgen = "0.71"
248243

249244

250245
# Dev-dependencies are not used when compiling a package for building, but are used for compiling tests, examples, and benchmarks.

Diff for: src/api/address.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::sync::Arc;
22

3-
use super::openapi::{http::get, routes, IntoRouter};
3+
use super::openapi::{IntoRouter, http::get, routes};
44
use super::{IntoDataListPayload, ServeState, StatefulRouter};
5-
use axum::{extract::State, response::IntoResponse, Json};
5+
use axum::{Json, extract::State, response::IntoResponse};
66

77
pub fn routes() -> StatefulRouter {
88
routes![addresses].into_router()

Diff for: src/api/audit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::sync::Arc;
22

3-
use super::openapi::{http::get, routes, IntoRouter};
4-
use axum::{extract::State, response::IntoResponse, Json};
3+
use super::openapi::{IntoRouter, http::get, routes};
4+
use axum::{Json, extract::State, response::IntoResponse};
55

66
use super::{ServeState, StatefulRouter};
77

Diff for: src/api/cache.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use std::sync::Arc;
22

33
use super::openapi::{
4+
IntoRouter,
45
http::{get, post},
5-
routes, IntoRouter,
6+
routes,
67
};
78
use super::{IntoDataListPayload, ServeState, StatefulRouter};
89
use crate::log;
9-
use axum::{extract::State, http::StatusCode, response::IntoResponse, Json};
10+
use axum::{Json, extract::State, http::StatusCode, response::IntoResponse};
1011

1112
pub fn routes() -> StatefulRouter {
1213
let route1 = routes![flush_cache, caches].into_router();

Diff for: src/api/forward.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::sync::Arc;
22

3-
use axum::{extract::State, response::IntoResponse, Json};
3+
use axum::{Json, extract::State, response::IntoResponse};
44

5-
use super::openapi::{http::get, routes, IntoRouter};
5+
use super::openapi::{IntoRouter, http::get, routes};
66
use super::{IntoDataListPayload, ServeState, StatefulRouter};
77

88
pub fn routes() -> StatefulRouter {

Diff for: src/api/listener.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::sync::Arc;
22

3-
use axum::{extract::State, response::IntoResponse, Json};
3+
use axum::{Json, extract::State, response::IntoResponse};
44

5-
use super::openapi::{http::get, routes, IntoRouter};
5+
use super::openapi::{IntoRouter, http::get, routes};
66
use super::{IntoDataListPayload, ServeState, StatefulRouter};
77

88
pub fn routes() -> StatefulRouter {

Diff for: src/api/log.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::sync::Arc;
22

3-
use super::openapi::{http::get, routes, IntoRouter};
3+
use super::openapi::{IntoRouter, http::get, routes};
44
use super::{ServeState, StatefulRouter};
5-
use axum::{extract::State, response::IntoResponse, Json};
5+
use axum::{Json, extract::State, response::IntoResponse};
66

77
pub fn routes() -> StatefulRouter {
88
routes![log_config].into_router()

Diff for: src/api/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use axum::{
2+
Json,
23
http::StatusCode,
34
response::{IntoResponse, Response},
45
routing::get,
5-
Json,
66
};
77
use cfg_if::cfg_if;
88
use openapi::Router;

Diff for: src/api/nameserver.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::sync::Arc;
22

3-
use axum::{extract::State, response::IntoResponse, Json};
3+
use axum::{Json, extract::State, response::IntoResponse};
44

5-
use super::openapi::{http::get, routes, IntoRouter};
5+
use super::openapi::{IntoRouter, http::get, routes};
66
use super::{IntoDataListPayload, ServeState, StatefulRouter};
77

88
pub fn routes() -> StatefulRouter {

Diff for: src/api/openapi.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
use axum::routing::MethodRouter;
44
use utoipa::{
5-
openapi::{Paths, RefOr, Schema},
65
OpenApi,
6+
openapi::{Paths, RefOr, Schema},
77
};
88

99
pub use utoipa::{IntoParams, ToSchema};
@@ -33,10 +33,10 @@ pub fn swagger_cdn<S: Clone + Send + Sync + 'static>(
3333
cdn: Option<&str>,
3434
) -> axum::Router<S> {
3535
use axum::{
36+
Router,
3637
extract::State,
3738
response::{Html, Json},
3839
routing::get,
39-
Router,
4040
};
4141
use std::sync::Arc;
4242
use utoipa::openapi::OpenApi;

Diff for: src/api/serve_dns.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33

44
use axum::body::Body;
55
use axum::extract::Query;
6-
use axum::http::{header, HeaderValue, StatusCode};
6+
use axum::http::{HeaderValue, StatusCode, header};
77
use axum::response::{IntoResponse, Response};
88
use axum::{
99
body::Bytes,
@@ -12,8 +12,9 @@ use axum::{
1212
use serde::{Deserialize, Serialize};
1313

1414
use super::openapi::{
15+
IntoParams, IntoRouter, ToSchema,
1516
http::{get, post},
16-
routes, IntoParams, IntoRouter, ToSchema,
17+
routes,
1718
};
1819
use super::{ServeState, StatefulRouter};
1920
use crate::{dns::SerialMessage, libdns::Protocol, log};

Diff for: src/api/settings.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::sync::Arc;
22

3-
use super::openapi::{http::get, routes, IntoRouter};
3+
use super::openapi::{IntoRouter, http::get, routes};
44
use super::{ServeState, StatefulRouter};
5-
use axum::{extract::State, response::IntoResponse, Json};
5+
use axum::{Json, extract::State, response::IntoResponse};
66

77
pub fn routes() -> StatefulRouter {
88
routes![server_name].into_router()

Diff for: src/app.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ async fn process(
337337
message: SerialMessage,
338338
server_opts: ServerOpts,
339339
) -> SerialMessage {
340-
use crate::libdns::proto::op::{Header, Message, MessageType, OpCode, ResponseCode};
341340
use crate::libdns::proto::ProtoError;
341+
use crate::libdns::proto::op::{Header, Message, MessageType, OpCode, ResponseCode};
342342

343343
let addr = message.addr();
344344
let protocol = message.protocol();
@@ -380,7 +380,15 @@ async fn process(
380380
}
381381
Err(e) => {
382382
if e.is_nx_domain() {
383-
log::debug!("{}Response: error resolving: NXDomain, Duration: {:?}", if server_opts.is_background { "Background"} else { "" }, start.elapsed());
383+
log::debug!(
384+
"{}Response: error resolving: NXDomain, Duration: {:?}",
385+
if server_opts.is_background {
386+
"Background"
387+
} else {
388+
""
389+
},
390+
start.elapsed()
391+
);
384392
response_header
385393
.set_response_code(ResponseCode::NXDomain);
386394
}
@@ -390,7 +398,11 @@ async fn process(
390398
None => {
391399
log::debug!(
392400
"{}Response: error resolving: {}, Duration: {:?}",
393-
if server_opts.is_background { "Background"} else { "" },
401+
if server_opts.is_background {
402+
"Background"
403+
} else {
404+
""
405+
},
394406
e,
395407
start.elapsed()
396408
);
@@ -432,7 +444,7 @@ async fn process(
432444
proto = protocol,
433445
addr = addr.ip(),
434446
port = addr.port(),
435-
message_type= request_header.message_type(),
447+
message_type = request_header.message_type(),
436448
op = request_header.op_code(),
437449
error = error,
438450
);

Diff for: src/collections.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl FromIterator<WildcardName> for DomainSet {
159159
mod trie {
160160
use crate::third_ext::AsSlice;
161161
use std::{
162-
collections::{hash_map::RandomState, HashMap},
162+
collections::{HashMap, hash_map::RandomState},
163163
hash::{BuildHasher, Hash},
164164
};
165165

@@ -555,7 +555,7 @@ mod benchmark {
555555
for name in domain_list.iter() {
556556
set.insert(name.clone());
557557
}
558-
let set = phf::create_from_hashmap(set.0 .0);
558+
let set = phf::create_from_hashmap(set.0.0);
559559
let set = &set;
560560

561561
let domain_list = &domain_list;

Diff for: src/config/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use std::{
99
use crate::{
1010
infra::file_mode::FileMode,
1111
libdns::proto::rr::{
12-
rdata::{HTTPS, SRV},
1312
Name, RecordType,
13+
rdata::{HTTPS, SRV},
1414
},
1515
log::Level,
1616
proxy::ProxyConfig,

Diff for: src/config/parser/https_record.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl NomParser for HttpsRecordRule {
3030
#[cfg(test)]
3131
mod tests {
3232
use super::*;
33-
use crate::libdns::proto::rr::rdata::svcb::{Alpn, IpHint, SvcParamKey, SvcParamValue, SVCB};
33+
use crate::libdns::proto::rr::rdata::svcb::{Alpn, IpHint, SVCB, SvcParamKey, SvcParamValue};
3434

3535
#[test]
3636
fn test_parse() {

Diff for: src/config/parser/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use nom::{
2-
branch::*, bytes::complete::*, character::complete::*, combinator::*, multi::*, sequence::*,
3-
IResult,
2+
IResult, branch::*, bytes::complete::*, character::complete::*, combinator::*, multi::*,
3+
sequence::*,
44
};
55

66
mod address_rule;

Diff for: src/config/parser/nom_recipes/ip.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::net::IpAddr;
22

33
use super::{ipv4, ipv6};
4-
use nom::{branch::alt, combinator::map, IResult};
4+
use nom::{IResult, branch::alt, combinator::map};
55

66
pub fn ip(input: &str) -> IResult<&str, IpAddr> {
77
alt((map(ipv4, IpAddr::from), map(ipv6, IpAddr::from)))(input)

Diff for: src/config/parser/nom_recipes/ipv4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use std::net::Ipv4Addr;
22

33
use nom::{
4+
IResult,
45
character::complete::{char, digit1},
56
combinator::{map, map_res, recognize},
67
error::context,
78
multi::many_m_n,
89
sequence::{preceded, tuple},
9-
IResult,
1010
};
1111

1212
pub fn ipv4(input: &str) -> IResult<&str, Ipv4Addr> {

Diff for: src/config/parser/nom_recipes/ipv6.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std::net::Ipv6Addr;
22

33
use nom::{
4+
IResult,
45
branch::alt,
56
bytes::complete::tag,
67
character::complete::{char, hex_digit1},
78
combinator::{map, map_res, opt, recognize, verify},
89
error::context,
910
multi::{many_m_n, separated_list0},
1011
sequence::{pair, preceded},
11-
IResult,
1212
};
1313

1414
use super::ipv4;

Diff for: src/config/parser/svcb.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::*;
22
use crate::libdns::proto::rr::rdata::svcb::{
3-
Alpn, EchConfigList, IpHint, SvcParamKey, SvcParamValue, SVCB,
3+
Alpn, EchConfigList, IpHint, SVCB, SvcParamKey, SvcParamValue,
44
};
55
use crate::libdns::proto::rr::rdata::{A, AAAA};
66

0 commit comments

Comments
 (0)