Coder Social home page Coder Social logo

retryabledns's Introduction

Retryable dns resolver

Based on miekg/dns and freely inspired by bogdanovich/dns_resolver.

Features

  • Supports system default resolvers along with user supplied ones
  • Retries dns requests in case of I/O, Time, Network failures
  • Allows arbitrary query types
  • Resolution with random resolvers

Using go get

$ go get github.com/projectdiscovery/retryabledns

After this command retryabledns library source will be in your $GOPATH

Example

Usage Example:

package main

import (
    "log"

    "github.com/projectdiscovery/retryabledns"
    "github.com/miekg/dns"
)

func main() {
    // it requires a list of resolvers
    resolvers := []string{"8.8.8.8:53", "8.8.4.4:53"}
    retries := 2
    hostname := "hackerone.com"
    dnsClient := retryabledns.New(resolvers, retries)

    ips, err := dnsClient.Resolve(hostname)
    if err != nil {
        log.Fatal(err)
    }

    log.Println(ips)

    // Query Types: dns.TypeA, dns.TypeNS, dns.TypeCNAME, dns.TypeSOA, dns.TypePTR, dns.TypeMX, dns.TypeANY
    // dns.TypeTXT, dns.TypeAAAA, dns.TypeSRV (from github.com/miekg/dns)
    dnsResponses, err := dnsClient.Query(hostname, dns.TypeA)
    if err != nil {
        log.Fatal(err)
    }

    log.Println(dnsResponses)
}

Credits:

retryabledns's People

Contributors

mzack9999 avatar dependabot[bot] avatar ehsandeep avatar ice3man543 avatar xm1k3 avatar seeyarh avatar ehrishirajsharma avatar luitelsamikshya avatar edoardottt avatar 003random avatar ahmadkashif avatar foxcores avatar sausagenoods avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.