More evil records to parse

This commit is contained in:
Miek Gieben 2012-01-12 10:50:01 +01:00
parent 771c659d66
commit 374e495534
2 changed files with 13 additions and 2 deletions

View File

@ -171,8 +171,16 @@ func TestParseBrace(t *testing.T) {
(IN)
(AAAA)
(::1))`: "miek.nl.\t3600\tIN\tAAAA\t::1",
`((m)(i)ek.(n)l.) (SOA) (soa.) (soa.) (
2009032802 ; serial
21600 ; refresh (6 hours)
7(2)00 ; retry (2 hours)
604()800 ; expire (1 week)
3600 ; minimum (1 hour)
)`: "miek.nl.\t3600\tIN\tSOA\tsoa. soa. 2009032802 21600 7200 604800 3600",
"miek\\.nl. IN A 127.0.0.1": "miek\\.nl.\t3600\tIN\tA\t127.0.0.1",
"miek.nl. IN A 127.0.0.1": "miek.nl.\t3600\tIN\tA\t127.0.0.1",
"miek.nl. A 127.0.0.1": "miek.nl.\t3600\tIN\tA\t127.0.0.1",
`miek.nl. 86400 IN SOA elektron.atoom.net. miekg.atoom.net. (
2009032802 ; serial
21600 ; refresh (6 hours)

View File

@ -7,13 +7,16 @@ package dns
// Function defined in this subpackage work on []byte and but still
// provide some higher level functions.
// RawSetId sets the message ID in buf.
// RawSetId sets the message ID in buf. The offset 'off' must
// be positioned at the beginning of the message.
func RawSetId(msg []byte, off int, id uint16) bool {
msg[off], msg[off+1] = packUint16(id)
return true
}
// RawSetRdLength set the rdlength
// RawSetRdLength sets the rdlength in the header of
// the RR. The offset 'off' must be positioned at the
// start of the header of the RR.
func RawSetRdLength(msg []byte, off, end int) bool {
// We are at the start of the header, walk the
// domainname (might be compressed), and set the