dnskit 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. dnskit-0.1.0/.gitignore +27 -0
  2. dnskit-0.1.0/CHANGELOG.md +76 -0
  3. dnskit-0.1.0/LICENSE +21 -0
  4. dnskit-0.1.0/PKG-INFO +362 -0
  5. dnskit-0.1.0/README.md +324 -0
  6. dnskit-0.1.0/docs/USER_GUIDE.md +3208 -0
  7. dnskit-0.1.0/docs/images/batch.svg +119 -0
  8. dnskit-0.1.0/docs/images/compare.svg +124 -0
  9. dnskit-0.1.0/docs/images/dnssec.svg +195 -0
  10. dnskit-0.1.0/docs/images/doctor.svg +174 -0
  11. dnskit-0.1.0/docs/images/email.svg +265 -0
  12. dnskit-0.1.0/docs/images/local.svg +190 -0
  13. dnskit-0.1.0/docs/images/lookup-missing.svg +102 -0
  14. dnskit-0.1.0/docs/images/lookup.svg +155 -0
  15. dnskit-0.1.0/docs/images/propagation.svg +273 -0
  16. dnskit-0.1.0/docs/images/reach.svg +142 -0
  17. dnskit-0.1.0/docs/images/resolvers.svg +102 -0
  18. dnskit-0.1.0/docs/images/reverse.svg +101 -0
  19. dnskit-0.1.0/docs/images/trace.svg +100 -0
  20. dnskit-0.1.0/docs/images/watch.svg +112 -0
  21. dnskit-0.1.0/pyproject.toml +133 -0
  22. dnskit-0.1.0/scripts/readme_screenshots.py +138 -0
  23. dnskit-0.1.0/scripts/release_notes.py +42 -0
  24. dnskit-0.1.0/src/dnskit/__init__.py +9 -0
  25. dnskit-0.1.0/src/dnskit/__main__.py +5 -0
  26. dnskit-0.1.0/src/dnskit/cli/__init__.py +1 -0
  27. dnskit-0.1.0/src/dnskit/cli/app.py +955 -0
  28. dnskit-0.1.0/src/dnskit/cli/render.py +1334 -0
  29. dnskit-0.1.0/src/dnskit/core/__init__.py +349 -0
  30. dnskit-0.1.0/src/dnskit/core/adapters.py +521 -0
  31. dnskit-0.1.0/src/dnskit/core/batch.py +211 -0
  32. dnskit-0.1.0/src/dnskit/core/compare.py +168 -0
  33. dnskit-0.1.0/src/dnskit/core/config.py +248 -0
  34. dnskit-0.1.0/src/dnskit/core/connectivity.py +139 -0
  35. dnskit-0.1.0/src/dnskit/core/diagnosis.py +100 -0
  36. dnskit-0.1.0/src/dnskit/core/dnssec.py +767 -0
  37. dnskit-0.1.0/src/dnskit/core/doctor.py +836 -0
  38. dnskit-0.1.0/src/dnskit/core/integrity.py +232 -0
  39. dnskit-0.1.0/src/dnskit/core/local.py +725 -0
  40. dnskit-0.1.0/src/dnskit/core/lookup.py +218 -0
  41. dnskit-0.1.0/src/dnskit/core/mail.py +1346 -0
  42. dnskit-0.1.0/src/dnskit/core/nameservers.py +223 -0
  43. dnskit-0.1.0/src/dnskit/core/outside.py +113 -0
  44. dnskit-0.1.0/src/dnskit/core/propagation.py +277 -0
  45. dnskit-0.1.0/src/dnskit/core/reach.py +255 -0
  46. dnskit-0.1.0/src/dnskit/core/reverse.py +61 -0
  47. dnskit-0.1.0/src/dnskit/core/serialize.py +64 -0
  48. dnskit-0.1.0/src/dnskit/core/trace.py +591 -0
  49. dnskit-0.1.0/src/dnskit/core/watch.py +167 -0
  50. dnskit-0.1.0/src/dnskit/py.typed +0 -0
  51. dnskit-0.1.0/tests/conftest.py +73 -0
  52. dnskit-0.1.0/tests/fakes.py +112 -0
  53. dnskit-0.1.0/tests/test_adapters.py +515 -0
  54. dnskit-0.1.0/tests/test_batch.py +251 -0
  55. dnskit-0.1.0/tests/test_cli.py +2297 -0
  56. dnskit-0.1.0/tests/test_compare.py +227 -0
  57. dnskit-0.1.0/tests/test_config.py +185 -0
  58. dnskit-0.1.0/tests/test_connectivity.py +181 -0
  59. dnskit-0.1.0/tests/test_diagnosis.py +74 -0
  60. dnskit-0.1.0/tests/test_dnssec.py +550 -0
  61. dnskit-0.1.0/tests/test_doctor.py +771 -0
  62. dnskit-0.1.0/tests/test_integrity.py +222 -0
  63. dnskit-0.1.0/tests/test_local.py +552 -0
  64. dnskit-0.1.0/tests/test_lookup.py +170 -0
  65. dnskit-0.1.0/tests/test_mail.py +748 -0
  66. dnskit-0.1.0/tests/test_nameservers.py +295 -0
  67. dnskit-0.1.0/tests/test_outside.py +119 -0
  68. dnskit-0.1.0/tests/test_propagation.py +255 -0
  69. dnskit-0.1.0/tests/test_reach.py +214 -0
  70. dnskit-0.1.0/tests/test_readme_screenshots.py +130 -0
  71. dnskit-0.1.0/tests/test_release_notes.py +64 -0
  72. dnskit-0.1.0/tests/test_reverse.py +96 -0
  73. dnskit-0.1.0/tests/test_serialize.py +152 -0
  74. dnskit-0.1.0/tests/test_trace.py +556 -0
  75. dnskit-0.1.0/tests/test_version.py +20 -0
  76. dnskit-0.1.0/tests/test_watch.py +155 -0
@@ -0,0 +1,27 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+
8
+ # Virtual environments
9
+ .venv/
10
+ venv/
11
+
12
+ # Tooling caches
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+ .mypy_cache/
16
+ .coverage
17
+ coverage.xml
18
+ htmlcov/
19
+
20
+ # Local config / secrets
21
+ .env
22
+
23
+ # Editors and OS
24
+ .vscode/
25
+ .idea/
26
+ .DS_Store
27
+ Thumbs.db
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ All notable changes to dnskit are listed here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and dnskit uses
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-11-13
10
+
11
+ The first release. Every command explains what it finds in plain English, with a suggested
12
+ fix, and works on Windows, macOS and Linux with Python 3.11 or newer.
13
+
14
+ ### Added
15
+
16
+ #### Commands
17
+
18
+ - `doctor`: a full health check of this computer and a domain in one command. It runs the
19
+ `local`, `lookup`, `compare`, `reach`, `email` and `dnssec` checks in parallel with a
20
+ live progress list. The result is a score out of 100, a verdict, and issues ranked
21
+ critical, major, minor or note, split into "this computer" and "the domain", each with a
22
+ fix. `--quick` skips the comparison, email and DNSSEC checks.
23
+ - `lookup`: A, AAAA, MX, CNAME, NS and TXT queried in parallel and shown in one table.
24
+ `--type` limits it to one type, and `--server` picks the nameserver.
25
+ - `reverse`: the hostname for an IPv4 or IPv6 address (PTR).
26
+ - `compare`: the same question to Google, Cloudflare, Quad9 and every system DNS server,
27
+ each asked alone, with answers that differ from the majority highlighted.
28
+ - `email`: MX (with each mail server's addresses), SPF (syntax, a single record, `all`,
29
+ and the 10-lookup limit counted across includes), DMARC (the policy explained) and DKIM
30
+ (common selectors plus `--selector`, and key size). Each check passes, warns or fails,
31
+ with a fix.
32
+ - `local`: this computer's DNS setup.
33
+ - Lists each adapter and its DNS servers, and tests every server.
34
+ - Finds dead, slow and "ghost" servers (left over from old or disconnected adapters),
35
+ and hosts file entries that override DNS.
36
+ - Detects NXDOMAIN hijacking and interception of 8.8.8.8 and 1.1.1.1, and checks IPv6.
37
+ - Prints the command that flushes the DNS cache.
38
+ - Knows about VPNs and network bridges.
39
+ - `reach`: whether a site's problem is DNS or the connection. It resolves the name and
40
+ connects to port 443 (or `--port`). Exits 1 for a DNS problem and 3 for a connection
41
+ problem.
42
+ - `trace`: the delegation from the root servers down, step by step, showing which level
43
+ fails and why.
44
+ - `dnssec`: the chain of trust from the root trust anchors down (DS, DNSKEY and
45
+ signatures at every level) and a check of the computer's clock. It retries through
46
+ 8.8.8.8 or 1.1.1.1 when the local DNS server strips signatures.
47
+ - `propagation`: 14 public resolvers worldwide (global anycast ones, and fixed-location
48
+ ones in the Americas, Europe and Asia), with the percentage giving the same answer. It
49
+ recognises answers that differ by location (CDN or geo-DNS).
50
+ - `resolvers`: each system DNS server's response time, and which one dnskit uses.
51
+ - `batch`: `lookup`, `doctor` or `email` on a list of domains, a few at a time, ending in
52
+ a summary table.
53
+ - `watch`: re-checks a record every N seconds, beeps when it changes, and lists every
54
+ value seen when stopped. Addresses already seen count as rotation (a CDN), not a change,
55
+ unless `--strict` is given. Also has `--until`, `--count` and `--exit-on-change`.
56
+ - `config`: shows or creates (`--init`) a TOML settings file, with defaults per command
57
+ and custom resolver lists for `compare` and `propagation`.
58
+
59
+ #### Across all commands
60
+
61
+ - `--json` on every command: one object with `command`, `exit_code`, `summary`,
62
+ `diagnosis` and the full report (`watch` writes JSON Lines). Exit codes are stable:
63
+ 0 success, 1 problem found, 2 invalid input, 3 connection problem (`reach`).
64
+ - Automatic nameserver choice. The fastest working system DNS server is picked and
65
+ remembered for 5 minutes, and only servers on connected adapters are used. Failed or slow
66
+ servers are reported under results. `--refresh` re-checks.
67
+ - A plain-English explanation and next step for every failure: NXDOMAIN, no records,
68
+ SERVFAIL, timeouts, no network, refused, and DNS to outside servers blocked by a VPN or
69
+ firewall.
70
+ - `--help` on every command, with examples and exit codes. `python -m dnskit` works like
71
+ `dnskit`.
72
+ - The [User Guide](https://github.com/gladkhumalo/dnskit/blob/main/docs/USER_GUIDE.md): every command, option and error message, plus
73
+ troubleshooting recipes.
74
+
75
+ [Unreleased]: https://github.com/gladkhumalo/dnskit/compare/v0.1.0...HEAD
76
+ [0.1.0]: https://github.com/gladkhumalo/dnskit/releases/tag/v0.1.0
dnskit-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Glad Khumalo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
dnskit-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,362 @@
1
+ Metadata-Version: 2.5
2
+ Name: dnskit
3
+ Version: 0.1.0
4
+ Summary: A command-line DNS troubleshooting toolkit that explains what it finds.
5
+ Project-URL: Homepage, https://github.com/gladkhumalo/dnskit
6
+ Project-URL: Documentation, https://github.com/gladkhumalo/dnskit/blob/main/docs/USER_GUIDE.md
7
+ Project-URL: Issues, https://github.com/gladkhumalo/dnskit/issues
8
+ Project-URL: Changelog, https://github.com/gladkhumalo/dnskit/blob/main/CHANGELOG.md
9
+ Project-URL: Source, https://github.com/gladkhumalo/dnskit
10
+ Author: Glad Khumalo
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: cli,dkim,dmarc,dns,dnssec,network,spf,troubleshooting
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Information Technology
17
+ Classifier: Intended Audience :: System Administrators
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Internet :: Name Service (DNS)
26
+ Classifier: Topic :: System :: Networking :: Monitoring
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.11
29
+ Requires-Dist: dnspython[dnssec]>=2.6
30
+ Requires-Dist: rich>=13
31
+ Requires-Dist: typer>=0.12
32
+ Provides-Extra: dev
33
+ Requires-Dist: mypy>=1.11; extra == 'dev'
34
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
35
+ Requires-Dist: pytest>=8; extra == 'dev'
36
+ Requires-Dist: ruff>=0.6; extra == 'dev'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # dnskit
40
+
41
+ **Find out why DNS isn't working, in plain English.**
42
+
43
+ dnskit is a command-line DNS troubleshooting toolkit. It tells you why a name doesn't
44
+ resolve, why a site won't load or email doesn't arrive, and whether the problem is your
45
+ computer, your network or the domain itself. Every result comes with an explanation and a
46
+ suggested fix, not just raw records.
47
+
48
+ - **One-command health check** with a score and a ranked list of fixes (`doctor`)
49
+ - **Lookups, reverse lookups and comparisons** across public resolvers and your own
50
+ - **Email checks**: MX, SPF (with the 10-lookup limit), DMARC and DKIM
51
+ - **Your computer's DNS setup**: dead or "ghost" DNS servers, hosts-file overrides, NXDOMAIN
52
+ hijacking, intercepted DNS, broken IPv6, and the command to flush the cache
53
+ - **The full delegation chain** from the root servers (`trace`) and **DNSSEC** validation
54
+ - **Propagation** checks across 14 resolvers worldwide, and **watch** to see a change go live
55
+ - **For scripts**: `--json` on every command, `batch` for lists of domains, and a config file
56
+ - **VPN- and firewall-aware**: says so when DNS to outside servers is blocked, instead of
57
+ just timing out
58
+
59
+ Works on Windows, macOS and Linux. Built on [dnspython](https://www.dnspython.org/),
60
+ [Typer](https://typer.tiangolo.com/) and [Rich](https://rich.readthedocs.io/).
61
+
62
+ 📖 **[The dnskit User Guide](https://github.com/gladkhumalo/dnskit/blob/main/docs/USER_GUIDE.md)** covers every command and option, every
63
+ error message, and step-by-step recipes for common DNS problems.
64
+
65
+ ## Contents
66
+
67
+ - [Installation](#installation)
68
+ - [Quick start](#quick-start)
69
+ - [How DNS works, in one trace](#how-dns-works-in-one-trace)
70
+ - [Commands](#commands)
71
+ - [JSON, batch, watch and config](#json-batch-watch-and-config)
72
+ - [Exit codes](#exit-codes)
73
+ - [Contributing](#contributing)
74
+ - [License](#license)
75
+
76
+ ## Installation
77
+
78
+ dnskit needs **Python 3.11 or newer** (`python --version` to check).
79
+
80
+ **With pipx (recommended).** [pipx](https://pipx.pypa.io/) installs command-line tools in
81
+ their own environment and puts `dnskit` on your PATH, so it works from any terminal:
82
+
83
+ ```bash
84
+ pipx install dnskit
85
+ dnskit --help
86
+ ```
87
+
88
+ `pipx upgrade dnskit` moves to the newest release. For the latest code on `main` instead,
89
+ use `pipx install git+https://github.com/gladkhumalo/dnskit.git`.
90
+
91
+ **With pip, in a virtual environment:**
92
+
93
+ ```bash
94
+ python -m venv .venv
95
+ .venv\Scripts\activate # Windows
96
+ # source .venv/bin/activate # macOS / Linux
97
+ pip install dnskit
98
+ dnskit --help
99
+ ```
100
+
101
+ The `dnskit` command then works whenever the virtual environment is active. See the
102
+ [changelog](https://github.com/gladkhumalo/dnskit/blob/main/CHANGELOG.md) for what's in
103
+ each release.
104
+
105
+ ## Quick start
106
+
107
+ The screenshots below are real runs against the reserved example domains, on a demo
108
+ computer whose DNS servers are 1.1.1.1 and 8.8.8.8
109
+ ([scripts/readme_screenshots.py](https://github.com/gladkhumalo/dnskit/blob/main/scripts/readme_screenshots.py) regenerates them).
110
+
111
+ Not sure where a problem is? Start with `doctor`. It checks your computer's DNS setup and
112
+ the domain (records, the connection, email and DNSSEC) at the same time, and ranks what it
113
+ finds:
114
+
115
+ ![dnskit doctor example.com: a health score of 95/100 and one minor email issue](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/doctor.svg)
116
+
117
+ It separates problems with **this computer** from problems with **the domain**, and lists
118
+ notes (things worth knowing, with nothing to fix) separately. From there:
119
+
120
+ - `dnskit lookup example.com` to see the records themselves
121
+ - `dnskit reach example.com` when a site won't load: is it DNS or the connection?
122
+ - `dnskit local` when everything is slow or broken on one computer
123
+ - `dnskit <command> --help` for any command's options, examples and exit codes
124
+
125
+ ## How DNS works, in one trace
126
+
127
+ Nobody has the whole DNS: it's a tree of servers, each responsible for one level of
128
+ names. To find `example.com`, a resolver (your DNS server, or 8.8.8.8) asks its way down
129
+ the tree. `dnskit trace` does exactly that, one step at a time, and shows each step:
130
+
131
+ ![dnskit trace example.com: from the root servers, to the com. servers, to example.com's nameservers](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/trace.svg)
132
+
133
+ 1. **The root servers** (`.`) don't know `example.com`, but they know who runs `com.`.
134
+ They *refer* the question to the `com.` servers. There are 13 root server names,
135
+ hard-coded into every resolver; that's where every lookup starts.
136
+ 2. **The `com.` servers** don't know the address either, but they know which nameservers
137
+ the domain's owner chose at the registrar: here `elliott` and `hera.ns.cloudflare.com`.
138
+ This list is the domain's **delegation**.
139
+ 3. **The domain's own nameservers** are *authoritative* for `example.com`: they hold its
140
+ records and give the final answer.
141
+
142
+ A resolver then caches the answer for its **TTL** (time to live, in seconds), so the next
143
+ lookup skips the whole walk. That's also why a changed record takes a while to reach
144
+ everyone: resolvers keep serving the old answer until its TTL runs out.
145
+
146
+ When a domain fails for everyone, the trace shows which level breaks. For example, the
147
+ `com.` servers saying "no such domain" means it isn't registered (or expired). A
148
+ nameserver that doesn't answer means the DNS host is down. A *lame delegation* means the
149
+ registrar points at nameservers that don't serve the domain.
150
+
151
+ ## Commands
152
+
153
+ | Command | What it answers |
154
+ |---|---|
155
+ | [`doctor`](#quick-start) | Is everything OK? A score and a ranked list of fixes. |
156
+ | [`lookup`](#lookup) | What records does this name have? |
157
+ | [`reverse`](#reverse) | Whose is this IP address? |
158
+ | [`compare`](#compare) | Do public resolvers and mine give the same answer? |
159
+ | [`email`](#email) | Is the domain's email set up right (MX, SPF, DMARC, DKIM)? |
160
+ | [`local`](#local) | Is this computer's DNS setup healthy? |
161
+ | [`resolvers`](#resolvers) | Which of my DNS servers answer, and how fast? |
162
+ | [`reach`](#reach) | A site won't load: is it DNS or the connection? |
163
+ | [`trace`](#how-dns-works-in-one-trace) | Where in the delegation does a domain break? |
164
+ | [`dnssec`](#dnssec) | Is DNSSEC on, and does it validate? |
165
+ | [`propagation`](#propagation) | Has my change reached resolvers worldwide? |
166
+ | [`batch`](#batch) | Check a whole list of domains. |
167
+ | [`watch`](#watch) | Tell me when the answer changes. |
168
+ | [`config`](#config) | My default settings and resolvers. |
169
+
170
+ ### lookup
171
+
172
+ Looks up A, AAAA, MX, CNAME, NS and TXT at once, through the fastest of your DNS servers
173
+ (`--type` for one type, `--server` to ask a specific server):
174
+
175
+ ![dnskit lookup example.com: A, AAAA, MX, CNAME, NS and TXT records in one table](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/lookup.svg)
176
+
177
+ When a lookup fails, a panel says why ("Domain doesn't exist", "Query timed out", …) and
178
+ what to try next.
179
+
180
+ ![dnskit lookup does-not-exist.example: a panel explaining that the domain doesn't exist](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/lookup-missing.svg)
181
+
182
+ ### reverse
183
+
184
+ Finds the hostname for an IPv4 or IPv6 address (its PTR record), for an unknown address in
185
+ a log or to check a mail server's reverse name:
186
+
187
+ ![dnskit reverse 8.8.8.8: the hostname dns.google.](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/reverse.svg)
188
+
189
+ ### compare
190
+
191
+ Asks Google, Cloudflare, Quad9 and each of your own DNS servers the same question, and
192
+ marks any that disagree. Useful when a site works on one network but not another:
193
+
194
+ ![dnskit compare example.com: Google, Cloudflare and Quad9 all agree](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/compare.svg)
195
+
196
+ ### email
197
+
198
+ Checks where mail is delivered (MX), who may send it (SPF), what receivers do with forged
199
+ mail (DMARC), and the signing keys (DKIM), each as pass, warn or fail with a fix:
200
+
201
+ <details>
202
+ <summary><code>$ dnskit email example.com</code></summary>
203
+
204
+ ![dnskit email example.com: MX, SPF, DMARC and DKIM checks with a summary](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/email.svg)
205
+
206
+ </details>
207
+
208
+ ### local
209
+
210
+ Checks this computer: every network adapter and its DNS servers, servers that are dead,
211
+ slow or "ghosts" (left in the configuration by an old adapter or VPN), hosts-file entries
212
+ that override DNS, NXDOMAIN hijacking, interception by the network, and IPv6. It ends with
213
+ the problems found and the command to flush the DNS cache:
214
+
215
+ <details>
216
+ <summary><code>$ dnskit local</code></summary>
217
+
218
+ ![dnskit local: adapters, DNS servers, network checks and the flush command](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/local.svg)
219
+
220
+ </details>
221
+
222
+ ### resolvers
223
+
224
+ Tests each DNS server this computer uses and marks the one dnskit uses (the fastest). The
225
+ choice is remembered for 5 minutes, so commands don't each wait for a dead server:
226
+
227
+ ![dnskit resolvers: each DNS server's response time, and the one in use](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/resolvers.svg)
228
+
229
+ ### reach
230
+
231
+ "The website won't load": looks the name up, connects to port 443 (or `--port`) on each
232
+ address, and says whether the problem is DNS, the connection, or neither:
233
+
234
+ ![dnskit reach example.com: DNS and the connection both work](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/reach.svg)
235
+
236
+ ### dnssec
237
+
238
+ Checks every link of the DNSSEC chain of trust from the root down, verifies the signatures
239
+ itself, and warns when this computer's clock is wrong (which breaks validation):
240
+
241
+ <details>
242
+ <summary><code>$ dnskit dnssec example.com</code></summary>
243
+
244
+ ![dnskit dnssec example.com: every link of the chain of trust validates](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/dnssec.svg)
245
+
246
+ </details>
247
+
248
+ ### propagation
249
+
250
+ After changing a record: asks 14 public resolvers (global anycast ones, plus ones in fixed
251
+ countries) and shows what share give the same answer. It tells a change still spreading
252
+ apart from a CDN's location-based answers:
253
+
254
+ <details>
255
+ <summary><code>$ dnskit propagation example.com</code></summary>
256
+
257
+ ![dnskit propagation example.com: 14 resolvers worldwide, one differing by location](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/propagation.svg)
258
+
259
+ </details>
260
+
261
+ ## JSON, batch, watch and config
262
+
263
+ ### JSON
264
+
265
+ Every command takes `--json` and prints one JSON object instead of the report, with the
266
+ same exit code: `command`, `exit_code`, a short `summary`, the plain-English `diagnosis`,
267
+ and the full `report`. Timings are milliseconds, dates ISO 8601. For example, only the
268
+ summary and diagnosis of a `reach`:
269
+
270
+ ```text
271
+ $ dnskit reach example.com --json (summary and diagnosis only)
272
+ {
273
+ "summary": {
274
+ "verdict": "reachable"
275
+ },
276
+ "diagnosis": {
277
+ "title": "Neither: DNS and the connection both work",
278
+ "explanation": "example.com resolved to 4 addresses, and 104.20.23.154 accepted a connection on port 443 in 19 ms.",
279
+ "suggestion": "If the site still doesn't load, the problem is past the connection: the web server, its certificate, or the browser. Try another browser or a private window, and flush the DNS cache (dnskit local shows the command)."
280
+ }
281
+ }
282
+ ```
283
+
284
+ ```powershell
285
+ $result = dnskit doctor example.com --quick --json | ConvertFrom-Json
286
+ if ($result.summary.score -lt 90) { "example.com: $($result.diagnosis.title)" }
287
+ ```
288
+
289
+ ### batch
290
+
291
+ Runs `lookup`, `doctor` or `email` on every domain in a text file (one per line, `#`
292
+ comments allowed, `-` for standard input), a few at a time, and ends with a summary. For this `domains.txt`:
293
+
294
+ ```text
295
+ # Our domains
296
+ example.com
297
+ example.org
298
+ https://www.example.net/
299
+ does-not-exist.example # a typo
300
+ not a domain
301
+ ```
302
+
303
+ ![dnskit batch domains.txt --check doctor --quick: three domains OK, one that doesn't exist, one line skipped](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/batch.svg)
304
+
305
+ ### watch
306
+
307
+ Re-checks a record every few seconds (30 by default) and beeps when the answer changes.
308
+ `--until` stops as soon as the new value is live. Answers that only rotate between
309
+ addresses already seen (a CDN) say "rotating (CDN)" instead of "CHANGED":
310
+
311
+ ![dnskit watch example.com: three checks, the answer unchanged](https://raw.githubusercontent.com/gladkhumalo/dnskit/main/docs/images/watch.svg)
312
+
313
+ ```bash
314
+ dnskit watch example.com --until 203.0.113.80 --interval 60
315
+ ```
316
+
317
+ ### config
318
+
319
+ An optional TOML file sets each command's defaults and can replace the resolvers that
320
+ `compare` and `propagation` ask. The command line always wins. `dnskit config --init`
321
+ creates a commented starter file, and `dnskit config` shows where it is and what it sets:
322
+
323
+ ```toml
324
+ [defaults]
325
+ server = "1.1.1.1" # ask this DNS server instead of choosing the fastest
326
+
327
+ [doctor]
328
+ quick = true
329
+
330
+ [compare]
331
+ resolvers = [
332
+ { name = "Google", address = "8.8.8.8" },
333
+ { name = "Office DNS", address = "10.0.0.53" },
334
+ ]
335
+ ```
336
+
337
+ The file is `%APPDATA%\dnskit\config.toml` on Windows and `~/.config/dnskit/config.toml`
338
+ elsewhere; set `DNSKIT_CONFIG` to use another.
339
+
340
+ ## Exit codes
341
+
342
+ | Code | Meaning |
343
+ |---|---|
344
+ | `0` | Success: the name exists, the check passed, everything agrees. |
345
+ | `1` | A problem was found: the lookup failed, a check failed, resolvers disagree. |
346
+ | `2` | Invalid input: not a domain, an unknown record type, a broken config file. |
347
+ | `3` | `reach` only: DNS works but the connection doesn't. |
348
+ | `130` | `watch` only: stopped with Ctrl+C. |
349
+
350
+ Each command's `--help` lists its own exit codes, and the guide has
351
+ [the full list](https://github.com/gladkhumalo/dnskit/blob/main/docs/USER_GUIDE.md#10-using-dnskit-in-scripts).
352
+
353
+ ## Contributing
354
+
355
+ Bug reports and pull requests are welcome. See [CONTRIBUTING.md](https://github.com/gladkhumalo/dnskit/blob/main/CONTRIBUTING.md) for
356
+ setting up a development environment, the architecture, and how changes are tested.
357
+
358
+ ## License
359
+
360
+ dnskit is released under the [MIT License](https://github.com/gladkhumalo/dnskit/blob/main/LICENSE): you may use, change and share it,
361
+ including commercially, as long as the copyright notice comes along. It comes with no
362
+ warranty.