dnsyo

package
v0.0.0-...-841ec6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Query

type Query struct {
	Results QueryResults
	Domain  string
	Type    uint16
}

Query represents a lookup of Type for a given Domain and stores the Results for later processing

func (*Query) GetType

func (q *Query) GetType() string

GetType looks up the current Query's uint16 Type and returns the string representation of it from the miekg/dns library.

func (*Query) SetType

func (q *Query) SetType(recordType string) error

SetType converts a string representation of a query type to the internal uint16. This is then set on the current Query. An error is returned if the type cannot be found in the miekg/dns library.

func (*Query) ToTextSummary

func (q *Query) ToTextSummary() (text string)

ToTextSummary prints a human readable output of the current query's results for use in the CLI.

type QueryResults

type QueryResults map[string]*Result

QueryResults maps servers by name to the results they provide so a more detailed response can be given.

func (*QueryResults) ToJSON

func (qr *QueryResults) ToJSON() (string, error)

ToJSON prints a verbose JSON representation of the current QueryResults object

type Result

type Result struct {
	Answer string
	Error  string `json:",omitempty"`
}

Result contains an answer or error from a single server

type Server

type Server struct {
	IP      string
	Country string
	Name    string
}

Server contains information about a specific nameserver that can be queried

func (*Server) Lookup

func (s *Server) Lookup(name string, recordType uint16) (results []string, err error)

Lookup makes a request for a given domain name and record type to the current server IP on the standard port 53.

Results are returned as either a slice of strings representing the IPs returned, or an error object with a simplified error response.

func (*Server) String

func (s *Server) String() string

Returns either the current server name or the IP address if a name is not available.

func (*Server) Test

func (s *Server) Test() (ok bool, err error)

Test checks that the server can be reached and is returning results for three common domains that should be widely available.

It does not verify that the results returned are correct and not being squatted.

type ServerList

type ServerList []Server

ServerList is an alias for a slice of Server objects used for performing bulk actions on multiple threads

func ServersFromCSVURL

func ServersFromCSVURL(url string) (sl ServerList, err error)

ServersFromCSVURL loads a ServerList from a CSV provided at a given URL. Designed for use with public-info.dns

func ServersFromFile

func ServersFromFile(filename string) (sl ServerList, err error)

ServersFromFile loads a ServerList from a YAML file. Will raise an error if the file cannot be opened or processed

func (*ServerList) DumpToFile

func (sl *ServerList) DumpToFile(filename string) (err error)

DumpToFile a the current server list to a YAML file. Includes a commented header to identify the fact it is generated.

func (*ServerList) ExecuteQuery

func (sl *ServerList) ExecuteQuery(q *Query, threads int) (qr QueryResults)

ExecuteQuery runs a Query object in a specified number of threads. The returned QueryResult is not associated with the provided Query, however may be set by the caller.

func (*ServerList) FilterCountry

func (sl *ServerList) FilterCountry(country string) (fl ServerList, err error)

FilterCountry filters the current server list by country and returns a new server list with the matching servers in it. Returns an error if no servers were found.

func (*ServerList) NRandom

func (sl *ServerList) NRandom(n int) (rl ServerList, err error)

NRandom returns n random servers from the current server list in a new list. Will return an error if there are less than n servers in the current list.

func (*ServerList) TestAll

func (sl *ServerList) TestAll(threads int) (working ServerList)

TestAll tests all the servers in the current list and returns a new list with only the workings ones.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL