Skip to content

Commit

Permalink
feat: add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-karan committed Jul 1, 2024
1 parent 51e78c5 commit 24ec17e
Show file tree
Hide file tree
Showing 35 changed files with 4,928 additions and 105 deletions.
11 changes: 9 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
---
# Future Release

- [ ] Support obscure protocol tweaks in `dig`
- [x] Support obscure protocol tweaks in `dig`
- [x] Support more DNS Record Types
- [x] Shell completions
- [x] zsh
Expand All @@ -62,8 +62,15 @@
- [ ] Add tests for CLI Output.
- [x] Homebrew - Goreleaser
- [ ] Add support for `dig +trace` like functionality.
- [ ] Add `dig +short` short output
- [x] Add `dig +short` short output
- [x] Add `--strategy` for picking nameservers.
- [ ] Explore `dig.rc` kinda file
- [x] Separate Authority/Answer in JSON output.
- [x] Error on NXDomain (Related upstream [bug](https://github.com/miekg/dns/issues/1198))

- [x] Reverse Lookup (dig -x)
- [x] Shell completion proper
- CLI docs
- [ ] Helper util?
- Merge those as misc docs or usage
- [ ] Example Guide
22 changes: 9 additions & 13 deletions cmd/doggo/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,25 @@ _doggo() {
COMPREPLY=( $(compgen -W "IN CH HS" -- ${cur}) )
return 0
;;
-n|--nameserver)
COMPREPLY=( $(compgen -A hostname -- ${cur}) )
return 0
;;
--strategy)
COMPREPLY=( $(compgen -W "all random first" -- ${cur}) )
return 0
;;
--search|--color|--debug)
--search|--color)
COMPREPLY=( $(compgen -W "true false" -- ${cur}) )
return 0
;;
-n|--nameserver)
COMPREPLY=( $(compgen -W "1.1.1.1 8.8.8.8 9.9.9.9" -- ${cur}) )
return 0
;;
esac
if [[ ${cur} == -* ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
else
COMPREPLY=( $(compgen -A hostname -- ${cur}) )
fi
COMPREPLY=( $(compgen -A hostname -- ${cur}) )
}
complete -F _doggo doggo
Expand All @@ -63,7 +62,7 @@ _doggo() {
'(-h --help)'{-h,--help}'[Show list of command-line options]' \
'(-q --query)'{-q,--query}'[Hostname to query the DNS records for]:hostname:_hosts' \
'(-t --type)'{-t,--type}'[Type of the DNS Record]:record type:(A AAAA CAA CNAME HINFO MX NS PTR SOA SRV TXT)' \
'(-n --nameserver)'{-n,--nameserver}'[Address of a specific nameserver to send queries to]:nameserver:(1.1.1.1 8.8.8.8 9.9.9.9)' \
'(-n --nameserver)'{-n,--nameserver}'[Address of a specific nameserver to send queries to]:nameserver:_hosts' \
'(-c --class)'{-c,--class}'[Network class of the DNS record being queried]:network class:(IN CH HS)' \
'(-r --reverse)'{-r,--reverse}'[Performs a DNS Lookup for an IPv4 or IPv6 address]' \
'--strategy[Strategy to query nameserver listed in etc/resolv.conf]:strategy:(all random first)' \
Expand Down Expand Up @@ -110,7 +109,7 @@ complete -c doggo -n '__fish_doggo_no_subcommand' -l 'help' -d "Show list of
# Query options
complete -c doggo -n '__fish_doggo_no_subcommand' -s 'q' -l 'query' -d "Hostname to query the DNS records for" -x -a "(__fish_print_hostnames)"
complete -c doggo -n '__fish_doggo_no_subcommand' -s 't' -l 'type' -d "Type of the DNS Record" -x -a "A AAAA CAA CNAME HINFO MX NS PTR SOA SRV TXT"
complete -c doggo -n '__fish_doggo_no_subcommand' -s 'n' -l 'nameserver' -d "Address of a specific nameserver to send queries to" -x -a "1.1.1.1 8.8.8.8 9.9.9.9"
complete -c doggo -n '__fish_doggo_no_subcommand' -s 'n' -l 'nameserver' -d "Address of a specific nameserver to send queries to" -x -a "(__fish_print_hostnames)"
complete -c doggo -n '__fish_doggo_no_subcommand' -s 'c' -l 'class' -d "Network class of the DNS record being queried" -x -a "IN CH HS"
complete -c doggo -n '__fish_doggo_no_subcommand' -s 'r' -l 'reverse' -d "Performs a DNS Lookup for an IPv4 or IPv6 address"
Expand All @@ -129,9 +128,6 @@ complete -c doggo -n '__fish_doggo_no_subcommand' -l 'color' -d "Colored
complete -c doggo -n '__fish_doggo_no_subcommand' -l 'debug' -d "Enable debug logging"
complete -c doggo -n '__fish_doggo_no_subcommand' -l 'time' -d "Shows how long the response took from the server"
# Transport options
complete -c doggo -n '__fish_doggo_no_subcommand' -x -a "@udp:// @tcp:// @https:// @tls:// @sdns://" -d "Select the protocol for resolving queries"
# TLS options
complete -c doggo -n '__fish_doggo_no_subcommand' -l 'tls-hostname' -d "Hostname for certificate verification" -x -a "(__fish_print_hostnames)"
complete -c doggo -n '__fish_doggo_no_subcommand' -l 'skip-hostname-verification' -d "Skip TLS hostname verification in case of DoT lookups"
Expand Down
34 changes: 0 additions & 34 deletions completions/doggo.bash

This file was deleted.

28 changes: 0 additions & 28 deletions completions/doggo.fish

This file was deleted.

26 changes: 0 additions & 26 deletions completions/doggo.zsh

This file was deleted.

21 changes: 21 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
4 changes: 4 additions & 0 deletions docs/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions docs/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
54 changes: 54 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Starlight Starter Kit: Basics

[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)

```
npm create astro@latest -- --template starlight
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
## 🚀 Project Structure

Inside of your Astro + Starlight project, you'll see the following folders and files:

```
.
├── public/
├── src/
│ ├── assets/
│ ├── content/
│ │ ├── docs/
│ │ └── config.ts
│ └── env.d.ts
├── astro.config.mjs
├── package.json
└── tsconfig.json
```

Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.

Images can be added to `src/assets/` and embedded in Markdown with a relative link.

Static assets, like favicons, can be placed in the `public/` directory.

## 🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |

## 👀 Want to learn more?

Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
55 changes: 55 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import { defineConfig, passthroughImageService } from "astro/config";

// https://astro.build/config
export default defineConfig({
image: {
service: passthroughImageService(),
},
integrations: [
starlight({
title: 'Documentation',
social: {
github: 'https://github.com/mr-karan/doggo',
},
sidebar: [
{
label: 'Introduction',
items: [
{ label: 'Installation', link: '/intro/installation' },
],
},
{
label: 'Usage Guide',
items: [
{ label: 'Examples', link: '/guide/examples' },
{ label: 'CLI Reference', link: '/guide/reference' },
],
},
{
label: 'Resolvers',
items: [
{ label: 'Classic (UDP and TCP)', link: '/resolvers/classic' },
{ label: 'System', link: '/resolvers/system' },
{ label: 'DNS over HTTPS (DoH)', link: '/resolvers/doh' },
{ label: 'DNS over TLS (DoT)', link: '/resolvers/dot' },
{ label: 'DNSCrypt', link: '/resolvers/dnscrypt' },
{ label: 'DNS over HTTPS (DoQ)', link: '/resolvers/quic' },
],
},
{
label: 'Features',
items: [
{ label: 'Output Formats', link: '/features/output' },
{ label: 'Multiple Resolvers', link: '/features/multiple' },
{ label: 'IPv4 and IPv6', link: '/features/ip' },
{ label: 'Reverse IP Lookups', link: '/features/reverse' },
{ label: 'Protocol Tweaks', link: '/features/tweaks' },
{ label: 'Shell Completions', link: '/features/shell' },
],
},
],
}),
],
});
17 changes: 17 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "docs",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.24.4",
"astro": "^4.10.2",
"sharp": "^0.33.4"
}
}
1 change: 1 addition & 0 deletions docs/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/houston.webp
Binary file not shown.
6 changes: 6 additions & 0 deletions docs/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
};
Loading

0 comments on commit 24ec17e

Please sign in to comment.