resolver

package
v0.0.0-...-905691f Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ROOT_NAME_SERVER = "192.5.5.241"

Functions

func DecodeDomainName

func DecodeDomainName(buffer []byte, offset int) (string, int)

func GenMessage

func GenMessage(domainName string) ([]byte, error)

func ResolveDomainName

func ResolveDomainName(domainName, rootNameServer string) ([]string, error)

Types

type DNSMessage

type DNSMessage struct {
	Header     Header
	Question   Question
	Answers    []ResourceRecord
	Authority  []ResourceRecord
	Additional []ResourceRecord
}

func DecodeMessage

func DecodeMessage(dnsResponse []byte) (DNSMessage, error)
type Header struct {
	ID                    uint16
	Flags                 uint16
	QuestionCount         uint16
	AnswerRecordCount     uint16
	AuthorityRecordCount  uint16
	AdditionalRecordCount uint16
}

func DecodeHeader

func DecodeHeader(buffer []byte) (h *Header, offset int, err error)

func (*Header) Encode

func (h *Header) Encode() []byte

type Question

type Question struct {
	Name  string
	Type  uint16
	Class uint16
}

func DecodeQuestion

func DecodeQuestion(buffer []byte, offset int) (*Question, int, error)

func (*Question) Encode

func (q *Question) Encode() ([]byte, error)

type ResourceRecord

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

func DecodeResourceRecord

func DecodeResourceRecord(buffer []byte, offset int) (*ResourceRecord, int, error)

Jump to

Keyboard shortcuts

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