Use :0 for loopback testing. This is more portable between testing environments.
Add testRR that calls NewRR and throws error away - apply it everywhere where needed.
It seems only Go 1.9 can deal with :0 being used. Disable 1.8 in travis.
Move some of them to Errorf and friends, but most of them are just
gone: This make go test -v actually readable.
Remove a bunch of test that used ipv6 on localhost as this does not work
on Travis.
I spent several hours trying to figure out why my TSIG signatures were
failing on requests to a server. I finally discovered this little
detail in the RFC which turned out to be my whole problem. Amending the
documentation to hopefully spare others the same confusion.
If an incoming message contains a TSIG record, it MUST be the last
record in the additional section.
RFC2845 3.2
Optimize CompareDomainName:
old: BenchmarkCompareDomainName-2 1000000 1869 ns/op 64 B/op 2 allocs/op
new: BenchmarkCompareDomainName-2 2000000 854 ns/op 64 B/op 2 allocs/op
This removes the strings.ToLower and fixes the documentation. It also
does not Fqdn's the names anymore (the documentation said we didn't, now
the documentation is right again).
Unlike what the documentation said we are comparing in a ignore-case
manor, add helper function equal that does this without calling
strings.ToLower.
* Allow parsing resolv.conf from io.Reader
This allows projects that use this parser to write unit tests without
writing temporary files to the filesystem.
* Avoid allocation by using strings.NewReader
Previously, the oob data was just stored and sent to WriteMsgUDP but it
ignores the Src field when writing. Instead, now it is setting the Src
to the original Dst and handling IPv4 IPs over IPv6 correctly.
* Fix $TTL handling
* Error when there is no TTL for an RR
* Fix relative name handling
* Error when a relative name is used without an origin (cf. https://tools.ietf.org/html/rfc1035#section-5.1 )
Fixes#484
When an $INCLUDE was seen the arguments to parseZone where in the wrong
order meaning the filename was used as the `neworigin` instead of the
actual origin we need.
Extend the testcase to check for the full name of the record.
* Fix TSIG bug releated to ID substitution
TSIG accounts for ID substitution. This means if the ID in the DNS
message is changed by for example a forwarder, TSIG calculation should
use the original message ID (from the TSIG RR).
I have a test for this as well, but it seems tsig_test.go has been
removed, so not sure where to put it now.
* Add tests for TSIG bugfix
When the server returns a non succesful rcode, return that to the caller
in stead of the "bad soa" of before. "dns: bad xfr rcode: <RCODE>" is
now returned.
Fixes#467
* limiting domain names to 255/63 octets/labels (#463)
(cherry picked from commit 0b729df06c)
* account for \ and \xxx in presentation format
(cherry picked from commit a094f774892fb4305051d185c2488cb43200c4d9)
* go fmt
* Add tests for UnpackDomainName
Domain names must not exceed 255 octets in wire format.
Ref gh-463
Ref gh-469
* Fix UnpackDomainName
* Introduce a long-domain sentinel error
A typed error would be better, but inconsistent with this library.
cf. https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully