Brijesh's Git Server — dns-record-checker @ a458291afd4658066119df4c36443ac3a63b54ee

DNS record checker - dns.brijesh.dev

templates/index.html (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
<!doctype html>
<html lang="en">
  <head>
    <title>DNS Lookup</title>
    <script src="https://cdn.tailwindcss.com"></script>
  </head>
  <body class="m-4 lg:m-6">
    <h1 class="text-xl mb-3">DNS Lookup</h1>
    <form action="/lookup" method="post" class="flex">
      <input
        class="px-2 py-1 rounded border border-zinc-200 focus:border-zinc-300 w-full lg:w-72"
        placeholder="Domain"
        id="domain"
        name="domain"
        required
      />
      <button
        class="px-2 py-1 rounded bg-zinc-700 text-white hover:bg-zinc-900 focus:outline-none ml-2"
        type="submit"
      >
        Lookup
      </button>
    </form>

    <div id="query-message" class="mt-4 text-red-700 hidden">
      Query submitted, please wait for a few seconds.
    </div>

    <div id="results">
      {{ with .DNSRecord }}
      <h2 class="mt-4 mb-2">Records for {{ .Domain }}</h2>

      <details open class="mb-4">
        <summary>A record</summary>
        {{ if eq (len .ARecord) 0 }}
        <p class="text-zinc-400">Not available</p>
        {{ else }}
        <ul class="list-none">
          {{ range .ARecord }}
          <li>{{ . }}</li>
          {{ end }}
        </ul>
        {{ end }}
      </details>

      <details open class="mb-4">
        <summary>CNAME record</summary>
        {{ if eq .CNAME "" }}
        <p class="text-zinc-400">Not available</p>
        {{ else }}
        <p>{{ .CNAME }}</p>
        {{ end }}
      </details>

      <details open class="mb-4">
        <summary>MX record</summary>
        {{ if eq (len .MXRecord) 0 }}
        <p class="text-zinc-400">Not available</p>
        {{ else }}
        <ul class="list-none">
          {{ range .MXRecord }}
          <li>{{ . }}</li>
          {{ end }}
        </ul>
        {{ end }}
      </details>

      <details open class="mb-4">
        <summary>NS record</summary>
        {{ if eq (len .NSRecord) 0 }}
        <p class="text-zinc-400">Not available</p>
        {{ else }}
        <ul class="list-none">
          {{ range .NSRecord }}
          <li>{{ . }}</li>
          {{ end }}
        </ul>
        {{ end }}
      </details>

      <details open class="mb-4">
        <summary>TXT record</summary>
        {{ if eq (len .TXTRecord) 0 }}
        <p class="text-zinc-400">Not available</p>
        {{ else }}
        <ul class="list-none">
          {{ range .TXTRecord }}
          <li>{{ . }}</li>
          {{ end }}
        </ul>
        {{ end }}
      </details>
      {{ end }}
    </div>

    <script>
      const form = document.querySelector("form");
      const message = document.getElementById("query-message");
      const results = document.getElementById("results");

      form.addEventListener("submit", () => {
        message.classList.remove("hidden");
        results.classList.add("hidden");
      });
    </script>
  </body>
</html>