dug 0.6.0

An exhaustive name resolution aggregator
## Examples


### Table output

```
$ dug wikipedia.org www.kame.net

┌wikipedia.org───────────┬────────────────────┐
│ Cloudflare 443/https   │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ Cloudflare 53/udp      │ 2620:0:863:ed1a::1 │
│                        │ 198.35.26.96       │
├────────────────────────┼────────────────────┤
│ Cloudflare 853/tls     │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ Google 443/https       │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ Google 53/udp          │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ Google 853/tls         │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ Quad9 443/https        │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ Quad9 53/udp           │ 2620:0:863:ed1a::1 │
│                        │ 198.35.26.96       │
├────────────────────────┼────────────────────┤
│ Quad9 853/tls          │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ dig                    │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ drill                  │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ nslookup               │ 198.35.26.96       │
├────────────────────────┼────────────────────┤
│ resolv.conf[10.77.0.1] │ 198.35.26.96       │
│                        │ 2620:0:863:ed1a::1 │
├────────────────────────┼────────────────────┤
│ system                 │ 198.35.26.96       │
└────────────────────────┴────────────────────┘
┌www.kame.net────────────┬────────────────────────────────────┐
│ Cloudflare 443/https   │ 2001:2f0:0:8800::1:1               │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 210.155.141.200                    │
├────────────────────────┼────────────────────────────────────┤
│ Cloudflare 53/udp      │ 210.155.141.200                    │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 2001:2f0:0:8800::1:1               │
├────────────────────────┼────────────────────────────────────┤
│ Cloudflare 853/tls     │ 210.155.141.200                    │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 2001:2f0:0:8800::1:1               │
├────────────────────────┼────────────────────────────────────┤
│ Google 443/https       │ 210.155.141.200                    │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 2001:2f0:0:8800::1:1               │
├────────────────────────┼────────────────────────────────────┤
│ Google 53/udp          │ 2001:2f0:0:8800::1:1               │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 210.155.141.200                    │
├────────────────────────┼────────────────────────────────────┤
│ Google 853/tls         │ 210.155.141.200                    │
│                        │ 2001:2f0:0:8800::1:1               │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
├────────────────────────┼────────────────────────────────────┤
│ Quad9 443/https        │ 210.155.141.200                    │
│                        │ 2001:2f0:0:8800::1:1               │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
├────────────────────────┼────────────────────────────────────┤
│ Quad9 53/udp           │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 2001:2f0:0:8800::1:1               │
│                        │ 210.155.141.200                    │
├────────────────────────┼────────────────────────────────────┤
│ Quad9 853/tls          │ 2001:2f0:0:8800::1:1               │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 210.155.141.200                    │
├────────────────────────┼────────────────────────────────────┤
│ dig                    │ mango.itojun.org.                  │
│                        │ 210.155.141.200                    │
│                        │ mango.itojun.org.                  │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 2001:2f0:0:8800::1:1               │
├────────────────────────┼────────────────────────────────────┤
│ drill                  │ mango.itojun.org.                  │
│                        │ 210.155.141.200                    │
│                        │ mango.itojun.org.                  │
│                        │ 2001:2f0:0:8800::1:1               │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
├────────────────────────┼────────────────────────────────────┤
│ nslookup               │ 210.155.141.200                    │
├────────────────────────┼────────────────────────────────────┤
│ resolv.conf[10.77.0.1] │ 2001:2f0:0:8800::1:1               │
│                        │ 2001:2f0:0:8800:226:2dff:fe0b:4311 │
│                        │ 210.155.141.200                    │
├────────────────────────┼────────────────────────────────────┤
│ system                 │ 210.155.141.200                    │
└────────────────────────┴────────────────────────────────────┘
```

### JSON output

```
$ dug -j iccf-holland.org

[
  {
    "name": "iccf-holland.org",
    "source": "Google 53/udp",
    "records": [
      "185.104.29.172",
      "2a06:2ec0:1::169"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "Quad9 53/udp",
    "records": [
      "185.104.29.172",
      "2a06:2ec0:1::169"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "Quad9 443/https",
    "records": [
      "185.104.29.172",
      "2a06:2ec0:1::169"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "Cloudflare 53/udp",
    "records": [
      "2a06:2ec0:1::169",
      "185.104.29.172"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "Cloudflare 443/https",
    "records": [
      "2a06:2ec0:1::169",
      "185.104.29.172"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "Google 853/tls",
    "records": [
      "2a06:2ec0:1::169",
      "185.104.29.172"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "Quad9 853/tls",
    "records": [
      "185.104.29.172",
      "2a06:2ec0:1::169"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "Cloudflare 853/tls",
    "records": [
      "185.104.29.172",
      "2a06:2ec0:1::169"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "Google 443/https",
    "records": [
      "185.104.29.172",
      "2a06:2ec0:1::169"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "system",
    "records": [
      "185.104.29.172"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "nslookup",
    "records": [
      "185.104.29.172"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "resolv.conf[10.77.0.1]",
    "records": [
      "2a06:2ec0:1::169",
      "185.104.29.172"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "dig",
    "records": [
      "185.104.29.172",
      "2a06:2ec0:1::169"
    ]
  },
  {
    "name": "iccf-holland.org",
    "source": "drill",
    "records": [
      "185.104.29.172",
      "2a06:2ec0:1::169"
    ]
  }
]
```

### ASCII text output

```
$ dug -a wikipedia.org | sort -k2

wikipedia.org  198.35.26.96                          Cloudflare 443/https
wikipedia.org  198.35.26.96                          Cloudflare 53/udp
wikipedia.org  198.35.26.96                          Cloudflare 853/tls
wikipedia.org  198.35.26.96                          Google 443/https
wikipedia.org  198.35.26.96                          Google 53/udp
wikipedia.org  198.35.26.96                          Google 853/tls
wikipedia.org  198.35.26.96                          Quad9 443/https
wikipedia.org  198.35.26.96                          Quad9 53/udp
wikipedia.org  198.35.26.96                          Quad9 853/tls
wikipedia.org  198.35.26.96                          dig
wikipedia.org  198.35.26.96                          drill
wikipedia.org  198.35.26.96                          nslookup
wikipedia.org  198.35.26.96                          resolv.conf[10.77.0.1]
wikipedia.org  198.35.26.96                          system
wikipedia.org  2620:0:863:ed1a::1                    Cloudflare 443/https
wikipedia.org  2620:0:863:ed1a::1                    Cloudflare 53/udp
wikipedia.org  2620:0:863:ed1a::1                    Cloudflare 853/tls
wikipedia.org  2620:0:863:ed1a::1                    Google 443/https
wikipedia.org  2620:0:863:ed1a::1                    Google 53/udp
wikipedia.org  2620:0:863:ed1a::1                    Google 853/tls
wikipedia.org  2620:0:863:ed1a::1                    Quad9 443/https
wikipedia.org  2620:0:863:ed1a::1                    Quad9 53/udp
wikipedia.org  2620:0:863:ed1a::1                    Quad9 853/tls
wikipedia.org  2620:0:863:ed1a::1                    dig
wikipedia.org  2620:0:863:ed1a::1                    drill
wikipedia.org  2620:0:863:ed1a::1                    resolv.conf[10.77.0.1]
```

### Get only the Google DNS results for a set of hostnames

```
$ dug -j abc.com cbs.com nbc.com | jq -cr \
    'map(select(.source | contains("Google")))[] | "\(.name)\t\(.records | join(" "))"'

abc.com	18.155.202.44 18.155.202.58 18.155.202.108 18.155.202.100
cbs.com	100.28.104.175 98.83.184.133 54.157.108.158 2600:1f18:297:ba24:b508:76de:f4a:df34 2600:1f18:297:ba0e:7900:f622:48a8:f266 2600:1f18:297:ba18:6ddc:5d8f:6053:f003
nbc.com	23.44.229.217 23.44.229.205
```

### Extract only the resolved IPs with `jq`

```
$ dug -j google.com | jq -r 'map(select(.records).records) | flatten | unique | .[]'

142.250.189.174
142.251.32.46
142.251.46.174
142.251.46.238
2607:f8b0:4005:802::200e
2607:f8b0:4005:811::200e
2607:f8b0:4005:813::200e
```

This looks busy, but here's what `jq` is doing:
1. `map(...)`: for each result in the array...
2. `select(.records)`: select only objects where the `records` property is truthy (stripping `null`)
3. `.records`: ...and extract the `records` property from the selected objects
4. `flatten` the nested of arrays into a single array of all resolved IPs
5. `unique` removes all duplicate values
6. `.[]` converts the array into a sequence of strings, one per line
7. `-r` removes the quotation marks (`"`) from around the result strings