dnsutils

package module
v1.15.0 Latest Latest
Warning

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

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

README

dnsutils

codecov Go Report Card

  • Utility struct and function for miekg/dns

Documentation

Index

Constants

View Source
const (
	DenialOfExistenceMethodNSEC  = "NSEC"
	DenialOfExistenceMethodNSEC3 = "NSEC3"
)

Variables

View Source
var (
	// ErrNotSupport returns when method is not implemented.
	ErrNotSupport = fmt.Errorf("not support")
	// ErrNotChangeAble returns by change methods when can not change values.
	ErrNotChangeAble = fmt.Errorf("not changeable")
)
View Source
var (
	// ErrBadName returns when name is not domain name.
	ErrBadName = fmt.Errorf("bad name")
	// ErrNotDirectlyName returns by AddChildNode when arg node is not child name
	ErrNotDirectlyName = fmt.Errorf("add name's label count must be equals to parent label count +1")
	// ErrNotInDomain returns when arg node is in-domain.
	ErrNotInDomain = fmt.Errorf("name is not subdomain")
	// ErrChildExist returns when already exist arg node's name node.
	ErrChildExist = fmt.Errorf("child name is exist")
	// ErrNameNotEqual returns when arg name node's name is not equal.
	ErrNameNotEqual = fmt.Errorf("name not equals")
	// ErrClassNotEqual returns when arg name node's class is not equal.
	ErrClassNotEqual = fmt.Errorf("class not equals")
	// ErrConflictCNAME returns by SetRRSet when there is more than one SOA RDATA.
	ErrConflictCNAME = fmt.Errorf("name node can't set both CNAME and other")
	// ErrConflictDNAME returns by SetRRSet when there is more than one RDATA RDATA.
	ErrConflictDNAME = fmt.Errorf("name node can't set both DNAME and other")
	// ErrRemoveItself by RemoveChildNameNode when remove itself.
	ErrRemoveItself = fmt.Errorf("can not remove itself")
)
View Source
var (
	// ErrTTL returns when rrset's ttl and rr's ttl are not equals.
	ErrTTLNotEqual = fmt.Errorf("not equals ttl")
	// ErrRRType returns when rrset's rrtype and rr's rrtype are not equals.
	ErrRRTypeNotEqual = fmt.Errorf("not equals rrtype")
	// ErrConflict returns when there is more than one SOA RDATA or CNAME RDATA.
	ErrConflict = fmt.Errorf("conflict RR")
	// ErrInvalid returns when class or type is invalid format.
	ErrInvalid = fmt.Errorf("invalid data")
	// ErrFormat returns when input invalid format data.
	ErrFormat = fmt.Errorf("input format error")
)
View Source
var (
	DefaultBeforeSign time.Duration = time.Hour
	DefaultExpiry     time.Duration = time.Hour * 24 * 14
)
View Source
var (
	// ErrRdata returns when rdata is invalid while parsing RDATA.
	ErrRdata = dns.ErrRdata

	// ErrNotTreeBroken returns tree is broken
	ErrNameTreeBroken = fmt.Errorf("name tree broken")

	// ErrBadZone
	ErrBadZone = fmt.Errorf("invalid zone")

	// Err
	ErrEmptyRRs = fmt.Errorf("rrs is empty")
)
View Source
var (
	ErrZONEMDUnknownSchema = fmt.Errorf("unknown ZONEMD schema")
	ErrZONEMDUnknownHash   = fmt.Errorf("unknown ZONEMD hash")
	ErrZONEMDVerifySkip    = fmt.Errorf("skip ZONEMD verify")
)
View Source
var (
	ErrCollision = fmt.Errorf("hash collision detected")
)

Functions

func AddDNSKEY added in v1.12.1

func AddDNSKEY(z ZoneInterface, opt SignOption, dnskeys []*DNSKEY, generator Generator) error

func AddZONEMDPlaceholder added in v1.14.1

func AddZONEMDPlaceholder(z ZoneInterface, zonemdRRs []*dns.ZONEMD, generator RRSetGenerator) error

Add a ZONEMD placeholder. If there is already a ZONEMD record, delete it.

func CalcZONEMD added in v1.14.1

func CalcZONEMD(z ZoneInterface, zonemd *dns.ZONEMD) (string, error)

Calculate ZONEMD digst.

func CompareName added in v1.12.1

func CompareName(a, b string) (int, error)

The result will be 0 if a == b, -1 if a < b, and +1 if a > b.

func CompareRR added in v1.14.1

func CompareRR(a, b dns.RR) (int, error)

The result will be 0 if a == b, -1 if a < b, and +1 if a > b.

func ConvertClassToString added in v0.4.0

func ConvertClassToString(i dns.Class) string

ConvertClassToString returns DNS Class string by dns.Class

func ConvertNumberToString added in v1.1.0

func ConvertNumberToString[T constraints.Integer](def map[T]string, prefix string, i T) string

func ConvertStringToClass added in v0.4.0

func ConvertStringToClass(s string) (dns.Class, error)

ConvertStringToClass returns dns.Class by string If it failed to parse, returns ErrInvalid

func ConvertStringToType added in v0.4.0

func ConvertStringToType(s string) (uint16, error)

ConvertStringToType returns uint16 dns rrtype by string If it failed to parse, returns ErrInvalid

func ConvertToStringToNumber added in v1.1.0

func ConvertToStringToNumber[T constraints.Integer](def map[string]T, prefix, s string) (T, error)

func ConvertTypeToString added in v0.4.0

func ConvertTypeToString(i uint16) string

ConvertTypeToString returns RRType string by uint16 dns rrtype.

func CreateDoE added in v1.12.1

func CreateDoE(z ZoneInterface, opt SignOption, generator Generator) error

func CreateOrReplaceRRSetFromRRs added in v1.13.0

func CreateOrReplaceRRSetFromRRs(ni NameNodeInterface, rrs []dns.RR, generator Generator) error

func Equals

func Equals(a, b string) bool

Equals check that both names are equal. Input names can accept non-normalized name.

func GetAllParentNames added in v1.6.0

func GetAllParentNames(name string, level uint) ([]string, bool)

GetAllParentNames returns a name slice containing parent names and itself.

func GetRDATA

func GetRDATA(rr dns.RR) string

GetRDATA returns RDATA from dns.RR

func GetRDATASlice added in v0.4.0

func GetRDATASlice(rrset RRSetInterface) []string

GetRDATASlice returns RDATA from rrset

func GetSOA added in v1.12.1

func GetSOA(z ZoneInterface) (*dns.SOA, error)

func IsCompleteEqualsRRSet added in v0.2.2

func IsCompleteEqualsRRSet(a, b RRSetInterface) bool

IsCompleteEqualsRRSet check that both rrset equal.

func IsENT

func IsENT(n NameNodeInterface) bool

IsENT check that node is empty non terminal.

func IsEmptyRRSet

func IsEmptyRRSet(set RRSetInterface) bool

IsEmptyRRSet check that rrset is empty. if rrset is nil, it returns false. if radata is empty, return false. other than that return true.

func IsEqualsAllTree added in v1.12.1

func IsEqualsAllTree(a, b NameNodeInterface, ttl bool) bool

IsEqualsNode check that both tree equal. However ttl value will be ignored.

func IsEqualsNode added in v1.12.1

func IsEqualsNode(a, b NameNodeInterface, ttl bool) bool

IsEqualsNode check that both node equal. However ttl value will be ignored.

func IsEqualsRRSet

func IsEqualsRRSet(a, b RRSetInterface) bool

IsEqualsRRSet check that both rrset equal.However ttl value will be ignored.

func IsHostname added in v0.7.0

func IsHostname(name string) bool

IsHostname checks if name is a valid RFC1123 hostname.

func IterateRRInZone added in v1.14.1

func IterateRRInZone(z ZoneInterface, f func(dns.RR) error) error

func MakeRR

func MakeRR(r RRSetInterface, rdata string) (dns.RR, error)

MakeRR returns dns.RR by RRSet and rdata string

func MarshalJSONRRSet added in v0.4.0

func MarshalJSONRRSet(set RRSetInterface) ([]byte, error)

MarshalJSONRRset returns json.RawMessage by rrset.

func RemoveNameNode added in v0.4.0

func RemoveNameNode(n NameNodeInterface, name string) error

RemoveNameNode remove NameNodeInterface from tree.

func SetNameNode added in v0.4.0

func SetNameNode(n, nn NameNodeInterface, generator NameNodeGenerator) error

SetNameNode adds NameNode into tree. if not exist parent, create ENT NameNodeInterface by newFunc.s if exist same node, it overrides children and rrests.

func SetRdata added in v0.4.0

func SetRdata(set RRSetInterface, rdata []string) error

SetRdata set rdata into rrset

func Sign added in v1.14.1

func Sign(z ZoneInterface, opt SignOption, dnskeys []*DNSKEY, generator Generator) error

func SignNode added in v1.14.1

func SignNode(nni NameNodeInterface, opt SignOption, dnskeys []*DNSKEY, generator Generator, apex, auth bool) error

func SignRRSet added in v1.12.1

func SignRRSet(ri RRSetInterface, opt SignOption, dnskeys []*DNSKEY) ([]*dns.RRSIG, error)

func SignZone added in v1.12.1

func SignZone(z ZoneInterface, opt SignOption, dnskeys []*DNSKEY, generator Generator) error

func SortNames added in v1.12.1

func SortNames(names []string) error

https://datatracker.ietf.org/doc/html/rfc4034#section-6.1 SortNamesFunc returns sorted names

func SortRRs added in v1.14.1

func SortRRs(rrs []dns.RR) error

func SortedIterateNameNode added in v1.14.1

func SortedIterateNameNode(nni NameNodeInterface, f func(NameNodeInterface) error) error

func SortedIterateRR added in v1.14.1

func SortedIterateRR(set RRSetInterface, f func(dns.RR) error) error

func SortedIterateRRset added in v1.14.1

func SortedIterateRRset(nni NameNodeInterface, f func(RRSetInterface) error) error

asc

func SplitLabelsBytes added in v1.12.1

func SplitLabelsBytes(name string) (rawSlice, error)

func UpdateZONEMDDigest added in v1.14.1

func UpdateZONEMDDigest(z ZoneInterface, generator RRSetGenerator) error

func VerifyAnyZONEMDDigest added in v1.14.1

func VerifyAnyZONEMDDigest(z ZoneInterface) (bool, error)

Verifies the ZONEMD digst. If apex ZONEMD does not exist, return false and ErrZONEMDVerifySkip. If verification succeeds, return true and nil.

func VerifyZONEMDDigest added in v1.14.1

func VerifyZONEMDDigest(z ZoneInterface, zonemd *dns.ZONEMD) (bool, error)

Verifies the ZONEMD digst. If verification succeeds, return true

func ZoneNormalize added in v1.12.1

func ZoneNormalize(z ZoneInterface) error

func ZoneText added in v1.13.0

func ZoneText(z ZoneInterface, w io.Writer) error

Types

type DNSKEY added in v1.12.1

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

func ReadDNSKEY added in v1.12.1

func ReadDNSKEY(priv, pub io.Reader) (*DNSKEY, error)

func (*DNSKEY) GetRR added in v1.12.1

func (d *DNSKEY) GetRR() *dns.DNSKEY

func (*DNSKEY) GetSigner added in v1.12.1

func (d *DNSKEY) GetSigner() crypto.Signer

func (*DNSKEY) IsKSK added in v1.12.1

func (d *DNSKEY) IsKSK() bool

func (*DNSKEY) IsZSK added in v1.12.1

func (d *DNSKEY) IsZSK() bool

type DefaultGenerator added in v0.4.0

type DefaultGenerator struct{}

func (DefaultGenerator) NewNameNode added in v0.4.0

func (DefaultGenerator) NewNameNode(name string, class dns.Class) (NameNodeInterface, error)

func (DefaultGenerator) NewRRSet added in v0.4.0

func (DefaultGenerator) NewRRSet(name string, ttl uint32, class dns.Class, rrtype uint16) (RRSetInterface, error)

type DenialOfExistenceMethod added in v1.12.1

type DenialOfExistenceMethod string

type Generator added in v0.4.0

type Generator interface {
	NameNodeGenerator
	RRSetGenerator
}

type NameNode

type NameNode struct {
	sync.Mutex
	// contains filtered or unexported fields
}

NameNode is implement of NameNodeInterface

func NewNameNode

func NewNameNode(name string, class dns.Class) (*NameNode, error)

NewNameNode create NameNode

func (*NameNode) AddChildNameNode added in v0.4.0

func (n *NameNode) AddChildNameNode(nn NameNodeInterface) error

AddChildNameNode is implement of NameNodeInterface.AddChildNameNode

func (*NameNode) CopyChildNodes

func (n *NameNode) CopyChildNodes() map[string]NameNodeInterface

CopyChildNodes is implement of NameNodeInterface.CopyChildNodes

func (*NameNode) CopyRRSetMap

func (n *NameNode) CopyRRSetMap() map[uint16]RRSetInterface

CopyRRSetMap is implement of NameNodeInterface.CopyRRSetMap

func (*NameNode) GetClass

func (n *NameNode) GetClass() dns.Class

GetClass is implement of NameNodeInterface.GetClass

func (*NameNode) GetName

func (n *NameNode) GetName() string

GetName is implement of NameNodeInterface.GetName

func (*NameNode) GetNameNode

func (n *NameNode) GetNameNode(name string) (node NameNodeInterface, strict bool)

GetNameNode is implement of NameNodeInterface.GetNameNode

func (*NameNode) GetRRSet

func (n *NameNode) GetRRSet(rrtype uint16) RRSetInterface

GetRRSet is implement of NameNodeInterface.GetRRSet

func (*NameNode) IterateNameNode

func (n *NameNode) IterateNameNode(f func(NameNodeInterface) error) error

IterateNameNode is implement of NameNodeInterface.IterateNameNode sort order using SortName (rfc4034#section6-1).

func (*NameNode) IterateNameNodeWithValue added in v1.12.1

func (n *NameNode) IterateNameNodeWithValue(f func(NameNodeInterface, any) (any, error), v any) error

IterateNameNodeWithValue is implement of NameNodeInterface.IterateNameNodeWithValue sort order using SortName (rfc4034#section6-1).

func (*NameNode) IterateNameRRSet

func (n *NameNode) IterateNameRRSet(f func(RRSetInterface) error) error

IterateNameRRSet is implement of NameNodeInterface.IterateNameRRSet first order is SOA. Other than, sort order by ASC.

func (*NameNode) RRSetLen

func (n *NameNode) RRSetLen() int

RRSetLen is implement of NameNodeInterface.RRSetLen

func (*NameNode) RemoveChildNameNode added in v0.4.0

func (n *NameNode) RemoveChildNameNode(name string) error

RemoveChildNameNode is implement of NameNodeInterface.RemoveChildNameNode

func (*NameNode) RemoveRRSet

func (n *NameNode) RemoveRRSet(rrtype uint16) error

RemoveRRSet is implement of NameNodeInterface.RemoveRRSet

func (*NameNode) SetRRSet

func (n *NameNode) SetRRSet(set RRSetInterface) error

SetRRSet is implement of NameNodeInterface.SetRRSet

func (*NameNode) SetValue

func (n *NameNode) SetValue(nn NameNodeInterface) error

SetValue is implement of NameNodeInterface.SetValue

type NameNodeGenerator added in v0.4.0

type NameNodeGenerator interface {
	NewNameNode(name string, class dns.Class) (NameNodeInterface, error)
}

type NameNodeInterface

type NameNodeInterface interface {
	// GetName returns canonical name
	GetName() string
	// GetName returns class
	GetClass() dns.Class

	// GetNameNode returns NameNode by target name
	// if return value isStrict is true, NameNode is target name NameNode. (strict match)
	// if isStrict is false and node nos it nil, node is nearly parrent path node. (loose match)
	// if isStrict is false and node is nil, target name is not in-domain.
	GetNameNode(target string) (node NameNodeInterface, isStrict bool)

	// CopyChildNodes returns child name node map
	// map key is canonical name
	CopyChildNodes() map[string]NameNodeInterface

	// CopyRRSetMap returns rrset map
	// map key is uint16 rrtype
	CopyRRSetMap() map[uint16]RRSetInterface

	// GetRRSet returns rrset by rrtype
	// if not exist rrset return nil
	GetRRSet(rrtype uint16) RRSetInterface

	// IterateNameRRSet can iterate function by RRSetInterface
	// sort oreder is implementation dependent.
	IterateNameRRSet(func(RRSetInterface) error) error

	// IterateNameNode can iterate function by NameNodeInterface
	// sort oreder is implementation dependent.
	IterateNameNode(func(NameNodeInterface) error) error

	// IterateNameNode can iterate function by NameNodeInterface
	// sort oreder is implementation dependent.
	IterateNameNodeWithValue(f func(NameNodeInterface, any) (any, error), v any) error

	// AddChildNode adds child node into children.
	AddChildNameNode(NameNodeInterface) error

	// RemoveNameNode removed child node.
	RemoveChildNameNode(name string) error

	// SetValue override child and rrsetMap
	SetValue(NameNodeInterface) error

	// SetRRSet overrides rrset
	SetRRSet(RRSetInterface) error

	// RemoveRRSet removes rrset
	RemoveRRSet(rrtype uint16) error

	// RRSetLen returns the number of not empty rrset
	RRSetLen() int
}

NameNodeInterface manages node of name tree

func GetNameNodeOrCreate added in v0.2.2

func GetNameNodeOrCreate(n NameNodeInterface, name string, generator NameNodeGenerator) (NameNodeInterface, error)

GetNameNodeOrCreate returns name node from arg name node. if exist NameNode, returns it. if not exist NameNode, It create new NameNode and return it. but new NameNode is not link to from arg name node. Maybe you can use SetNameNode.

func GetZoneCuts added in v1.12.1

func GetZoneCuts(rootNode NameNodeInterface) (NameNodeInterface, map[string]struct{}, error)

type RRSet

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

RRSet is implement of RRSetInterface

func NewRRSet

func NewRRSet(name string, ttl uint32, class dns.Class, rrtype uint16, rrs []dns.RR) (*RRSet, error)

NewRRSet creates RRSet. Returns ErrBadName when name is not domain name

func NewRRSetFromRR

func NewRRSetFromRR(rr dns.RR) *RRSet

NewRRSetFromRR creates RRSet from dns.RR If rr is nil return nil

func NewRRSetFromRRs added in v0.2.2

func NewRRSetFromRRs(rrs []dns.RR) *RRSet

NewRRSetFromRRs creates RRSet from []dns.RR. It creates RRset by first RR using NewRRSetFromRR. 2nd and subsequent RR are add rrset using RRSet.AddRR. If RRSet.AddRR failed, return nil If rrs is nil return nil

func (*RRSet) AddRR

func (r *RRSet) AddRR(rr dns.RR) error

AddRR add resource record rr is must equals al of name,ttl,class and rrtype. if duplicate RDATA, It will be ignored. It returns err when any of name, ttl, class and rrtype not equal. It returns err when rtype is SOA or CNAME, and it number is multiple.

func (*RRSet) Copy

func (r *RRSet) Copy() RRSetInterface

Copy returns copy rrset

func (*RRSet) GetClass

func (r *RRSet) GetClass() dns.Class

GetClass returns dns.Class

func (*RRSet) GetName

func (r *RRSet) GetName() string

GetName returns canonical name

func (*RRSet) GetRRs

func (r *RRSet) GetRRs() []dns.RR

GetRRs returns []dns.RR

func (*RRSet) GetRRtype

func (r *RRSet) GetRRtype() uint16

GetRRtype returns rtype

func (*RRSet) GetTTL

func (r *RRSet) GetTTL() uint32

GetTTL returns ttl

func (*RRSet) Len

func (r *RRSet) Len() int

Len returns number of rdata

func (*RRSet) MarshalJSON added in v0.4.0

func (r *RRSet) MarshalJSON() ([]byte, error)

MarshalJSON returns json.RawMessage.

func (*RRSet) RemoveRR

func (r *RRSet) RemoveRR(rr dns.RR) error

RemoveRR removes resource record if not match rr. It will be ignored.

func (*RRSet) SetTTL

func (r *RRSet) SetTTL(ttl uint32) error

SetTTL changes RRSet.ttl. And changes all of RRSet rr ttl.

func (*RRSet) UnmarshalJSON added in v0.4.0

func (r *RRSet) UnmarshalJSON(bs []byte) error

UnmarshalJSON reads rrset data from json.RawMessage.

type RRSetGenerator added in v0.4.0

type RRSetGenerator interface {
	NewRRSet(name string, ttl uint32, class dns.Class, rrtype uint16) (RRSetInterface, error)
}

type RRSetInterface

type RRSetInterface interface {
	// GetName returns canonical name
	GetName() string

	// GetRRtype returns rrtype
	GetRRtype() uint16

	// GetClass returns dns.Class
	GetClass() dns.Class

	// GetTTL returns rtype
	GetTTL() uint32

	// SetTTL sets ttl
	SetTTL(uint32) error

	// GetRRs returns rr slice
	GetRRs() []dns.RR

	// Len returns number of rdata
	Len() int

	// AddRR adds dns.RR
	AddRR(dns.RR) error

	// RemoveRR removes dns.RR
	RemoveRR(dns.RR) error

	// Copy returns a copy
	Copy() RRSetInterface
}

RRSetInterface manages rrset

func GetRRSetOrCreate

func GetRRSetOrCreate(n NameNodeInterface, rrtype uint16, ttl uint32, generator RRSetGenerator) (RRSetInterface, error)

GetRRSetOrCreate returns rrset from name node. if exist rrset, returns it. if not exist rrset, It create new rrset and return it. but new rrset is not link to NameNode. Maybe you can use SetRRSet.

func NewRRSetFromRRWithGenerator added in v1.13.0

func NewRRSetFromRRWithGenerator(rr dns.RR, generator RRSetGenerator) (RRSetInterface, error)

func NewRRSetFromRRsWithGenerator added in v1.13.0

func NewRRSetFromRRsWithGenerator(rrs []dns.RR, generator RRSetGenerator) (RRSetInterface, error)

type SignOption added in v1.12.1

type SignOption struct {
	BeforeSign   *time.Duration
	Expiry       *time.Duration
	Inception    *uint32
	Expiration   *uint32
	DoEMethod    DenialOfExistenceMethod
	NSEC3Salt    string
	NSEC3Iterate uint16

	DNSKEYTTL *uint32

	ZONEMDEnabled  *bool
	CDSEnabled     *bool
	CDNSKEYEnabled *bool
}

func (*SignOption) GetBeforSign added in v1.12.1

func (o *SignOption) GetBeforSign() time.Duration

func (*SignOption) GetCDNSKEYEnabled added in v1.15.0

func (o *SignOption) GetCDNSKEYEnabled() bool

func (*SignOption) GetCDSEnabled added in v1.15.0

func (o *SignOption) GetCDSEnabled() bool

func (*SignOption) GetDNSKEYTTL added in v1.15.0

func (o *SignOption) GetDNSKEYTTL() uint32

func (*SignOption) GetExpiration added in v1.12.1

func (o *SignOption) GetExpiration() uint32

func (*SignOption) GetExpiry added in v1.12.1

func (o *SignOption) GetExpiry() time.Duration

func (*SignOption) GetInception added in v1.12.1

func (o *SignOption) GetInception() uint32

func (*SignOption) GetNSEC3Iterate added in v1.13.0

func (o *SignOption) GetNSEC3Iterate() uint16

func (*SignOption) GetNSEC3Salt added in v1.13.0

func (o *SignOption) GetNSEC3Salt() string

func (*SignOption) GetZONEMDEnabled added in v1.15.0

func (o *SignOption) GetZONEMDEnabled() bool

type Zone

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

Zone is implement of ZoneInterface

func NewZone

func NewZone(name string, class dns.Class, generator Generator) (*Zone, error)

NewZone creates Zone. returns ErrBadName when name is not domain name

func (*Zone) GetClass

func (z *Zone) GetClass() dns.Class

GetClass returns zone class

func (*Zone) GetGenerator added in v0.4.0

func (z *Zone) GetGenerator() Generator

GetGenerator returns Generator

func (*Zone) GetName

func (z *Zone) GetName() string

GetName returns canonical zone name

func (*Zone) GetRootNode

func (z *Zone) GetRootNode() NameNodeInterface

GetRootNode returns zone apex NameNode If zone is not created by NewZone, maybe it returns nil

func (*Zone) ImportRRs added in v1.13.0

func (z *Zone) ImportRRs(rrs []dns.RR) error

func (*Zone) MarshalJSON added in v0.4.0

func (z *Zone) MarshalJSON() ([]byte, error)

MarshalJSON returns json.RawMessage.

func (*Zone) Read

func (z *Zone) Read(r io.Reader) error

Read reads zone data from zonefile (RFC1035) It overrides zone's name and class when root node not exist.

func (*Zone) Text added in v1.12.1

func (z *Zone) Text(w io.Writer) error

func (*Zone) UnmarshalJSON added in v0.4.0

func (z *Zone) UnmarshalJSON(bs []byte) error

UnmarshalJSON reads zone data from json.RawMessage. It override zone's name and class when root node not exist.

type ZoneInterface

type ZoneInterface interface {
	// return canonical zone name
	GetName() string
	GetRootNode() NameNodeInterface
	GetClass() dns.Class
}

ZoneInterface manages zone root node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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