json

package
v0.0.0-...-bcd5820 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SerializeResult

func SerializeResult(result resolver.Result,
	writer io.Writer,
	writeRecordsToZone bool,
	writeMessages bool) error

Types

type Message

type Message struct {
	Id                   uint16
	RCode                int
	Opcode               int
	IsResponse           bool // Corresponds to the QR bit
	IsAuthoritative      bool // Corresponds to the AA bit
	IsTruncated          bool // Corresponds to the TC bit
	IsRecursionDesired   bool // Corresponds to the RD bit
	IsRecursionAvailable bool // Corresponds to the RA bit
	IsAuthenticatedData  bool // Corresponds to the AD bit (DNSSEC)
	IsCheckingDisabled   bool // Corresponds to the CD bit (DNSSEC)

	// Question contains the question as returned by the name server.
	Question   []ResourceRecord
	Answer     []ResourceRecord
	Authority  []ResourceRecord
	Additional []ResourceRecord

	// OriginalBytes bytes of the message to restore it on deserialization.
	// This is the downside of working with the wire format of miekg dns, we can't really
	// serialize/deserialize well unless we use pack()/unpack()
	OriginalBytes string
}

func (Message) MarshalEasyJSON

func (v Message) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Message) MarshalJSON

func (v Message) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Message) UnmarshalEasyJSON

func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Message) UnmarshalJSON

func (v *Message) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MessageExchange

type MessageExchange struct {
	OriginalQuestion model.Question
	ResponseAddr     string
	NameServerIP     netip.Addr
	Metadata         model.Metadata
	Message          *Message
	Error            *model.SendError
}

func (MessageExchange) MarshalEasyJSON

func (v MessageExchange) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MessageExchange) MarshalJSON

func (v MessageExchange) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MessageExchange) UnmarshalEasyJSON

func (v *MessageExchange) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MessageExchange) UnmarshalJSON

func (v *MessageExchange) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type NameServer

type NameServer struct {
	Name        string
	IPAddresses []netip.Addr
}

func (NameServer) MarshalEasyJSON

func (v NameServer) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (NameServer) MarshalJSON

func (v NameServer) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*NameServer) UnmarshalEasyJSON

func (v *NameServer) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*NameServer) UnmarshalJSON

func (v *NameServer) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Reader

type Reader struct {

	// If provided, sets the format of the files to read.
	// If nil, the format is auto-detected from the file extension.
	Zip *serialization.ZipAlgorithm
	// contains filtered or unexported fields
}

func NewReader

func NewReader(filePattern string, parallel bool) Reader

func (Reader) ReadTo

func (j Reader) ReadTo(outChan chan<- resolver.Result) error

type ResourceRecord

type ResourceRecord struct {
	Name  string
	Type  uint16
	Class uint16
	TTL   uint32
	Value string
}

ResourceRecord represents a DNS record

func (ResourceRecord) MarshalEasyJSON

func (v ResourceRecord) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ResourceRecord) MarshalJSON

func (v ResourceRecord) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ResourceRecord) UnmarshalEasyJSON

func (v *ResourceRecord) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ResourceRecord) UnmarshalJSON

func (v *ResourceRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TaggedDomain

type TaggedDomain struct {
	Idx  uint
	Name model.DomainName
	Tags string
}

func (TaggedDomain) MarshalEasyJSON

func (v TaggedDomain) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TaggedDomain) MarshalJSON

func (v TaggedDomain) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TaggedDomain) UnmarshalEasyJSON

func (v *TaggedDomain) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TaggedDomain) UnmarshalJSON

func (v *TaggedDomain) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WriteModel

type WriteModel struct {
	Domains   []TaggedDomain
	StartTime time.Time
	Duration  time.Duration
	Zonedata  Zone
	Messages  []MessageExchange
}

WriteModel defines the format that is written to the file.

func (WriteModel) MarshalEasyJSON

func (v WriteModel) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WriteModel) MarshalJSON

func (v WriteModel) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WriteModel) UnmarshalEasyJSON

func (v *WriteModel) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WriteModel) UnmarshalJSON

func (v *WriteModel) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Writer

type Writer struct {
	*serialization.FileWriterBase
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(outDir string, filePrefix string, outputFileSize uint, zipAlgo serialization.ZipAlgorithm, compression serialization.CompressionLevel, parallelFiles uint32) *Writer

func (*Writer) Wait

func (j *Writer) Wait() error

func (*Writer) WriteAsync

func (j *Writer) WriteAsync(result resolver.Result) (rtnErr error)

type Zone

type Zone struct {
	Name            string
	Subzones        []Zone
	NameServers     []NameServer
	ResourceRecords []string
}

func (Zone) MarshalEasyJSON

func (v Zone) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Zone) MarshalJSON

func (v Zone) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Zone) UnmarshalEasyJSON

func (v *Zone) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Zone) UnmarshalJSON

func (v *Zone) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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