Beeter communication of dns errors

This commit is contained in:
Slatian 2023-08-07 21:09:14 +02:00
parent 2e1f6a77ac
commit 2fe1b69174
4 changed files with 60 additions and 25 deletions

View File

@ -706,7 +706,22 @@ async fn get_dig_result(
used_dns_resolver: dns_resolver_name.clone(), used_dns_resolver: dns_resolver_name.clone(),
} }
} }
} else {
return DigResult {
records: DnsLookupResult{
invalid_name: true,
.. Default::default()
},
.. Default::default()
}
}
} else {
return DigResult {
records: DnsLookupResult{
unkown_resolver: true,
.. Default::default()
},
.. Default::default()
} }
} }
return Default::default();
} }

View File

@ -42,6 +42,8 @@ pub struct DnsLookupResult {
pub dns_error: bool, pub dns_error: bool,
pub nxdomain: bool, pub nxdomain: bool,
pub timeout: bool, pub timeout: bool,
pub invalid_name: bool,
pub unkown_resolver: bool,
} }
#[derive(serde::Deserialize, serde::Serialize, Clone, PartialEq)] #[derive(serde::Deserialize, serde::Serialize, Clone, PartialEq)]

View File

@ -26,8 +26,16 @@
<section> <section>
<h2>DNS Records</h2> <h2>DNS Records</h2>
{% if r.nxdomain %} {% set show_nonpresent = true %}
<p class="error box">Our DNS-Server claims that this domain doesn't exist, there shouldn't be any results.</p> {% if r.unkown_resolver %}
<p class="error box">The resolver you chose is not one of the available ones, if you can reproduce this error by just using the UI <a href="https://codeberg.org/slatian/service.echoip-slatecave/issues/new">please report it</a>.</p>
{% set show_nonpresent = false %}
{% elif r.invalid_name %}
<p class="error box">This domain name does not conform to <a href="https://www.rfc-editor.org/info/std3">the dns specification (std3)</a> rules and was therefore not resolved.</p>
{% set show_nonpresent = false %}
{% elif r.nxdomain %}
<p class="error box">The DNS-Server claims that this domain doesn't exist, there shouldn't be any results.</p>
{% set show_nonpresent = false %}
{% elif r.timeout %} {% elif r.timeout %}
<p class="error box">There was at least one timeout error while resolving this domain, the results below are incomplete.</p> <p class="error box">There was at least one timeout error while resolving this domain, the results below are incomplete.</p>
{% elif r.other_error %} {% elif r.other_error %}
@ -66,7 +74,7 @@
<li>{{ helper::ip(extra=extra, ip=address) }}</li> <li>{{ helper::ip(extra=extra, ip=address) }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% elif not r.nxdomain %} {% elif show_nonpresent %}
<p>No <code>A</code> (IPv4) Records.</p> <p>No <code>A</code> (IPv4) Records.</p>
{% endif %} {% endif %}
@ -77,7 +85,7 @@
<li>{{ helper::ip(extra=extra, ip=address) }}</li> <li>{{ helper::ip(extra=extra, ip=address) }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% elif not r.nxdomain %} {% elif show_nonpresent %}
<p>No <code>AAAA</code> (IPv6) Records.</p> <p>No <code>AAAA</code> (IPv6) Records.</p>
{% endif %} {% endif %}
@ -90,7 +98,7 @@
<li>{{ helper::dig(extra=extra, name=mx.exchange, fqdn=true, prefix=mx.preference) }}</li> <li>{{ helper::dig(extra=extra, name=mx.exchange, fqdn=true, prefix=mx.preference) }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% elif not r.nxdomain %} {% elif show_nonpresent %}
<p id="mx">No <code>MX</code> (Mail Exchange) records.</p> <p id="mx">No <code>MX</code> (Mail Exchange) records.</p>
{% endif %} {% endif %}
@ -116,7 +124,7 @@
</dl></li> </dl></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% elif not r.nxdomain %} {% elif show_nonpresent %}
<p id="soa">No <code>SOA</code> records.</p> <p id="soa">No <code>SOA</code> records.</p>
{% endif %} {% endif %}
@ -129,7 +137,7 @@
<li>{{ helper::dig(extra=extra, name=ns) }}</li> <li>{{ helper::dig(extra=extra, name=ns) }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% elif not r.nxdomain %} {% elif show_nonpresent %}
<p id="ns">No <code>NS</code> (Name Server) records.</p> <p id="ns">No <code>NS</code> (Name Server) records.</p>
{% endif %} {% endif %}
@ -141,7 +149,7 @@
<li><code>{{caa}}</code></li> <li><code>{{caa}}</code></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% elif not r.nxdomain %} {% elif show_nonpresent %}
<p id="caa">No <code>CAA</code> (<a target="_blank" href="https://de.wikipedia.org/wiki/DNS_Certification_Authority_Authorization">Certification Authority Authorization</a>) records.</p> <p id="caa">No <code>CAA</code> (<a target="_blank" href="https://de.wikipedia.org/wiki/DNS_Certification_Authority_Authorization">Certification Authority Authorization</a>) records.</p>
{% endif %} {% endif %}
@ -152,7 +160,7 @@
<li><code>{{txt}}</code></li> <li><code>{{txt}}</code></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% elif not r.nxdomain %} {% elif show_nonpresent %}
<p id="txt">No <code>TXT</code> records.</p> <p id="txt">No <code>TXT</code> records.</p>
{% endif %} {% endif %}
@ -172,7 +180,7 @@
</dl></li> </dl></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% elif not r.nxdomain %} {% elif show_nonpresent %}
<p id="srv">No <code>SRV</code> records.</p> <p id="srv">No <code>SRV</code> records.</p>
<p><code>SRV</code> or Service records usually live on their own subdomains like {{ helper::dig(extra=extra, name="_xmpp-client._tcp."~data.query) }}. <p><code>SRV</code> or Service records usually live on their own subdomains like {{ helper::dig(extra=extra, name="_xmpp-client._tcp."~data.query) }}.
{% endif %} {% endif %}

View File

@ -2,7 +2,8 @@
{% block path %}dig/{{ data.query | urlencode_strict }}{% endblock %} {% block path %}dig/{{ data.query | urlencode_strict }}{% endblock %}
{% block content -%} {% set r = data.result.records %}
{%- block content -%}
# dig {{data.query}} via {{ data.result.used_dns_resolver }} # dig {{data.query}} via {{ data.result.used_dns_resolver }}
{% if data.result.idn -%} {% if data.result.idn -%}
@ -25,7 +26,16 @@ Your IDN would decode to
{% set r = data.result.records -%} {% set r = data.result.records -%}
## DNS Records ## DNS Records
{% if r.nxdomain %} {% if r.unkown_resolver %}
{%- set show_nonpresent = false %}
The resolver you chose is not one of the available ones.
=> {{ extra.base_url }}/dns_resolver
{% elif r.invalid_name %}
{%- set show_nonpresent = false %}
This domain name does not conform to the dns specification (std3) rules and was therefore not resolved.
=> https://www.rfc-editor.org/info/std3
{% elif r.nxdomain %}
{%- set show_nonpresent = false %}
Our DNS-Server claims that this domain doesn't exist, there shouldn't be any results. Our DNS-Server claims that this domain doesn't exist, there shouldn't be any results.
{%- elif r.timeout -%} {%- elif r.timeout -%}
There was at least one timeout error while resolving this domain, the results below are incomplete. There was at least one timeout error while resolving this domain, the results below are incomplete.
@ -61,7 +71,7 @@ A (IPv4) records:
{% for address in r.a -%} {% for address in r.a -%}
* {{ address }} * {{ address }}
{% endfor %} {% endfor %}
{%- elif not r.nxdomain %} {%- elif show_nonpresent %}
No A (IPv4) Records. No A (IPv4) Records.
{% endif -%} {% endif -%}
@ -70,7 +80,7 @@ AAAA (IPv6) records:
{% for address in r.aaaa -%} {% for address in r.aaaa -%}
* {{ address }} * {{ address }}
{% endfor %} {% endfor %}
{%- elif not r.nxdomain %} {%- elif show_nonpresent %}
No AAAA (IPv6) Records. No AAAA (IPv6) Records.
{% endif -%} {% endif -%}
@ -81,7 +91,7 @@ MX (Mail Exchange) records:
{% for mx in r.mx | sort(attribute="preference") | reverse -%} {% for mx in r.mx | sort(attribute="preference") | reverse -%}
* {{ mx.preference }} {{ mx.exchange }} * {{ mx.preference }} {{ mx.exchange }}
{% endfor %} {% endfor %}
{%- elif not r.nxdomain %} {%- elif show_nonpresent %}
No MX (Mail Exchange) records. No MX (Mail Exchange) records.
{% endif %} {% endif %}
@ -96,7 +106,7 @@ SOA (Source Of Authority) records:
* expire: {{soa.expire / 3600 | round(precision=2)}}h * expire: {{soa.expire / 3600 | round(precision=2)}}h
* minimum: {{soa.minimum / 60 | round(precision=2)}}m TTL * minimum: {{soa.minimum / 60 | round(precision=2)}}m TTL
{% endfor %} {% endfor %}
{%- elif not r.nxdomain %} {%- elif show_nonpresent %}
No SOA (Source Of Authority) records. No SOA (Source Of Authority) records.
{% endif %} {% endif %}
@ -105,7 +115,7 @@ NS (Name Server) records:
{% for ns in r.ns -%} {% for ns in r.ns -%}
* {{ns}} * {{ns}}
{% endfor %} {% endfor %}
{%- elif not r.nxdomain %} {%- elif show_nonpresent %}
No NS (Name Server) records. No NS (Name Server) records.
{% endif %} {% endif %}
@ -114,7 +124,7 @@ CAA (Certification Authority Authorization) records:
{% for caa in r.caa -%} {% for caa in r.caa -%}
* {{caa}} * {{caa}}
{% endfor %} {% endfor %}
{%- elif not r.nxdomain %} {%- elif show_nonpresent %}
No CAA (Certification Authority Authorization) records. No CAA (Certification Authority Authorization) records.
{% endif %} {% endif %}
@ -123,7 +133,7 @@ TXT records:
{% for txt in r.txt -%} {% for txt in r.txt -%}
* {{txt}} * {{txt}}
{% endfor %} {% endfor %}
{%- elif not r.nxdomain %} {%- elif show_nonpresent %}
No TXT records. No TXT records.
{% endif %} {% endif %}
@ -135,7 +145,7 @@ SRV records:
* Port: {{srv.port}} * Port: {{srv.port}}
* Target: {{srv.target}} * Target: {{srv.target}}
{% endfor %} {% endfor %}
{%- elif not r.nxdomain %} {%- elif show_nonpresent %}
No SRV records. No SRV records.
SRV or Service records usually live on their own subdomains like {{ "_xmpp-client._tcp."~data.query }}. SRV or Service records usually live on their own subdomains like {{ "_xmpp-client._tcp."~data.query }}.