view

package
v0.0.0-...-51f3d04 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTabWriter

func NewTabWriter(w io.Writer, debug bool) *tabwriter.Writer

NewTabWriter initializes and returns a new tabwriter.Writer. ZNS uses this writer to format DNS records into a clear, human-readable table. See https://pkg.go.dev/text/tabwriter#Writer.Init for details.

Types

type HumanRenderer

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

HumanRenderer for writing human-readable output.

func NewHumanRenderer

func NewHumanRenderer(view *View) *HumanRenderer

NewHumanRenderer creates a HumanRenderer with a "human" view bound to an output stream.

func (*HumanRenderer) Render

func (v *HumanRenderer) Render(domain string, record dns.RR)

Render renders a DNS record in human-readable format to the output stream.

type JSONRenderer

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

JSONRenderer for rendering JSON output.

func NewJSONRenderer

func NewJSONRenderer(view *JSONView) *JSONRenderer

NewJSONRenderer creates a JSONRenderer with a JSONView bound to an output stream.

func (*JSONRenderer) Render

func (v *JSONRenderer) Render(domain string, record dns.RR)

Render renders a DNS record in JSON format to the output stream.

type JSONView

type JSONView struct {
	View
	// contains filtered or unexported fields
}

func NewJSONView

func NewJSONView(view *View) *JSONView

func (*JSONView) Output

func (v *JSONView) Output(message string, params ...any)

type Renderer

type Renderer interface {
	Render(domain string, record dns.RR)
}

Renderer interface with a unified Render method.

func NewRenderer

func NewRenderer(vt arguments.ViewType, view *View) Renderer

type Stream

type Stream struct {
	Writer io.Writer
}

func (*Stream) Write

func (s *Stream) Write(p []byte) (n int, err error)

type View

type View struct {
	Stream *Stream
}

func NewView

func NewView(w io.Writer) *View

Jump to

Keyboard shortcuts

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