xdns

package
v0.0.0-...-75e3292 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUF_LEN = (64 * 1024) - 1 // https://github.com/fanf2/bind-9/blob/master/bin/nsupdate/nsupdate.c

	/* http://users.isc.org/~each/doxygen/bind9/rcode_8c-source.html
	   #define RCODENAMES \
	           //standard rcodes \
	           { dns_rcode_noerror, "NOERROR", 0}, \
	           { dns_rcode_formerr, "FORMERR", 0}, \
	           { dns_rcode_servfail, "SERVFAIL", 0}, \
	           { dns_rcode_nxdomain, "NXDOMAIN", 0}, \
	           { dns_rcode_notimp, "NOTIMP", 0}, \
	           { dns_rcode_refused, "REFUSED", 0}, \
	           { dns_rcode_yxdomain, "YXDOMAIN", 0}, \
	           { dns_rcode_yxrrset, "YXRRSET", 0}, \
	           { dns_rcode_nxrrset, "NXRRSET", 0}, \
	           { dns_rcode_notauth, "NOTAUTH", 0}, \
	           { dns_rcode_notzone, "NOTZONE", 0},

	   #define ERCODENAMES \
	           //extended rcodes \
	           { dns_rcode_badvers, "BADVERS", 0}, \
	           { 0, NULL, 0 }

	   #define TSIGRCODENAMES \
	           //extended rcodes \
	           { dns_tsigerror_badsig, "BADSIG", 0}, \
	           { dns_tsigerror_badkey, "BADKEY", 0}, \
	           { dns_tsigerror_badtime, "BADTIME", 0}, \
	           { dns_tsigerror_badmode, "BADMODE", 0}, \
	           { dns_tsigerror_badname, "BADNAME", 0}, \
	           { dns_tsigerror_badalg, "BADALG", 0}, \
	           { dns_tsigerror_badtrunc, "BADTRUNC", 0}, \
	           { 0, NULL, 0 }
	*/
	// https://godoc.org/github.com/miekg/dns
	// Message Response Codes, see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml
	RcodeSuccess        = 0  // NoError   - No Error                          [DNS]               *** nsupdate error string ***
	RcodeFormatError    = 1  // FormErr   - Format Error                      [DNS]               FORMERR >>> cat query | nsupdate 2>&1 | grep FORMERR
	RcodeServerFailure  = 2  // ServFail  - Server Failure                    [DNS]               SERVFAIL
	RcodeNameError      = 3  // NXDomain  - Non-Existent Domain               [DNS]               NXDOMAIN
	RcodeNotImplemented = 4  // NotImp    - Not Implemented                   [DNS]               NOTIMP
	RcodeRefused        = 5  // Refused   - Query Refused                     [DNS]               REFUSED
	RcodeYXDomain       = 6  // YXDomain  - Name Exists when it should not    [DNS Update]        YXDOMAIN
	RcodeYXRrset        = 7  // YXRRSet   - RR Set Exists when it should not  [DNS Update]        YXRRSET
	RcodeNXRrset        = 8  // NXRRSet   - RR Set that should exist does not [DNS Update]        NXRRSET
	RcodeNotAuth        = 9  // NotAuth   - Server Not Authoritative for zone [DNS Update]        NOTAUTH
	RcodeNotZone        = 10 // NotZone   - Name not contained in zone        [DNS Update/TSIG]   NOTZONE
	// Codes >=16 are not supported in classic nsupdate
	RcodeBadSig = 16 // BADSIG    - TSIG Signature Failure            [TSIG]              BADSIG
	//;; TSIG PSEUDOSECTION:
	//soam.                   0       ANY     TSIG    hmac-md5.sig-alg.reg.int. 1592324184 300 0  43064 BADSIG 0
	RcodeBadVers = 16 // BADVERS   - Bad OPT Version                   [EDNS0]             BADVERS
	RcodeBadKey  = 17 // BADKEY    - Key not recognized                [TSIG]              BADKEY
	//;; TSIG PSEUDOSECTION:
	//soamx.                  0       ANY     TSIG    hmac-md5.sig-alg.reg.int. 1592324358 300 0  22096 BADKEY 0
	RcodeBadTime   = 18 // BADTIME   - Signature out of time window      [TSIG]              BADTIME
	RcodeBadMode   = 19 // BADMODE   - Bad TKEY Mode                     [TKEY]              BADMODE
	RcodeBadName   = 20 // BADNAME   - Duplicate key name                [TKEY]              BADNAME
	RcodeBadAlg    = 21 // BADALG    - Algorithm not supported           [TKEY]              BADALG
	RcodeBadTrunc  = 22 // BADTRUNC  - Bad Truncation                    [TSIG]              BADTRUNC
	RcodeBadCookie = 23 // BADCOOKIE - Bad/missing Server Cookie         [DNS Cookies]
)

Variables

View Source
var (
	// hmac keys
	HMAC = make(map[string]string)
	// ACL
	Allow []net.IPNet
	Deny  []net.IPNet
)

Functions

func CheckACL

func CheckACL(addr net.Addr) bool

func Init

func Init(ListenTCP string, ListenUDP string, callback_update NsUpdate, callback_proxy NsProxy, XLOG xlog.XLog)

func SetACL

func SetACL(acl []string, ACL *([]net.IPNet)) error

func SetKeys

func SetKeys()

func Start

func Start()

func Stop

func Stop()

Types

type Msg

type Msg dns.Msg

Fold miekg/dns

type NsProxy

type NsProxy func(query *dns.Msg, zone *string, tsig map[string]string) (answer *dns.Msg)

type NsUpdate

type NsUpdate func(query *string, zone *string, id uint16, sig_name *string, ipaddr *string) (Rcode int)

Callback func

Jump to

Keyboard shortcuts

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