100 Commits

Author SHA1 Message Date
Filippo Valsorda
023972bb19 Expose TypeToRR 2015-10-16 23:36:49 +01:00
Roland Shoemaker
522331911d Enable CAA parsing 2015-06-16 02:01:28 -07:00
Michael Haro
2fb2a25e84 More test clean up
Remove trailing \n from t.Log and t.Error messages as it's unnecessary.

In some instances, combine multiple t.Error()s into one

To provide more consistency across the tests, rename e to err and use %v
as the format arg for errors.

Replace Logf and Errorf with Log and Error when it made sense.  For
example t.Errorf("%v", err) to t.Error(err)
2015-02-25 22:14:21 -08:00
Michael Haro
f995f1aff3 Convert tests from being t.Log(..) then t.Fail() to just t.Error(...) as
t.Error(...) does both and makes it more clear which messages are errors
vs information log messages.
2015-02-23 17:43:07 -08:00
Miek Gieben
acee6af0bc Merge branch 'master' of github.com:miekg/dns 2015-02-19 09:59:37 +00:00
Miek Gieben
67945c119e A bunch of golint fixes
The proposed vars names are a nono, because they break the API.
Things left: document each RR and zscan_rr.go has some funcky if-then-elses.
2015-02-19 09:58:33 +00:00
Michael Haro
9e96f28311 Fix problems noted by 'go vet' 2015-02-19 00:08:28 -08:00
Miek Gieben
48ba40204d Add some more binary tests in TestMsgPackBuffer 2015-02-18 09:17:00 +00:00
Daniel Morsing
a4af4dd14e Used shared backing array for Msg.Copy
If you have a system with large amounts of copies, these slice
allocations start stacking up. Use a shared slice and then subslice
them with a cap limit so that append works properly.

Also, add a benchmark and test for Msg.Copy

Benchcmp:
benchmark         old ns/op     new ns/op     delta
BenchmarkCopy     1880          1672          -11.06%

benchmark         old allocs     new allocs     delta
BenchmarkCopy     13             11             -15.38%

benchmark         old bytes     new bytes     delta
BenchmarkCopy     528           528           +0.00%
2015-02-05 13:07:07 +00:00
Miek Gieben
b6ff23905a Finish implementing IPSECKEY
Remaining tests and unpack for IPSECKEY.
2015-01-25 12:24:39 +00:00
Miek Gieben
477cb4d3fa Implement IPSECKEY
IPSECKEY is kinda strange because it has a type selector which tells
what type a later rdata field has. The type can be a domainname, address
or v6 address. You sort of wish Go would have a union type for this, but
alas.
Currently this is implemented as:

	GatewayA    net.IP `dns:"a"`
	GatewayAAAA net.IP `dns:"aaaa"`
	GatewayName string `dns:"domain-name"`

In the IPSECKEY. Only one of these is active at any one time. When
parsing/packing and unpacking the value of GatewayType is checked
to see what to do.

Parsing from strings is also implemented properly and tested. The Unpack
function still needs work.
2015-01-25 10:58:30 +00:00
Daniel Morsing
433ab7b569 Reduce amount of work done when unpacking unprintable characters.
Instead of going through the fmt package, we can use append int,
which saves an allocation.

benchmark                                old ns/op     new ns/op     delta
BenchmarkUnpackDomainNameUnprintable     2147          506           -76.43%
2014-11-06 13:51:29 +00:00
Miek Gieben
a945149fab Print unknown record type with CLASSX and TYPEX
When printing unknown records it is best to print the entire thing
as unknown, instead of relying on the internal defined type. An
example A record, printed as an unknown one:
    miek.nl.      3600    CLASS1  TYPE1   \# 4 0a000101
2014-11-02 11:06:05 +00:00
Miek Gieben
02dd474056 Dont export typeToRR (old rr_mk) 2014-09-16 07:31:20 +01:00
Miek Gieben
bcb640ccaf Make rr_mk public and call it TypeToRR 2014-09-16 07:15:06 +01:00
Miek Gieben
0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben
06fc321c2c fmt 2014-08-30 08:45:10 +01:00
Miek Gieben
34f5a12bfc Don't crash on emtpy string in compressionLenSearch
Fixes #105
2014-08-22 08:46:24 +00:00
Miek Gieben
9f5fcf8459 Add extra length test for issue #105 2014-08-22 08:15:35 +01:00
Miek Gieben
f5fe400c53 Lowercase all test output.
Add Shutdown tests as well
2014-08-19 08:39:04 +00:00
Miek Gieben
5a8fe5d5f7 Add Copy test 2014-06-06 21:10:38 +01:00
Andrew Tunnell-Jones
8772f9064c Make PackRR enforce RR data length limit
• Make rawSetRdlength return false if length would overflow
• Make PackRR assume rawSetRdlength returning false indicates an overflow
2014-04-29 05:03:01 +00:00
Miek Gieben
87b380cad5 Revert "Use dLen for domain name length"
This reverts commit b59518383446378cde7758d16f925b5ee324c5a4.

Fix up the tests too.
2014-02-14 20:20:22 +00:00
Miek Gieben
c46b0e07c3 Normalize names a bit 2014-02-12 13:36:04 +00:00
Miek Gieben
89cc033428 Be much more precice in msg.Len()
There is still a one-off in EDNS0 records, but I'm not too bothered with
that one.
2014-02-12 12:59:42 +00:00
Miek Gieben
b595183834 Use dLen for domain name length 2014-02-12 12:50:16 +00:00
Miek Gieben
31102c38b7 Make Len() much more accurate for compressed messages.
Lots of changes made and bugs fixed.
2014-02-11 23:01:47 +00:00
Miek Gieben
d0fa099d08 Document and disable the test 2014-02-10 20:28:17 +00:00
Miek Gieben
d24565edc8 Merge branch 'len'
Cleanup the rest and add the test.
2014-02-10 20:20:08 +00:00
Miek Gieben
21283d2192 Improve msg.Len() accuracy
Currently msg.Len() overshoots a _lot_ when compression is
enabled. The main problem is that once a part of a domain is found to
be compressed, the whole domain is _not_ added back to compression
dictionary.

That means if we once cache ".microsoft.com" we won't cache
"blah.microsoft.com".

Ammended a bit: put the test in dns_test.go
2014-02-10 20:16:05 +00:00
Miek Gieben
372e3d55c3 More tests lenght 2014-02-10 12:29:33 +00:00
Miek Gieben
56e0bb46d8 Remove packLen() and fix bug in Len()
packLen() was a featureless mirror of Len(). Remove it, and just use
Len() internally too.
Fix bug in Len() too, where the length of the additional section was
not counted.
2014-02-10 12:23:53 +00:00
Alex Ciuba
008c1d5916 Add domain unpacking benchmark 2014-02-01 01:29:10 -05:00
Miek Gieben
dd35496669 dont care about padding for benchmark function 2014-01-29 07:56:21 +00:00
Miek Gieben
876680216e Revert "Revert "Add benchmark for message unpacking""
This reverts commit ca87093b6d0b1cb41d55df82e8143c4dab0c7dee.
2014-01-29 07:52:43 +00:00
Miek Gieben
509a6ff9e2 Revert "Revert "Fix benchmark alignment""
This reverts commit b8e6bd45bea3a58e61b6018f13fdd899a84e8639.
2014-01-29 07:52:23 +00:00
Miek Gieben
f2f9d43da5 Revert "Revert "Add more benchmarks""
This reverts commit 58a3a82b8e13c6147abfbb8eb1c6dd6fb0a7439e.
2014-01-29 07:51:36 +00:00
Miek Gieben
58a3a82b8e Revert "Add more benchmarks"
This reverts commit 5a3bf3d74996d4be97ff6ab5e27699f90ef42d39.
2014-01-28 22:44:07 +00:00
Miek Gieben
b8e6bd45be Revert "Fix benchmark alignment"
This reverts commit 008dfb4ee81e8a0bf7cee3ee59dc87d5bc02aac7.
2014-01-28 22:43:57 +00:00
Miek Gieben
ca87093b6d Revert "Add benchmark for message unpacking"
This reverts commit dc4eddaf9acd873ba8efd68e467cc9286f4591af.
2014-01-28 22:43:37 +00:00
Alex Ciuba
dc4eddaf9a Add benchmark for message unpacking 2014-01-27 20:55:15 -05:00
Alex Ciuba
008dfb4ee8 Fix benchmark alignment 2014-01-27 17:40:57 -05:00
Alex Ciuba
5a3bf3d749 Add more benchmarks 2014-01-27 17:33:14 -05:00
Miek Gieben
c17b6e8905 Merge pull request #68 from soh335/fix/empty-txt
if txt rdlength is 0, not read anymore
2014-01-04 06:41:58 -08:00
Miek Gieben
5b8a651bf0 Fix typo in comment 2014-01-04 11:53:50 +00:00
Miek Gieben
9e73cb688f Fix NAPTR's length function
Add the 3 bytes for the length byte of the strings.

Close issue #67.
2014-01-04 11:30:20 +00:00
soh335
e8a5f90957 if txt rdlength is 0, not read anymore 2014-01-04 17:30:08 +09:00
Miek Gieben
675f170a3d Fix axfr tsig 2013-10-12 14:00:10 +01:00
Miek Gieben
bf37f92d4a Some test tweaking 2013-09-29 11:30:03 +01:00
Miek Gieben
29232adf26 better comment 2013-08-31 20:26:24 +01:00