Removed dns search functionality completely

I don't see it working and not being annoying
This commit is contained in:
Slatian 2023-08-07 21:52:31 +02:00
parent daa68bbd5d
commit 2aa6baaa57
4 changed files with 2 additions and 17 deletions

View File

@ -90,12 +90,6 @@ In case you want to use the system resolver and customize it.
`system_resolver_weight`
: Equivalent to the `weight` of a custom resolver, default: 1000
### `search`
This is for a work in progress feature that allows confiuring search domains for all custom dns resolvers.
Note: it is currently disabled as it was causing problems.
### Custom resolvers
It is possible to confgure custom resolvers in plce of or in addition to the default system resolver.

View File

@ -28,9 +28,6 @@ allow_reverse_lookup = true
# that end with one of these suffixes don't exist
hidden_suffixes = [".com"]
# doesn't really work 🙁
search = ["org","net"]
[geoip]
# Path to geoip databses
# Currently only the mmdb format is supported

View File

@ -1,6 +1,5 @@
use serde::{Deserialize,Serialize};
use trust_dns_resolver::config::Protocol;
use trust_dns_resolver::Name;
use std::collections::HashMap;
use std::net::SocketAddr;
@ -11,7 +10,6 @@ pub struct DnsConfig {
pub allow_forward_lookup: bool,
pub allow_reverse_lookup: bool,
pub hidden_suffixes: Vec<String>,
pub search: Vec<String>,
pub resolver: HashMap<String,DnsResolverConfig>,
pub enable_system_resolver: bool,
@ -40,8 +38,6 @@ pub struct DnsResolverConfig {
#[serde(default="zero")]
pub weight: i32,
pub servers: Vec<SocketAddr>,
#[serde(default)]
pub search: Vec<String>,
pub protocol: DnsProtocol,
pub tls_dns_name: Option<String>,
#[serde(skip_serializing)] //Don't leak our bind address to the outside
@ -65,7 +61,6 @@ impl Default for DnsConfig {
allow_reverse_lookup: false,
hidden_suffixes: Vec::new(),
resolver: Default::default(),
search: Vec::new(),
enable_system_resolver: true,
system_resolver_name: "System".to_string(),
@ -89,8 +84,7 @@ impl Into<Protocol> for DnsProtocol {
impl DnsResolverConfig {
pub fn to_trust_resolver_config(
&self,
additional_search: &Vec<String>,
&self
) -> trust_dns_resolver::config::ResolverConfig {
let mut resolver = trust_dns_resolver::config::ResolverConfig::new();
for server in &self.servers {

View File

@ -259,7 +259,7 @@ async fn main() {
for (key, resolver_config) in &config.dns.resolver {
println!("Initalizing {} resolver ...", key);
let resolver = TokioAsyncResolver::tokio(
resolver_config.to_trust_resolver_config(&config.dns.search),
resolver_config.to_trust_resolver_config(),
Default::default()
).unwrap();
dns_resolver_map.insert(key.clone(), resolver);