Skip to content

Commit

Permalink
feat: hickory resolver enable EDNS0
Browse files Browse the repository at this point in the history
ref #1425, enable EDNS0 for supporting large Response Messages
  • Loading branch information
zonyitoo committed Feb 16, 2024
1 parent 5ced7d1 commit 8e3473d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/shadowsocks/src/dns_resolver/hickory_dns_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use hickory_resolver::{
udp::{DnsUdpSocket, QuicLocalAddr},
TokioTime,
},
AsyncResolver,
TokioHandle,
AsyncResolver, TokioHandle,
};
use log::trace;
use tokio::{io::ReadBuf, net::UdpSocket};
Expand Down Expand Up @@ -122,6 +121,9 @@ pub async fn create_resolver(
// Since we want to use Happy Eyeballs to connect to both IPv4 and IPv6 addresses, we need both A and AAAA records.
resolver_opts.ip_strategy = LookupIpStrategy::Ipv4AndIpv6;

// Enable EDNS0 for large records
resolver_opts.edns0 = true;

trace!(
"initializing DNS resolver with config {:?} opts {:?}",
conf,
Expand Down Expand Up @@ -160,6 +162,9 @@ pub async fn create_resolver(
// Only ip_strategy should be changed. Why Ipv4AndIpv6? See comments above.
opts.ip_strategy = LookupIpStrategy::Ipv4AndIpv6;

// Enable EDNS0 for large records
opts.edns0 = true;

trace!(
"initializing DNS resolver with system-config {:?} opts {:?}",
config,
Expand Down

0 comments on commit 8e3473d

Please sign in to comment.