Commit Graph

296 Commits

Author SHA1 Message Date
Miek Gieben 9bf52083d1 golint fixes 2015-08-23 08:03:13 +01:00
Miek Gieben 21b35db538 Remove the NSAP record
The NSAP was not implemented correctly, see #239. Just remove it. It will still work as unknown RR.
2015-08-10 07:26:35 +01:00
Miek Gieben bbe3422804 small doc fixes 2015-08-09 15:34:29 +01:00
Miek Gieben 2839b93f6b merge conflict 2015-07-28 21:45:20 +01:00
Miek Gieben 179a68fbec Some small fixes 2015-07-27 22:12:46 +01:00
Miek Gieben a34cf6798a Fix URI record
When the URI record became an RFC they slightly changed the format.
Make the needed changes.
2015-07-21 07:47:38 +01:00
Roland Shoemaker 3d5407e128 Fix CAA packing bug 2015-07-07 20:20:25 +01:00
Miek Gieben 2f503031b0 Rename to ReadMsgHeader
Slightly more descriptive and remove the underscore of _DNSHeaderSize
and call is headerSize.
2015-07-03 09:31:53 +01:00
Alex Sergeyev b0d6ff308e Fixed things found in code review (comments, semantics). 2015-07-02 22:42:02 -04:00
Alex Sergeyev 53dfadf090 Shortened ReadMsg using ReadMsgBytes, added a constant. 2015-06-28 20:21:37 -04:00
Roland Shoemaker 020002b9e0 Switch setCAA, CAA.String to presentation format, add various encoding helpers 2015-06-17 16:06:31 -07:00
Roland Shoemaker 1995ce2be4 Fix unpacking 2015-06-16 13:55:19 -07:00
Roland Shoemaker 522331911d Enable CAA parsing 2015-06-16 02:01:28 -07:00
Alex Sergeyev 32bf0823e2 Support for almost all possible ways to format HINFO record 2015-05-07 12:09:05 -04:00
Alex Sergeyev 2e9176243e Updated NSAP support according to RFC1706
New text format 0x and no more length in the object itself.
2015-05-07 10:18:47 -04:00
Miek Gieben adbd535787 Small doc update 2015-02-20 11:42:29 +00:00
Miek Gieben 574544eb08 Documentation updates 2015-02-20 11:39:15 +00:00
Miek Gieben 1f764075b6 Golint find, remove float64 2015-02-19 11:41:12 +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
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
Miek Gieben 7777789184 Some remarks on wks 2015-01-13 10:39:13 +00:00
Miek Gieben 5d8dbab4c8 Remove the fmt Formatters
Formatters are not needs you can access the members just fine.
However the rdata Field access function are handy and non-trivial,
extend them and add a basic test.
2015-01-13 10:20:34 +00:00
John Graham-Cumming 3e97ddb0e0 Add tests for LOC record String() generation and fix small problems
Added tests for the cmToM function to make sure that it's output is
correct. Modified the way the Altitude is written to a string. Previously,
if the altitude was an exact number of meters it would always be reported
with two decimal places. This is not needed. Conversely if it was not
an exact number of meters the cm were removed.
2014-12-10 13:39:58 +00:00
Hugo Landau d170819bc7 Remove extraneous spaces in String() methods
Some types append a space after Hdr.String(). However, since Hdr.String() appends its own space, this leads to the output of two spaces.
2014-11-28 19:12:16 +00:00
Miek Gieben d33af8db79 Update test and gofmt 2014-11-09 16:09:49 +00:00
Miek Gieben eff0e9354f Apply 433ab7b569 here too
The same Sprintf was used here, so this can be optimized as well.

Thanks to @andrewtj for the ping.
2014-11-09 08:03:03 +00:00
Miek Gieben deb8fe381f Cleanup the identical parsing functions.
Some records are copies from others: DNSKEY, CDNSKEY and KEY are
identical. DS, CDS and DLV are too and even RRSIG and SIG.

The parsing functions and the definition can all be used for parsing
all these identical types.
2014-11-02 11:29:55 +00:00
Miek Gieben 678d31fa77 Merge branch 'master' of github.com:miekg/dns 2014-11-02 11:12:07 +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
Andrew Tunnell-Jones 91b8c69a22 Implement SIG(0) signing and verification
This is based on @miekg's sig0 branch. That branch diverged from master
and I didn't want to wander off on a rebase.

As implemented there's no allowance for multi-envelope (TCP) support.

TODO:

* unpackUint32() could be moved out and used elsewhere
* tests
* multi-envelope support (if useful)
2014-11-01 11:32:46 +00:00
Miek Gieben 6bbae6c6ea Add CDNSKEY support 2014-10-23 22:18:23 +01:00
Alex Sergeyev efb2e66078 Added support for mnemonic names in CERT rr
This behavior matches what bind does with thir formatting.
2014-10-07 21:27:25 -04: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 3d8aa78c0a Merge pull request #127 from asergeyev/txtescapezscan
Fixed TXT parsing with escaped chars
2014-09-12 07:18:46 +01:00
Alex Sergeyev ae7d973e40 Updated code to handle escapes in TXT RDATA
Added test demonstrating error in TXT parsing.
Fixed lexing process and slightly updated conversion
back to strings.

See #126 for details.
2014-09-11 21:23:38 -04:00
Miek Gieben 0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben 4d3dac9c36 Add the OPENPGPKEY RR. 2014-08-14 09:18:08 +01:00
Miek Gieben fb3a1585ad fmt 2014-07-27 20:38:11 +01:00
Miek Gieben b691354313 Add OPENPGPKEY, but without type code 2014-07-24 09:29:42 +01:00
Miek Gieben b7a8c14d7d Add dns.Name as a type
This can be used for printing names.
2014-04-23 21:06:17 +01:00
Miek Gieben 6295f64c1c Make sprintDomain public as NameToString 2014-04-23 20:58:55 +01:00
Miek Gieben 2dc3e40828 add TODO 2014-04-23 20:54:17 +01:00
Andrew Tunnell-Jones 38d78bafe4 Escape @ when printing/unpacking domain names 2014-03-01 22:30:52 +00:00
Andrew Tunnell-Jones 6fd4d29ced Fix bounds overflow in sprintTxt
Passing excessively long strings (>256*4+3) to sprintTxt would result in
overflowing src. Fix isn't as efficient but simplifies the code.
2014-03-01 02:42:47 +00:00
Andrew Tunnell-Jones 0c98da613d Fix bounds check in nextByte 2014-03-01 02:37:24 +00:00
Andrew Tunnell-Jones 3f834a04fb Update domain name and TXT string escape behaviour
Changes to domain name packing and unpacking:
* Escape dot, backslash, brackets, double-quote, semi-colon and space
* Tab, line feed and carriage return become \t, \n and \r

Changes to TXT string packing and unpacking:
* Escape backslash and double-quote
* Tab, line feed and carriage return become \t, \n and \r
* Other unprintables to \DDD

Stringers do the equivalent of putting domain names and TXT strings
to the wire and back.

There is some duplication of logic. I found performance suffered when
I broke the logic out into smaller functions. I think this may have
been due to functions not being inlined for various reasons.
2014-02-26 10:55:11 +00:00
Miek Gieben 87b380cad5 Revert "Use dLen for domain name length"
This reverts commit b595183834.

Fix up the tests too.
2014-02-14 20:20:22 +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