ddns

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DDNS

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

DDNS is dynamic update struct It can process update message and It updates zone data using UpdateInterface.

func NewDDNS

func NewDDNS(ui UpdateInterface) *DDNS

NewDDNS is create DDNS ui is nil, return nil

func (*DDNS) CheckZoneSection

func (d *DDNS) CheckZoneSection(z dnsutils.ZoneInterface, msg *dns.Msg) int

3.1.2 - Pseudocode For Zone Section Processing

if (zcount != 1 || ztype != SOA)
     return (FORMERR)
if (zone_type(zname, zclass) == SLAVE)
     return forward()
if (zone_type(zname, zclass) == MASTER)
     return update()
return (NOTAUTH)

func (*DDNS) PrerequisiteProessing

func (d *DDNS) PrerequisiteProessing(z dnsutils.ZoneInterface, msg *dns.Msg) int

3.2.5 - Pseudocode for Prerequisite Section Processing

for rr in prerequisites
     if (rr.ttl != 0)
          return (FORMERR)
     if (zone_of(rr.name) != ZNAME)
          return (NOTZONE);
     if (rr.class == ANY)
          if (rr.rdlength != 0)
               return (FORMERR)
          if (rr.type == ANY)
               if (!zone_name<rr.name>)
                    return (NXDOMAIN)
          else
               if (!zone_rrset<rr.name, rr.type>)
                    return (NXRRSET)
     if (rr.class == NONE)
          if (rr.rdlength != 0)
               return (FORMERR)
          if (rr.type == ANY)
               if (zone_name<rr.name>)
                    return (YXDOMAIN)
          else
               if (zone_rrset<rr.name, rr.type>)
                    return (YXRRSET)
     if (rr.class == zclass)
          temp<rr.name, rr.type> += rr
     else
          return (FORMERR)

for rrset in temp
     if (zone_rrset<rrset.name, rrset.type> != rrset)
          return (NXRRSET)

func (*DDNS) ServeUpdate

func (d *DDNS) ServeUpdate(zone dnsutils.ZoneInterface, r *dns.Msg) (int, error)

DDNS.ServeUpdate is process update message

func (*DDNS) UpdateAdd

func (d *DDNS) UpdateAdd(z dnsutils.ZoneInterface, rr dns.RR) error

if (rr.type == CNAME)

if (zone_rrset<rr.name, ~CNAME>)
     next [rr]

elsif (zone_rrset<rr.name, CNAME>)

next [rr]

if (rr.type == SOA)

if (!zone_rrset<rr.name, SOA> ||
    zone_rr<rr.name, SOA>.serial > rr.soa.serial)
     next [rr]

for zrr in zone_rrset<rr.name, rr.type>

if (rr.type == CNAME || rr.type == SOA ||
    (rr.type == WKS && rr.proto == zrr.proto &&
     rr.address == zrr.address) ||
    rr.rdata == zrr.rdata)
     zrr = rr
     next [rr]

zone_rrset<rr.name, rr.type> += rr

func (*DDNS) UpdatePrescan

func (d *DDNS) UpdatePrescan(z dnsutils.ZoneInterface, msg *dns.Msg) int

func (*DDNS) UpdateProcessing

func (d *DDNS) UpdateProcessing(z dnsutils.ZoneInterface, m *dns.Msg) error

func (*DDNS) UpdateRemoveRDATA added in v0.3.0

func (d *DDNS) UpdateRemoveRDATA(z dnsutils.ZoneInterface, rr dns.RR) error

process remove RR

func (*DDNS) UpdateRemoveRR

func (d *DDNS) UpdateRemoveRR(z dnsutils.ZoneInterface, rr dns.RR) error

process Remove name and rrset

type UpdateInterface

type UpdateInterface interface {
	// add or create RR
	AddRR(rr dns.RR) error
	// replace rrset
	ReplaceRRSet(dnsutils.RRSetInterface) error
	// remove zone apex name rr other than SOA,NS
	RemoveNameApex(name string) error
	// remove name rr ignore SOA, NS
	RemoveName(name string) error
	// remove name rr ignore SOA, NS
	RemoveRRSet(name string, rtype uint16) error

	// remove name rr ignore SOA, NS
	RemoveRR(rr dns.RR) error

	// it can rollback zone records when UpdateProcessing returns error
	UpdateFailedPostProcess(error)

	// it can apply zone records when UpdateProcessing is successful
	UpdatePostProcess() error

	IsPrecheckSupportedRtype(uint16) bool
	IsUpdateSupportedRtype(uint16) bool
}

UpdateInterface is update zone interface

Jump to

Keyboard shortcuts

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