New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
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
  • Socket score

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.
  1. Install Golang if you want to run the API on your host machine.
  1. 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
  1. To run on host system
  2. go build main.go
  3. ./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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc