output

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format added in v0.6.0

type Format int

Format selects how resolved results are rendered on stdout and in the output file.

const (
	// FormatText is the default human-friendly streaming output.
	FormatText Format = iota
	// FormatJSON buffers results and emits a single JSON array at completion.
	FormatJSON
	// FormatCSV streams "subdomain,type,value" rows with a header.
	//
	// Note: the JSON format buffers the whole document and therefore does not
	// stream like text and CSV do. If live JSON piping is ever needed, JSONL
	// (one JSON object per line) is the streaming-friendly alternative.
	FormatCSV
)

func ParseFormat added in v0.6.0

func ParseFormat(s string) (Format, error)

ParseFormat converts a flag string into a Format.

type Result added in v0.6.0

type Result struct {
	Subdomain string       `json:"subdomain"`
	Records   []dns.Record `json:"records"`
}

Result is one resolved subdomain and its records, used for structured output.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer synchronises all output. Results go to stdout (and optionally a file); everything else (progress, verbose, errors) goes to stderr.

func New

func New(outWriter *bufio.Writer, simulate bool, format Format) *Writer

New returns a Writer. If outWriter is non-nil, resolved domains are also written there. Set simulate to true to tag text result lines as simulated.

func (*Writer) Error

func (w *Writer) Error(format string, a ...any)

Error writes an error line to stderr.

func (*Writer) Finish added in v0.6.0

func (w *Writer) Finish()

Finish flushes any buffered or streamed structured output. It must be called once after the scan completes (before the output file is flushed and closed).

func (*Writer) Info

func (w *Writer) Info(format string, a ...any)

Info writes an informational line to stderr.

func (*Writer) Progress

func (w *Writer) Progress(pct float64, processed, total, found int64)

Progress writes a progress line to stderr using carriage-return overwrite.

func (*Writer) ProgressDone

func (w *Writer) ProgressDone()

ProgressDone writes the final newline on stderr after progress reporting ends.

func (*Writer) Result

func (w *Writer) Result(domain string, records []dns.Record)

Result records a resolved domain. In text mode it prints immediately; in JSON mode it is buffered for Finish; in CSV mode rows are streamed.

Jump to

Keyboard shortcuts

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