Documentation
¶
Overview ¶
Package massdns provides a Resolver object used to invoke the massdns binary file.
The package contains a LineReader struct that implements the io.Reader interface. It is used to read strings line by line from an io.Reader while throttling the results according to a rate-limit specified. The LineReader is passed to the stdin of massdns, allowing it to approximately respect the number of DNS queries per second wanted.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotStarted = errors.New("not started")
ErrNotStarted is an error happening when the LineReader hasn't been started.
Functions ¶
This section is empty.
Types ¶
type DefaultWriteCallback ¶
type DefaultWriteCallback struct {
// contains filtered or unexported fields
}
DefaultWriteCallback is a callback that can save massdns results to files. It can save the valid domains found and the massdns results that gave valid domains.
func NewDefaultWriteCallback ¶
func NewDefaultWriteCallback(massdnsFilename string, domainFilename string) (*DefaultWriteCallback, error)
NewDefaultWriteCallback creates a new DefaultWriteCallback. The file names can be empty to disable saving to a file.
func (*DefaultWriteCallback) Callback ¶
func (c *DefaultWriteCallback) Callback(line string) error
Callback reads a line from the massdns stdout handler, parses the output and saves the relevant data.
func (*DefaultWriteCallback) Close ¶
func (c *DefaultWriteCallback) Close()
Close closes the writers.
type JSONRecord ¶
type JSONRecord struct { TTL int `json:"ttl"` Type string `json:"type"` Class string `json:"class"` Name string `json:"name"` Data string `json:"data"` }
JSONRecord contains a record from a massdns output file.
type JSONResponse ¶
type JSONResponse struct { Name string `json:"name"` Type string `json:"type"` Class string `json:"class"` Status string `json:"status"` Data JSONResponseData `json:"data"` Resolver string `json:"resolver"` }
JSONResponse contains the response from a massdns output file.
type JSONResponseData ¶
type JSONResponseData struct { Answers []JSONRecord `json:"answers"` Authorities []JSONRecord `json:"authorities"` Additionals []JSONRecord `json:"additionals"` }
JSONResponseData contains the response data from a massdns output file.
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
LineReader is a line reader that limits the number of line per second read.
func NewLineReader ¶
func NewLineReader(r io.Reader, rate int) *LineReader
NewLineReader creates a new RateLimitLineReader.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver uses massdns to resolve a batch of domain names.
type StdoutHandler ¶
type StdoutHandler struct {
// contains filtered or unexported fields
}
StdoutHandler read complete lines from the massdns output and sends them one by one to the callback function.
func NewStdoutHandler ¶
func NewStdoutHandler(callback Callback) *StdoutHandler
NewStdoutHandler returns a new OutputHandler that can be used to receive massdns' stdout.