https://github.com/monmohan/dns-trace
https://github.com/monmohan/dns-trace
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/monmohan/dns-trace
- Owner: monmohan
- License: apache-2.0
- Created: 2022-04-19T08:47:19.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-20T00:57:10.000Z (about 4 years ago)
- Last Synced: 2025-12-25T16:46:21.355Z (6 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dns-trace
A simple tool to recursively resolves IP for a given domain.
It always starts at the root server, traversing until the `A` record for the domain is found.
The tool also resolves if the domain has a CNAME record by applying the same logic to the CNAME target.
## Simple example
Note the "." in the end of the domain name i.e. Domain name should be [fully qualified](https://en.wikipedia.org/wiki/Fully_qualified_domain_name)
```go
$ go run trace.go www.google.com.
Resolving domain -> IP query for domain=www.google.com. with nameserver=199.9.14.201:53
NS = a.gtld-servers.net. NS IP = 192.5.6.30
Resolving domain -> IP query for domain=www.google.com. with nameserver=192.5.6.30:53
NS = ns2.google.com. NS IP = 216.239.34.10
Resolving domain -> IP query for domain=www.google.com. with nameserver=216.239.34.10:53
Go A record 74.125.24.103
Domain www.google.com. resolved to IP(V4) 74.125.24.103
```
## With CNAME Resolution
The below example has multiple CNAME mappings
```go
$ go run trace.go developer.api.autodesk.com.
Resolving domain -> IP query for domain=developer.api.autodesk.com. with nameserver=199.9.14.201:53
NS = a.gtld-servers.net. NS IP = 192.5.6.30
Resolving domain -> IP query for domain=developer.api.autodesk.com. with nameserver=192.5.6.30:53
NS = dns1.p05.nsone.net. NS IP = 157.53.234.1
Resolving domain -> IP query for domain=developer.api.autodesk.com. with nameserver=157.53.234.1:53
Looking for cname adsk-prod.apigee.net.
Resolving domain -> IP query for domain=adsk-prod.apigee.net. with nameserver=199.9.14.201:53
NS = a.gtld-servers.net. NS IP = 192.5.6.30
Resolving domain -> IP query for domain=adsk-prod.apigee.net. with nameserver=192.5.6.30:53
NS = ns-116.awsdns-14.com. NS IP = 205.251.194.158
Resolving domain -> IP query for domain=adsk-prod.apigee.net. with nameserver=205.251.194.158:53
Looking for cname adsk-00.dn.apigee.net.
Resolving domain -> IP query for domain=adsk-00.dn.apigee.net. with nameserver=199.9.14.201:53
NS = a.gtld-servers.net. NS IP = 192.5.6.30
Resolving domain -> IP query for domain=adsk-00.dn.apigee.net. with nameserver=192.5.6.30:53
NS = ns-116.awsdns-14.com. NS IP = 205.251.194.158
Resolving domain -> IP query for domain=adsk-00.dn.apigee.net. with nameserver=205.251.194.158:53
NS = ns-1346.awsdns-40.org.
NS IP not found, Run Query for: ns-1346.awsdns-40.org.
Resolving domain -> IP query for domain=ns-1346.awsdns-40.org. with nameserver=199.9.14.201:53
NS = a0.org.afilias-nst.info. NS IP = 199.19.54.1
Resolving domain -> IP query for domain=ns-1346.awsdns-40.org. with nameserver=199.19.54.1:53
NS = g-ns-1640.awsdns-40.org. NS IP = 205.251.192.168
Resolving domain -> IP query for domain=ns-1346.awsdns-40.org. with nameserver=205.251.192.168:53
Go A record 205.251.197.66
Resolving domain -> IP query for domain=adsk-00.dn.apigee.net. with nameserver=205.251.197.66:53
Go A record 54.171.246.133
Domain developer.api.autodesk.com. resolved to IP(V4) 54.171.246.133
```