mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2024-11-10 08:37:21 +01:00
Aded ranking of resolvers by a weight value
This commit is contained in:
parent
55897585ff
commit
5c7d880733
@ -65,6 +65,7 @@ burst = 15
|
||||
display_name = "Digitalcourage 3"
|
||||
info_url = "https://digitalcourage.de/support/zensurfreier-dns-server"
|
||||
aliases = ["dc","dc3","digitalcourage3"]
|
||||
weight = 900
|
||||
|
||||
servers = ["5.9.164.112:853","[2a01:4f8:251:554::2]:853"]
|
||||
protocol = "tls"
|
||||
|
14
src/main.rs
14
src/main.rs
@ -245,7 +245,8 @@ async fn main() {
|
||||
|
||||
dns_resolver_selectables.push(Selectable {
|
||||
id: "default".to_string(),
|
||||
name: "System".to_string()
|
||||
name: "System".to_string(),
|
||||
weight: 1000,
|
||||
});
|
||||
|
||||
//FIXME: Not release ready,must be configurable and have better error handling.
|
||||
@ -256,7 +257,8 @@ async fn main() {
|
||||
).unwrap();
|
||||
dns_resolver_selectables.push(Selectable {
|
||||
id: "quad9".to_string(),
|
||||
name: "Quad9".to_string()
|
||||
name: "Quad9".to_string(),
|
||||
weight: 500
|
||||
});
|
||||
println!("Initalizing Google resolver ...");
|
||||
let google_resolver = TokioAsyncResolver::tokio(
|
||||
@ -265,7 +267,8 @@ async fn main() {
|
||||
).unwrap();
|
||||
dns_resolver_selectables.push(Selectable {
|
||||
id: "google".to_string(),
|
||||
name: "Google".to_string()
|
||||
name: "Google".to_string(),
|
||||
weight: 10,
|
||||
});
|
||||
println!("Initalizing Cloudflare resolver ...");
|
||||
let cloudflare_resolver = TokioAsyncResolver::tokio(
|
||||
@ -274,7 +277,8 @@ async fn main() {
|
||||
).unwrap();
|
||||
dns_resolver_selectables.push(Selectable {
|
||||
id: "cloudflare".to_string(),
|
||||
name: "Cloudflare".to_string()
|
||||
name: "Cloudflare".to_string(),
|
||||
weight: 20,
|
||||
});
|
||||
|
||||
let mut dns_resolver_map: HashMap<String,TokioAsyncResolver> = HashMap::new();
|
||||
@ -289,6 +293,7 @@ async fn main() {
|
||||
dns_resolver_selectables.push(Selectable {
|
||||
id: key.clone(),
|
||||
name: resolver_config.display_name.clone(),
|
||||
weight: resolver_config.weight,
|
||||
});
|
||||
}
|
||||
|
||||
@ -311,6 +316,7 @@ async fn main() {
|
||||
config: config.clone(),
|
||||
});
|
||||
|
||||
dns_resolver_selectables.sort_by(|a,b| b.weight.cmp(&a.weight));
|
||||
let derived_config = DerivedConfiguration {
|
||||
dns_resolver_selectables: dns_resolver_selectables,
|
||||
};
|
||||
|
@ -1,4 +1,5 @@
|
||||
use serde::{Deserialize,Serialize};
|
||||
|
||||
/* Response format */
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone, Copy)]
|
||||
@ -45,5 +46,6 @@ pub struct QuerySettings {
|
||||
pub struct Selectable {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub weight: i32,
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{% block title %}dig {{ data.query }}{% endblock %}
|
||||
{% block og_title %}dig {{ data.query }}{% endblock %}
|
||||
{% block h1 %}dig <code>{{ helper::breadcrumb_domain(extra=extra, name=data.query) }}</code>{% endblock %}
|
||||
{% block h1 %}dig <code>{{ helper::breadcrumb_domain(extra=extra, name=data.query) }}</code> via <a href="{{extra.base_url}}/dns_resolver/{{data.result.used_dns_resolver}}">{{data.result.used_dns_resolver}}</a>{% endblock %}
|
||||
|
||||
{% block og_path %}/dig/{{ data.query | urlencode_strict }}{% endblock %}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
{% set r = data.result.records %}
|
||||
<section>
|
||||
<h2>DNS Records via {{data.result.used_dns_resolver}}</h2>
|
||||
<h2>DNS Records</h2>
|
||||
|
||||
{% if r.nxdomain %}
|
||||
<p class="error box">Our DNS-Server claims that this domain doesn't exist, there shouldn't be any results.</p>
|
||||
|
@ -31,7 +31,7 @@
|
||||
{%- set_global i = i+1 -%}
|
||||
{% endfor %}
|
||||
|
||||
{% endmacro breadcrumb_domain %}
|
||||
{%- endmacro breadcrumb_domain %}
|
||||
|
||||
{% macro ip_info(ip_info) -%}
|
||||
{{ip_info.scope | title}} {{ip_info.cast | title}} IPv{% if ip_info.is_v6_address %}6{% else %}4{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user