add TKEY and finalize TSIG
No crypto validation ofcourse... only the definition of the RRs
This commit is contained in:
parent
9b595ed836
commit
7c2de14b8d
4
README
4
README
|
@ -2,7 +2,8 @@ Alternative (more granular) approach to a DNS library.
|
||||||
|
|
||||||
Completely usable as a DNS client library. Most widely used Resource
|
Completely usable as a DNS client library. Most widely used Resource
|
||||||
Records are supported. DNSSEC types are too (except NSEC/NSEC3, for now). EDNS0
|
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.
|
Sample programs can be found in the _examples directory.
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ Implemented RFCS:
|
||||||
* RFC 1034/1035
|
* RFC 1034/1035
|
||||||
* RFC 4033/4034/4035
|
* RFC 4033/4034/4035
|
||||||
* RFC 5155 (NSEC3)
|
* RFC 5155 (NSEC3)
|
||||||
|
* And all that I forgot
|
||||||
|
|
||||||
Loosely based upon:
|
Loosely based upon:
|
||||||
* ldns
|
* ldns
|
||||||
|
|
1
TODO
1
TODO
|
@ -14,7 +14,6 @@ Todo:
|
||||||
Issues:
|
Issues:
|
||||||
* Better sized buffers
|
* Better sized buffers
|
||||||
* Make the testsuite work with public DNS servers
|
* Make the testsuite work with public DNS servers
|
||||||
* TC bit handling
|
|
||||||
* shortened ipv6 addresses are not parsed correctly
|
* shortened ipv6 addresses are not parsed correctly
|
||||||
* quoted quotes in txt records
|
* quoted quotes in txt records
|
||||||
* Convience functions?
|
* Convience functions?
|
||||||
|
|
2
msg.go
2
msg.go
|
@ -87,6 +87,8 @@ var Rr_str = map[uint16]string{
|
||||||
TypeDNSKEY: "DNSKEY",
|
TypeDNSKEY: "DNSKEY",
|
||||||
TypeNSEC3: "NSEC3",
|
TypeNSEC3: "NSEC3",
|
||||||
TypeNSEC3PARAM: "NSEC3PARAM",
|
TypeNSEC3PARAM: "NSEC3PARAM",
|
||||||
|
TypeTKEY: "TKEY",
|
||||||
|
TypeTSIG: "TSIG",
|
||||||
TypeAXFR: "AXFR", // Not real RRs
|
TypeAXFR: "AXFR", // Not real RRs
|
||||||
TypeIXFR: "IXFR",
|
TypeIXFR: "IXFR",
|
||||||
}
|
}
|
||||||
|
|
82
types.go
82
types.go
|
@ -40,7 +40,7 @@ const (
|
||||||
TypeMX = 15
|
TypeMX = 15
|
||||||
TypeTXT = 16
|
TypeTXT = 16
|
||||||
TypeAAAA = 28
|
TypeAAAA = 28
|
||||||
TypeLOC = 29
|
TypeLOC = 29
|
||||||
TypeSRV = 33
|
TypeSRV = 33
|
||||||
TypeNAPTR = 35
|
TypeNAPTR = 35
|
||||||
|
|
||||||
|
@ -59,9 +59,10 @@ const (
|
||||||
TypeNSEC3 = 50
|
TypeNSEC3 = 50
|
||||||
TypeNSEC3PARAM = 51
|
TypeNSEC3PARAM = 51
|
||||||
|
|
||||||
TypeTSIG = 250
|
TypeTKEY = 249
|
||||||
|
TypeTSIG = 250
|
||||||
// valid Question.qtype only
|
// valid Question.qtype only
|
||||||
TypeIXFR = 251
|
TypeIXFR = 251
|
||||||
TypeAXFR = 252
|
TypeAXFR = 252
|
||||||
TypeMAILB = 253
|
TypeMAILB = 253
|
||||||
TypeMAILA = 254
|
TypeMAILA = 254
|
||||||
|
@ -81,10 +82,14 @@ const (
|
||||||
RcodeNameError = 3
|
RcodeNameError = 3
|
||||||
RcodeNotImplemented = 4
|
RcodeNotImplemented = 4
|
||||||
RcodeRefused = 5
|
RcodeRefused = 5
|
||||||
// Tsig errors
|
// Tsig errors
|
||||||
TsigBadSig = 16
|
TsigBadSig = 16
|
||||||
TsigBadKey = 17
|
TsigBadKey = 17
|
||||||
TsigBadTime = 18
|
TsigBadTime = 18
|
||||||
|
// Tkey errors
|
||||||
|
TkeyBadMode = 19
|
||||||
|
TkeyBadName = 20
|
||||||
|
TKeyBadAlg = 21
|
||||||
)
|
)
|
||||||
|
|
||||||
// The wire format for the DNS packet header.
|
// The wire format for the DNS packet header.
|
||||||
|
@ -342,14 +347,14 @@ func (rr *RR_AAAA) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RR_LOC struct {
|
type RR_LOC struct {
|
||||||
Hdr RR_Header
|
Hdr RR_Header
|
||||||
Version uint8
|
Version uint8
|
||||||
Size uint8
|
Size uint8
|
||||||
HorizPre uint8
|
HorizPre uint8
|
||||||
VertPre uint8
|
VertPre uint8
|
||||||
Latitude uint32
|
Latitude uint32
|
||||||
Longitude uint32
|
Longitude uint32
|
||||||
Altitude uint32
|
Altitude uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rr *RR_LOC) Header() *RR_Header {
|
func (rr *RR_LOC) Header() *RR_Header {
|
||||||
|
@ -484,24 +489,45 @@ func (rr *RR_NSEC3PARAM) String() string {
|
||||||
// Salt with strings.ToUpper()
|
// 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 {
|
type RR_TSIG struct {
|
||||||
Hdr RR_Header
|
Hdr RR_Header
|
||||||
Algoritim string "domain-name"
|
Algoritim string "domain-name"
|
||||||
TimeSigned [3]uint16 // uint48 *sigh*
|
TimeSigned [3]uint16 // uint48 *sigh*
|
||||||
Fudge uint16
|
Fudge uint16
|
||||||
MACSize uint16
|
MACSize uint16
|
||||||
MAC string
|
MAC string
|
||||||
Error uint16
|
Error uint16
|
||||||
OtherLen uint16
|
OtherLen uint16
|
||||||
OtherData string
|
OtherData string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rr *RR_TSIG) Header() *RR_Header {
|
func (rr *RR_TSIG) Header() *RR_Header {
|
||||||
return &rr.Hdr
|
return &rr.Hdr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rr *RR_TSIG) String() string {
|
func (rr *RR_TSIG) String() string {
|
||||||
return rr.Hdr.String() + "TODO"
|
return rr.Hdr.String() + "TODO"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translate the RRSIG's incep. and expir. time to the correct date.
|
// Translate the RRSIG's incep. and expir. time to the correct date.
|
||||||
|
@ -532,7 +558,7 @@ var rr_mk = map[int]func() RR{
|
||||||
TypeNAPTR: func() RR { return new(RR_NAPTR) },
|
TypeNAPTR: func() RR { return new(RR_NAPTR) },
|
||||||
TypeA: func() RR { return new(RR_A) },
|
TypeA: func() RR { return new(RR_A) },
|
||||||
TypeAAAA: func() RR { return new(RR_AAAA) },
|
TypeAAAA: func() RR { return new(RR_AAAA) },
|
||||||
TypeLOC: func() RR { return new(RR_LOC) },
|
TypeLOC: func() RR { return new(RR_LOC) },
|
||||||
TypeOPT: func() RR { return new(RR_OPT) },
|
TypeOPT: func() RR { return new(RR_OPT) },
|
||||||
TypeDS: func() RR { return new(RR_DS) },
|
TypeDS: func() RR { return new(RR_DS) },
|
||||||
TypeRRSIG: func() RR { return new(RR_RRSIG) },
|
TypeRRSIG: func() RR { return new(RR_RRSIG) },
|
||||||
|
@ -540,4 +566,6 @@ var rr_mk = map[int]func() RR{
|
||||||
TypeDNSKEY: func() RR { return new(RR_DNSKEY) },
|
TypeDNSKEY: func() RR { return new(RR_DNSKEY) },
|
||||||
TypeNSEC3: func() RR { return new(RR_NSEC3) },
|
TypeNSEC3: func() RR { return new(RR_NSEC3) },
|
||||||
TypeNSEC3PARAM: func() RR { return new(RR_NSEC3PARAM) },
|
TypeNSEC3PARAM: func() RR { return new(RR_NSEC3PARAM) },
|
||||||
|
TypeTKEY: func() RR { return new(RR_TKEY) },
|
||||||
|
TypeTSIG: func() RR { return new(RR_TSIG) },
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue