dns

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: BSD-3-Clause Imports: 5 Imported by: 9

Documentation

Overview

Package dns implement dns types and standard methods and functions to parse and normalize dns records and configuration

Index

Constants

View Source
const (
	// InvalidNameServerTypeString invalid nameserver type as string
	InvalidNameServerTypeString = "invalid"
	// UDPNameServerTypeString udp nameserver type as string
	UDPNameServerTypeString = "udp"
)
View Source
const DefaultDNSPort = 53

DefaultDNSPort well-known port number

Variables

This section is empty.

Functions

This section is empty.

Types

type NameServer

type NameServer struct {
	// IP address of nameserver
	IP netip.Addr
	// NSType nameserver type
	NSType NameServerType
	// Port nameserver listening port
	Port int
}

NameServer represents a DNS nameserver

func ParseNameServerURL

func ParseNameServerURL(nsURL string) (NameServer, error)

ParseNameServerURL parses a nameserver url in the format <type>://<ip>:<port>, e.g., udp://1.1.1.1:53

func (*NameServer) Copy

func (n *NameServer) Copy() *NameServer

Copy copies a nameserver object

func (*NameServer) IsEqual

func (n *NameServer) IsEqual(other *NameServer) bool

IsEqual compares one nameserver with the other

type NameServerGroup

type NameServerGroup struct {
	// ID identifier of group
	ID string
	// Name group name
	Name string
	// Description group description
	Description string
	// NameServers list of nameservers
	NameServers []NameServer
	// Groups list of peer group IDs to distribute the nameservers information
	Groups []string
	// Enabled group status
	Enabled bool
}

NameServerGroup group of nameservers and with group ids

func (*NameServerGroup) Copy

func (g *NameServerGroup) Copy() *NameServerGroup

Copy copies a nameserver group object

func (*NameServerGroup) IsEqual

func (g *NameServerGroup) IsEqual(other *NameServerGroup) bool

IsEqual compares one nameserver group with the other

type NameServerType

type NameServerType int

NameServerType nameserver type

const (
	// MaxGroupNameChar maximum group name size
	MaxGroupNameChar = 40
	// InvalidNameServerType invalid nameserver type
	InvalidNameServerType NameServerType = iota
	// UDPNameServerType udp nameserver type
	UDPNameServerType
)

func ToNameServerType

func ToNameServerType(typeString string) NameServerType

ToNameServerType returns a nameserver type

func (NameServerType) String

func (n NameServerType) String() string

String returns nameserver type string

Jump to

Keyboard shortcuts

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