add TKEY and finalize TSIG

No crypto validation ofcourse... only the definition of the RRs
This commit is contained in:
Miek Gieben 2011-01-01 19:26:08 +01:00
parent 9b595ed836
commit 7c2de14b8d
4 changed files with 60 additions and 29 deletions

4
README
View File

@ -2,7 +2,8 @@ Alternative (more granular) approach to a DNS library.
Completely usable as a DNS client library. Most widely used Resource
Records are supported. DNSSEC types are too (except NSEC/NSEC3, for now). EDNS0
is supported (see edns.go).
is (see edns.go), UDP/TCP queries, AXFR (and IXFR probably
too) supported.
Sample programs can be found in the _examples directory.
@ -17,6 +18,7 @@ Implemented RFCS:
* RFC 1034/1035
* RFC 4033/4034/4035
* RFC 5155 (NSEC3)
* And all that I forgot
Loosely based upon:
* ldns

1
TODO
View File

@ -14,7 +14,6 @@ Todo:
Issues:
* Better sized buffers
* Make the testsuite work with public DNS servers
* TC bit handling
* shortened ipv6 addresses are not parsed correctly
* quoted quotes in txt records
* Convience functions?

2
msg.go
View File

@ -87,6 +87,8 @@ var Rr_str = map[uint16]string{
TypeDNSKEY: "DNSKEY",
TypeNSEC3: "NSEC3",
TypeNSEC3PARAM: "NSEC3PARAM",
TypeTKEY: "TKEY",
TypeTSIG: "TSIG",
TypeAXFR: "AXFR", // Not real RRs
TypeIXFR: "IXFR",
}

View File

@ -59,6 +59,7 @@ const (
TypeNSEC3 = 50
TypeNSEC3PARAM = 51
TypeTKEY = 249
TypeTSIG = 250
// valid Question.qtype only
TypeIXFR = 251
@ -85,6 +86,10 @@ const (
TsigBadSig = 16
TsigBadKey = 17
TsigBadTime = 18
// Tkey errors
TkeyBadMode = 19
TkeyBadName = 20
TKeyBadAlg = 21
)
// The wire format for the DNS packet header.
@ -484,6 +489,27 @@ func (rr *RR_NSEC3PARAM) String() string {
// Salt with strings.ToUpper()
}
type RR_TKEY struct {
Hdr RR_Header
Algoritim string "domain-name"
Inception uint32
Expiration uint32
Mode uint16
Error uint16
KeySize uint16
Key string
Otherlen uint16
OtherData string
}
func (rr *RR_TKEY) Header() *RR_Header {
return &rr.Hdr
}
func (rr *RR_TKEY) String() string {
return rr.Hdr.String() + "BLAHBLAH"
}
type RR_TSIG struct {
Hdr RR_Header
Algoritim string "domain-name"
@ -540,4 +566,6 @@ var rr_mk = map[int]func() RR{
TypeDNSKEY: func() RR { return new(RR_DNSKEY) },
TypeNSEC3: func() RR { return new(RR_NSEC3) },
TypeNSEC3PARAM: func() RR { return new(RR_NSEC3PARAM) },
TypeTKEY: func() RR { return new(RR_TKEY) },
TypeTSIG: func() RR { return new(RR_TSIG) },
}