dto

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	A    Type = 1
	AAAA Type = 28

	IN Class = 1

	STANDARD_QUERY    uint16 = 0x0100
	STANDARD_RESPONSE uint16 = 0x8180
)
View Source
const (
	BufferMaxLength = 255
)

Variables

This section is empty.

Functions

func SerializeMessage

func SerializeMessage(message Message) []byte

SerializeMessage serialize a DNS message into a binary representation

Types

type BufferTooLongException

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

BufferTooLongException error returned when the buffer is too long

func (*BufferTooLongException) Error

func (b *BufferTooLongException) Error() string

Error returns the string of the current error

type Class

type Class uint16

type Message

type Message struct {
	ID            uint16
	Header        uint16
	QuestionCount uint16
	ResponseCount uint16
	Question      []Question
	Response      []Record
}

Message represent a simplify dns message

func ParseMessage

func ParseMessage(packet []byte) (*Message, error)

ParseMessage parse a message from a binary representation

type Question

type Question struct {
	Name  string
	Type  Type
	Class Class
}

Question is a representation of a dns question

type Record

type Record struct {
	Name  string
	Type  Type
	Class Class
	TTL   uint32
	Data  net.IP
}

Record is a representation of a dns record

type Type

type Type uint16

Jump to

Keyboard shortcuts

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