Commit Graph

139 Commits

Author SHA1 Message Date
Miek Gieben 475ab80867 Remove (most) reflection
Remove the use of reflection when packing and unpacking, instead
generate all the pack and unpack functions using msg_generate.
This will generate zmsg.go which in turn calls the helper functions from
msg_helper.go.

This increases the speed by about ~30% while cutting back on memory
usage. Not all RRs are using it, but that will be rectified in upcoming
PR.

Most of the speed increase is in the header/question section parsing.
These functions *are* not generated, but straight forward enough. The
implementation can be found in msg.go.

The new code has been fuzzed by go-fuzz, which turned up some issues.

All files that started with 'z', and not autogenerated were renamed,
i.e. zscan.go is now scan.go.

Reflection is still used, in subsequent PRs it will be removed entirely.
2016-06-03 12:45:22 +01:00
Miek Gieben b6897b5a7c TSIG: lowercase algorithm before use
These strings are domain names, so we should lowercase them before
using them.

Also add some tests for Tsig generation and verification.

(/ht ldns release).
2016-03-07 22:17:28 +00:00
Filippo Valsorda 25846488f9 Apply per-type code generation to .copy()
This fixes bugs in MB and CNAME.copy() (using sprintName for copying),
IPSECKEY (missed copyIP) and OPT (partially, Options was not copied as
slice; EDNS0 objects themselves are still pointers).
2015-10-07 05:51:36 +01:00
Filippo Valsorda d4a4e089d0 Generate programmatically per-type code, including .len()
This process probably fixes a bug in NSAPPTR.len(), after a similar one was
found in HINFO.len().

This should also make it easier to make changes to these functions, and
check their correctness.

Generate the code by running "go generate".
2015-10-07 05:48:12 +01:00
Miek Gieben 64fea017a2 Move all docs to docs.go
Another golint change.
2015-02-19 13:47:50 +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
Flavien Lebarbe 067cfe8d4e Add support for HmacSHA512 algorithm in TSIG 2015-01-23 10:51:56 +01:00
Filippo Valsorda 0f1b1184ae Rename and simplify packing helper functions 2014-12-05 19:27:44 +00:00
Miek Gieben 6e3a9dd0d8 Fix tsig fudge factor
Excellent bug report from freb, about how this fails when a message
arrives in the past (because of clock skew).

Closes #153
2014-11-11 17:58:12 +00:00
Miek Gieben 0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben 4dd48338af documentation tweaks 2014-07-30 07:35:06 +01:00
Andrew Tunnell-Jones 0a5cb5c80a Update TSIG doc header to avoid godoc oddity
For some reason godoc treats it as plain text because it contains
"(TSIG)".
2014-03-02 09:48:46 +00:00
Miek Gieben 83efab6078 Revert "Use dLen in TSIG too"
This reverts commit 37406413d7.
2014-02-14 20:05:51 +00:00
Miek Gieben 37406413d7 Use dLen in TSIG too 2014-02-12 12:51:13 +00:00
Andrew Tunnell-Jones 857a1c66cb Make TsigVerify's MAC comparison take constant time 2014-01-24 03:28:08 +00:00
Miek Gieben 37356f5e68 Documenation fixes 2014-01-12 10:43:59 +00:00
Miek Gieben 4862dd17b4 Slight doc updates 2013-10-12 19:19:24 +01:00
Miek Gieben 0134de62ed Fix TSIG/transfer documentation 2013-10-12 19:14:45 +01:00
Miek Gieben 81941d4422 Update all copyright notices 2013-05-12 16:15:52 +02:00
Miek Gieben d53d9eab81 gofmt 2013-05-05 20:30:44 +02:00
Miek Gieben c88ac95260 whitespace in comments 2013-03-18 17:37:49 +00:00
Miek Gieben cd10853288 Make Len() and Copy() private
I don't think anybody will needs these, msg.Len() is still
available. Severly cuts back on the amount of exported functions.
2013-02-09 08:35:17 +01:00
Miek Gieben 84983bc293 remove space 2013-02-09 08:17:05 +01:00
Miek Gieben 4a951fc1f8 Merge branch 'master' of github.com:miekg/dns 2012-12-14 12:35:25 +01:00
Miek Gieben 99817d7c33 Fix TSIG
If you even add a tag to a struct member, be sure to add that
tag to the other important structs too.
2012-12-13 13:44:27 +01:00
Miek Gieben 375917b7a0 update the todo 2012-12-13 13:10:34 +01:00
Miek Gieben 53dccfe5ed fix docs 2012-12-12 15:08:39 +01:00
Miek Gieben 235e892dfc Rename the RR types drop the RR_ prefix
This is also done in the official Go library. It also make the
code shorter.
2012-12-09 19:23:25 +01:00
Miek Gieben d618b07666 documentation 2012-12-02 09:15:10 +01:00
Miek Gieben acbbbdece5 Fix comment 2012-11-30 19:39:16 +01:00
Miek Gieben 3783f43fc3 documentation 2012-11-30 19:13:49 +01:00
Miek Gieben 27de9bad36 Actually parse the whole uint64 2012-11-19 12:26:13 +01:00
Miek Gieben 204a5c3981 hopefully somewhat better 2012-10-12 15:32:41 +02:00
Miek Gieben dce8b2e71a gofmt 2012-10-10 22:17:50 +02:00
Miek Gieben 10a349423c Fix tests and tsig in the process 2012-10-09 22:45:19 +02:00
Miek Gieben 570bf8dc69 Use proper error in packing and unpacking
All the relevant functions now return an error instead of
a simple boolean. This greatly approves the feedback to coders.

Spotted some fishy error handling along the way and fix that too.
2012-10-09 21:17:54 +02:00
Miek Gieben 915781ea86 Better naming 2012-09-11 21:45:21 +02:00
Miek Gieben 9fd69abe09 struct embedding 2012-09-05 16:31:48 +02:00
Miek Gieben e4fb00c34d Fix handling of non fully qualified domain names
When PackDomain sees such a name it calls panic.
All panic now use the prefix 'dns:'
2012-08-28 18:21:23 +02:00
Miek Gieben 68961f2f5b Make the IsTsig and IsEdn0 more usefull by returning the record 2012-08-25 11:24:01 +02:00
Miek Gieben 845f4a6992 dont export - minimize api 2012-08-24 12:42:41 +02:00
Miek Gieben b96e6ac78d tweaks to the documentation 2012-08-24 09:35:33 +02:00
Miek Gieben b0fc5a2f22 re-export these - I use them in unbound 2012-08-20 18:03:15 +02:00
Miek Gieben 1687a13438 Further minimize the lib 2012-08-20 09:39:10 +02:00
Miek Gieben 7b406f80ce dont export 2012-08-17 08:34:46 +02:00
Miek Gieben b1140cec5f dont export 2012-08-17 08:34:17 +02:00
Miek Gieben 20c84a80a7 Fix documentation 2012-08-08 09:50:07 +02:00
Miek Gieben 755bb11fde update the documentation 2012-08-08 09:26:29 +02:00
Miek Gieben 2d2b4f5e64 tweaks to give more power to unbound package 2012-07-01 20:58:54 +02:00
Miek Gieben 534433a714 gofmt -w 2012-06-20 20:16:36 +02:00