zone

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2025 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicate = fmt.Errorf("duplicate record")
View Source
var ErrNoZoneInList = fmt.Errorf("no zone in list")
View Source
var ErrNonExistentDomain = errors.New("non-existent domain")
View Source
var QueryWithDNSSEC = func() QueryOption {
	return func(o *queryOptions) {
		o.dnssec = true
	}
}
View Source
var WithDNSSEC = func(algo dnssec.SigningAlgorithm, nsec dnssec.NextSecure) ZoneOption {
	return func(_ context.Context, z *Zone) error {
		z.dnssecEnabled = true
		z.signingAlgorithm = algo
		return nil
	}
}
View Source
var WithDefaultTTL = func(ttl uint32) ZoneOption {
	return func(_ context.Context, z *Zone) error {
		z.defaultTTL = ttl
		return nil
	}
}
View Source
var WithKSK = func(algo dnssec.SigningAlgorithm, key []byte) ZoneOption {
	return func(ctx context.Context, z *Zone) error {
		sgn, err := dnssec.SignerFromBytes(algo, key)
		if err != nil {
			return err
		}
		pk, err := dnssec.PublicKeyBase64(sgn.Public())
		if err != nil {
			return err
		}
		ksk := &dns.DNSKEY{
			Hdr: dns.RR_Header{
				Name:   z.name.Fqdn(),
				Rrtype: dns.TypeDNSKEY,
				Class:  dns.ClassINET,
				Ttl:    z.defaultTTL,
			},
			Flags:     dns.ZONE | dns.SEP,
			Protocol:  dnssec.DNSKEY_PROTOCOL,
			Algorithm: uint8(algo),
			PublicKey: pk,
		}
		z.ksk = sgn
		z.kskTag = ksk.KeyTag()
		return z.Add(ctx, mindnspb.ProtoRRFromDns(ksk))
	}
}
View Source
var WithZSK = func(algo dnssec.SigningAlgorithm, key []byte) ZoneOption {
	return func(ctx context.Context, z *Zone) error {
		sgn, err := dnssec.SignerFromBytes(algo, key)
		if err != nil {
			return err
		}
		pk, err := dnssec.PublicKeyBase64(sgn.Public())
		if err != nil {
			return err
		}
		zsk := &dns.DNSKEY{
			Hdr: dns.RR_Header{
				Name:   z.name.Fqdn(),
				Rrtype: dns.TypeDNSKEY,
				Class:  dns.ClassINET,
				Ttl:    z.defaultTTL,
			},
			Flags:     dns.ZONE,
			Protocol:  dnssec.DNSKEY_PROTOCOL,
			Algorithm: uint8(algo),
			PublicKey: pk,
		}
		z.zsk = sgn
		z.zskTag = zsk.KeyTag()
		return z.Add(ctx, mindnspb.ProtoRRFromDns(zsk))
	}
}

Functions

This section is empty.

Types

type DeleteRecord added in v0.4.2

type DeleteRecord struct{}

type QueryOption added in v0.4.2

type QueryOption func(*queryOptions)

type QueryResult added in v0.4.2

type QueryResult struct {
	Authority  Section
	Answer     Section
	Additional Section
}

type Section added in v0.4.2

type Section []mindnspb.ProtoRR

func (Section) Add added in v0.4.2

func (s Section) Add(rr ...mindnspb.ProtoRR)

func (Section) Has added in v0.4.2

func (s Section) Has(rr mindnspb.ProtoRR) bool

type Serial

type Serial uint32

func (Serial) Add

func (s Serial) Add(other Serial) Serial

func (Serial) Equal

func (s Serial) Equal(other Serial) bool

func (Serial) GreaterThan

func (s Serial) GreaterThan(other Serial) bool

func (Serial) Increment

func (s Serial) Increment() Serial

func (Serial) LessThan

func (s Serial) LessThan(other Serial) bool

func (Serial) Subtract

func (s Serial) Subtract(other Serial) Serial

type UpdateRequest added in v0.4.2

type UpdateRequest struct {
	AddRecords []mindnspb.ProtoRR
}

type Zone

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

func New

func New(ctx context.Context, name, ns, mail string, opts ...ZoneOption) (*Zone, error)

func (*Zone) Add

func (z *Zone) Add(ctx context.Context, rr mindnspb.ProtoRR) error

func (*Zone) GetDS

func (z *Zone) GetDS() *dns.DS

func (*Zone) Query added in v0.4.2

func (z *Zone) Query(ctx context.Context, qst *mindnspb.Question, opts ...QueryOption) (*QueryResult, error)

func (*Zone) Update added in v0.4.2

func (z *Zone) Update(ctx context.Context, req *mindnspb.UpdateRecordsRequest) error

type ZoneList

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

func NewZoneList

func NewZoneList() *ZoneList

func (*ZoneList) Add

func (zl *ZoneList) Add(z *Zone)

func (*ZoneList) Get

func (zl *ZoneList) Get(domain domainname.DomainName) (*Zone, error)

func (*ZoneList) Remove

func (zl *ZoneList) Remove(domain domainname.DomainName)

type ZoneOption

type ZoneOption func(context.Context, *Zone) error

Jump to

Keyboard shortcuts

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