mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2024-12-26 19:58:20 +01:00
Implemented global search config
This commit is contained in:
parent
fef954f6c1
commit
cf806ad8f5
@ -28,6 +28,9 @@ 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
|
||||
|
@ -88,7 +88,10 @@ impl Into<Protocol> for DnsProtocol {
|
||||
}
|
||||
|
||||
impl DnsResolverConfig {
|
||||
pub fn to_trust_resolver_config(&self) -> trust_dns_resolver::config::ResolverConfig {
|
||||
pub fn to_trust_resolver_config(
|
||||
&self,
|
||||
additional_search: &Vec<String>,
|
||||
) -> trust_dns_resolver::config::ResolverConfig {
|
||||
let mut resolver = trust_dns_resolver::config::ResolverConfig::new();
|
||||
for server in &self.servers {
|
||||
resolver.add_name_server(trust_dns_resolver::config::NameServerConfig{
|
||||
@ -105,6 +108,11 @@ impl DnsResolverConfig {
|
||||
resolver.add_search(name);
|
||||
}
|
||||
}
|
||||
for search in additional_search {
|
||||
if let Ok(name) = Name::from_str_relaxed(search) {
|
||||
resolver.add_search(name);
|
||||
}
|
||||
}
|
||||
return resolver;
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,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(),
|
||||
resolver_config.to_trust_resolver_config(&config.dns.search),
|
||||
Default::default()
|
||||
).unwrap();
|
||||
dns_resolver_map.insert(key.clone(), resolver);
|
||||
|
Loading…
Reference in New Issue
Block a user