V-H-R-Oliveira / dns-client

A simple DNS client written in Golang that parcial implements the RFC 1035.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DNS Lookup

A simple client software for the DNS protocol.

Supported Features

  • Reverse DNS Queries.
  • Standard DNS Queries.
  • Support both Ipv4 and Ipv6 protocol.
  • Multiple inputs in a domain form or in an ip form.

How it works

Given an input domain or an input ip, the program will query the google DNS server and it will output all the IPs and domains that belongs to the requested input in JSON. Please, see this section.

It does all this stuff using only the golang standard library and using the DNS protocol specification available in rfc 1035 and microsoft documentation

Usage example

Basic execution: go run ./main.go 2001:4860:4860::8888 8.8.4.4 google.com microsoft.com cloudflare.com facebook.com

You can build a binary using the follow command: go build -o <some name> main.go and execute with ./<binary-name> 2001:4860:4860::8888 8.8.4.4 google.com

Output Example

Standard DNS Query:

{
  "header": {
    "id": 59981,
    "questions": 1,
    "answers": 1,
  },
  "answers": [
    {
      "metadata": {
        "domain": "google.com",
        "type": 1,
        "class": 1,
        "ttl": 20,
        "length": 4
      },
      "resource": "142.250.218.238"
    }
  ],
  "name_servers": null
}

Reverse DNS Query:

{
  "header": {
    "id": 44802,
    "questions": 1,
    "answers": 1,
  },
  "answers": [
    {
      "metadata": {
        "domain": "4.4.8.8.in-addr.arpa",
        "type": 12,
        "class": 1,
        "ttl": 21189,
        "length": 12
      },
      "resource": "dns.google"
    }
  ],
  "name_servers": null
}

About

A simple DNS client written in Golang that parcial implements the RFC 1035.

License:Creative Commons Zero v1.0 Universal


Languages

Language:Go 100.0%