dnslib

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DnsAnswer     = iota
	DnsAuthority  = iota
	DnsAdditional = iota
)

Variables

View Source
var (
	Initializers = make(map[string]func())
	Marshalers   = make(map[string]func(*DnsSchema))
	Closers      = make(map[string]func())
)

Functions

func Close

func Close(format string)

func Initialize

func Initialize(format string)

Types

type DnsSchema

type DnsSchema struct {
	Sha256             string  `json:"sha256,omitempty"`
	Udp                bool    `json:"udp,omitempty"`
	Ipv                uint8   `json:"ipv,omitempty"`
	SourceAddress      string  `json:"src_address"`
	SourcePort         uint16  `json:"src_port"`
	DestinationAddress string  `json:"dst_address"`
	DestinationPort    uint16  `json:"dst_port"`
	Id                 uint16  `json:"id,omitempty"`
	Rcode              int     `json:"rcode,omitempty"`
	Truncated          bool    `json:"truncated,omitempty"`
	Response           bool    `json:"response,omitempty"`
	RecursionDesired   bool    `json:"recursion_desired,omitempty"`
	Answer             bool    `json:"answer,omitempty"`
	Authority          bool    `json:"authority,omitempty"`
	Additional         bool    `json:"additional,omitempty"`
	Qname              string  `json:"qname,omitempty"`
	Qtype              uint16  `json:"qtype,omitempty"`
	Ttl                *uint32 `json:"ttl,omitempty"`
	Rname              *string `json:"rname,omitempty"`
	Rtype              *uint16 `json:"rtype,omitempty"`
	Rdata              *string `json:"rdata,omitempty"`
	EcsClient          *string `json:"ecs_client,omitempty"`
	EcsSource          *uint8  `json:"ecs_source,omitempty"`
	EcsScope           *uint8  `json:"ecs_scope,omitempty"`
	Source             string  `json:"source,omitempty"`
	Sensor             string  `json:"sensor,omitempty"`
}

JSON serialization only supports nullifying types that can accept nil. The ECS fields are pointers because they're nullable.

func (DnsSchema) Marshal

func (d DnsSchema) Marshal(rr *dns.RR, section int, format string)

type ParsePacketResult added in v0.2.0

type ParsePacketResult struct {
	Schema  *DnsSchema
	Msg     *dns.Msg
	Payload []byte
}

func ParsePacket added in v0.2.0

func ParsePacket(packet gopacket.Packet) (*ParsePacketResult, error)

Jump to

Keyboard shortcuts

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