You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/HauptJ/Golang-API-DNS

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/HauptJ/Golang-API-DNS

v0.0.0-20240517010930-e396699b73a3
Source
Go
Version published
Created
Source

Golang-API-DNS

Build Status

A simple Golang REST API for DNS queries.

To Build and Run:

  • NOTE: Port 8080 or the one specified in main.go must be available.
  • Install Golang if you want to run the API on your host machine.
  • Install Golang dependencies if you want to run the API on your host machine. If you wish to run the API in a Docker container, you can skip this step.
  • go get -u github.com/gorilla/mux
  • go get -u github.com/google/go-cmp/cmp
  • go get -u github.com/HauptJ/Golang-API-DNS/MXLookup
  • go get -u github.com/HauptJ/Golang-API-DNS/AddrLookup
  • go get -u github.com/HauptJ/Golang-API-DNS/CNAMELookup
  • go get -u github.com/HauptJ/Golang-API-DNS/HostLookup
  • To run on host system
  • go build main.go
  • ./main or .\main.exe

Docker

To Build and Run:

NOTE 1: Port 8880 or the one specified in docker-compose.yml and main.go must be available.
NOTE 2: On Windows 10 Pro or greater? You can use Chocolatey to install Docker Desktop for Windows and everything else listed below.

Install Docker and Docker Compose.

Docker
    Chocolatey for Windows
Docker Compose
    Chocolatey for Windows

Build and Run the container:
    docker-compose build
    docker-compose up

To stop
    docker-compose down

Endpoints:

/mx

  • TYPE: GET
  • Returns the list of MX records for the specified host
  • /mx/{host}
  • Example: /mx/hauptj.com
  • Returns:
[
    {
        "Host": "string",
        "Pref": int
    },
...
]
  • Example:
[
    {
        "Host": "aspmx.l.google.com.",
        "Pref": 10
    },
    {
        "Host": "alt1.aspmx.l.google.com.",
        "Pref": 20
    },
    {
        "Host": "alt2.aspmx.l.google.com.",
        "Pref": 30
    },
    {
        "Host": "alt3.aspmx.l.google.com.",
        "Pref": 40
    },
    {
        "Host": "alt4.aspmx.l.google.com.",
        "Pref": 50
    }
]

/addr

  • TYPE: GET
  • Returns a the hostname assigned to an IP address
  • /addr/{host}
  • Example: /addr/1.1.1.1
  • Returns: [ "string" ]
  • Example:
[
    "one.one.one.one."
]

/cname

  • TYPE: GET
  • Returns the cname record for the specified host
  • Example: /cname/research.swtch.com
  • Returns: string
  • Example:
"ghs.google.com."

/host

  • TYPE: GET
  • Returns the A and AAAA records for a given host
  • Example: /host/localhost
  • Returns:
[
    "string",
    "string"
]
  • Example:
[
    "::1",
    "127.0.0.1"
]

TODO:

  • Fix Rest endpoint test for MX endpoint.
  • Implement Rest endpoint tests for the other endpoints.
  • Implement, IP, NX, SRV, and TXT endpoints.
  • Swagger Docs

FAQs

Package last updated on 17 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts