Miek Gieben
9d8cd1bfd9
Test parsing empty target
2015-07-28 07:20:54 +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
ce1812cfaf
Add byte packing/unpacking test
2015-07-20 13:21:13 -07:00
Roland Shoemaker
020002b9e0
Switch setCAA, CAA.String to presentation format, add various encoding helpers
2015-06-17 16:06:31 -07:00
Alex Sergeyev
0bc16d74c9
Added comment to commented-out testcase
2015-05-07 12:12:39 -04: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
Alex Sergeyev
d2bed60478
Fixed SSHFP parsing when multiple lines used for text representation.
2015-05-07 09:50:44 -04:00
Miek Gieben
03d7235729
Add TLSA parsing tests
2015-05-07 12:47:42 +01:00
Miek Gieben
8bcf792243
Playing with TLSA records
2015-05-07 07:42:55 +01:00
Alex Sergeyev
627287e675
Issue with TLSA parsing identified
2015-05-06 23:25:33 -04:00
Miek Gieben
12197b977e
In TXT records break up large chunks in 255 bytes
...
TXT records consist out of multiple 255 byte chunk. When parsing
a chunk that is too large, Go DNS would happily add it. This would
only fail when packing the message.
Change this to auto-chunking when reading the TXT records from file
into 255 byte sized chunks.
2015-03-04 09:33:37 +00:00
Michael Haro
6b54d9f863
Revert "Use gofmt to simplify code"
...
This reverts commit 48dce403d5
.
2015-02-26 01:48:30 -08:00
Michael Haro
7f051930ff
Use %v as the format arg for errors
2015-02-26 00:49:59 -08:00
Michael Haro
48dce403d5
Use gofmt to simplify code
2015-02-26 00:38:33 -08:00
Michael Haro
4437868b75
Replace t.Logf("%s", var) with t.Log(var)
2015-02-26 00:30:40 -08: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
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
50890090cb
Merge branch 'ipseckey'
...
Tentatively merging.
2015-01-27 08:17:50 +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
Filippo Valsorda
e9faa971b3
Refactor the DNSSEC private key code
...
Now PrivateKey is an interface exposing Sign() and String(). Common
implementations are wrappers for {rsa|dsa|ecdsa}.PrivateKey but
this allows for custom signers, and abstracts away the private-ops
code to a single place.
2015-01-23 13:04:29 -08:00
Miek Gieben
733a2d3822
Remove code, fix doc and fix test
2015-01-13 11:43:57 +00:00
Miek Gieben
aa1047c551
Remove format test
2015-01-13 10:21:50 +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
Miek Gieben
9c3a117004
Add some more string conversion
2015-01-12 22:33:49 +00:00
Miek Gieben
59ad100e22
Need to implement some more verbs as well
2015-01-12 09:54:56 +00:00
Miek Gieben
735efcbd10
Allow access (as strings) to the rdata of each RR
2015-01-11 21:01:54 +00:00
Miek Gieben
1e8afcf787
Fix the tests, add the %s verb as well
2015-01-11 17:55:39 +00:00
Miek Gieben
aaa3aba4ed
Implement custom verbs for fmt.Printf use
...
The dns package implements String() for all RR types, but sometimes you will
need more flexibility. The functions Printf, Sprintf, etc. implemented formatted I/O
for the RR type.
Printing
The verbs:
Generic part of RRs:
%N the owner name of the RR
%C the class: IN, CH, CLASS15, etc.
%D the TTL in seconds
%Y the type: MX, A, etc.
The rdata of each RR differs, we allow each field to be printed as a string.
Rdata:
%0 the first rdata field
%1 the second rdata field
%2 the third rdata field
.. ...
%9 the nineth rdata field
%R all rdata fields
The rdata fields remain a TODO, but will be implemented using
reflection.
2015-01-11 17:23:02 +00:00
Miek Gieben
5bde7ab7ea
Put the zscan_test.go in parse_test.go
2015-01-11 09:20:04 +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
Filippo Valsorda
c47471f80e
[DNSSEC] Make int to bytes conversions fixed length in DSA (RFC 2536)
...
This fixes DSA key generation.
2014-12-06 10:26:56 +00:00
Filippo Valsorda
bcc05715b3
Make some ECDSA failures more informative/accurate
2014-12-05 18:39:06 +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
5fc7e36983
go test -short
...
Added a bunch a long running test function to the list of skipped
tests when giving -short to go test. Tests are bascially *all*
DNSSEC key generation tests and 1 serving test.
PASS
ok github.com/miekg/dns 0.782s
Compared to 13+ s, so quite a bit faster.
2014-11-12 10:19:20 +00:00
Miek Gieben
a8bb44f5e5
Move tests and start update_test.go
...
Put the update tests in a seperate file.
2014-11-09 09:56:22 +00:00
Miek Gieben
d05369e629
tests: remove parse_test.db
...
Make it an string inside the test file and use strings.NewReader.
2014-10-06 07:45:31 +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
cf89d7a324
Remove Copyrights from there
2014-09-11 20:53:14 +01:00
Miek Gieben
518ab47648
Move the tests into the existing _test.go files.
2014-09-11 20:49:20 +01:00
Miek Gieben
5fd5c6d9eb
And actually fix the parsing
2014-08-30 08:44:16 +01:00
Miek Gieben
cbb9881e96
Parse dynamic update RR in presentation format
...
Don't panic when encountering dynamic update RRs in zonefiles.
There are some other failure cases when parsing, those will be
fixed in subsequent commits.
Closes #110
2014-08-30 07:34:05 +01:00
Miek Gieben
f6c7c65fc4
Merge branch 'master' of github.com:miekg/dns
2014-08-29 09:42:53 +00:00
Miek Gieben
cfa561ed85
Add TestDynamicUpdateParsing test
2014-08-29 09:42:43 +00:00
Alex Sergeyev
1959cc8421
Added tests to support mixed case Type and Class
2014-08-28 13:05:05 -04:00
Alex Sergeyev
84d9ad0a39
Fixed typo in "tokens"
2014-08-28 12:59:54 -04:00
Alex Sergeyev
476d122030
Changed test for lowercase tokens; improved code:
...
* for cases if $ORIGIN or $TTL are used in mixed case
* changed test name too
2014-08-28 12:59:54 -04:00
Alex Sergeyev
d1ea8497ad
Added couple failure tests for lowercase class/type
2014-08-28 12:59:54 -04:00
Alex Sergeyev
66342f4ea2
Added test to verify RRSIG type covered in mixed case.
2014-08-28 12:59:54 -04:00
Alex Sergeyev
755a8483b6
Committing @miekg patch from gist.
...
https://gist.github.com/miekg/f1b1fe6dba7d6b088eec
2014-08-28 12:59:54 -04:00
Alex Sergeyev
e9bffe6796
Added lowercase test strings with RR class omitted
2014-08-28 12:59:54 -04:00
Alex Sergeyev
0df460c0fa
Added lowercase RR tests where TTL is in play too.
2014-08-28 12:59:54 -04:00
Alex Sergeyev
f40b966c47
Added lowercase RRClass and RRType tests per #108 .
...
... need to add RRSIG covering type lowercased later.
2014-08-28 12:59:54 -04:00
Miek Gieben
f5fe400c53
Lowercase all test output.
...
Add Shutdown tests as well
2014-08-19 08:39:04 +00:00
Miek Gieben
4d3dac9c36
Add the OPENPGPKEY RR.
2014-08-14 09:18:08 +01:00
Miek Gieben
fc67c4b981
Add Class parsing test function
2014-06-15 20:40:34 +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
bbd975571c
tests: fix for 32 bit platforms
...
On 32 bits the tests would fail with an out of bounds error (in the
tests).
2014-04-10 13:40:37 +00:00
Miek Gieben
8f8b675103
Add better parsing test
2014-04-06 09:29:42 +01:00
Miek Gieben
abe6de223d
Add some more checks
2014-04-05 08:06:49 +01:00
Miek Gieben
3b785244ab
Add test for parsing a packet
2014-04-04 19:33:50 +01:00
Miek Gieben
7aaa2f5a4f
Merge branch 'master' of github.com:miekg/dns
2014-03-02 16:48:55 +00:00
Miek Gieben
541776149c
Merge pull request #85 from andrewtj/atj-encoding
...
Parsing and Stringer Changes
2014-03-02 16:48:46 +00:00
Miek Gieben
28a65aaf87
test: enable txt equal test
...
This test fails, but stops failing when I merge pull request #85 .
2014-03-02 16:47:52 +00:00
Andrew Tunnell-Jones
588a52762d
Test byte escaping in Domain Names and TXT strings
...
TestTXTRRQuick may not always cover these bytes so explicitly test that
they're covered.
2014-03-02 10:37:07 +00:00
Andrew Tunnell-Jones
22f3256df4
Bump up MaxCountScale in TestTXTRRQuick
...
Increases number of test iterations which should cover more corner-cases.
2014-03-02 10:15:26 +00:00
Miek Gieben
2ea84f6110
Add test for upcoming txt changes
2014-03-01 07:34:44 +00:00
Andrew Tunnell-Jones
f6d8a66c01
Add quick tests for domain name and TXT rr
2014-02-26 10:52:48 +00:00
Andrew Tunnell-Jones
c500de0e7a
Fix HIP record unpacking
...
* limit decoding of Hit to HitLength
* limit decoding of PublicKey to PublicKeyLength
* limit decoding of RendezvousServers to rdata's length
2014-02-22 05:28:48 +00:00
Andrew Tunnell-Jones
158454ada4
Test packing label ending in escaped dot
2014-02-15 00:37:57 +00:00
Miek Gieben
82b2b6ec82
QuoteToASCII is needed
...
When not using this, TXT strings get interpreted by Golang, making
TXT behave unexpected. QuoteToASCII has surpises too, see
TestTxtEqual(), but this, I hope, lesser of an issue.
2014-01-11 17:17:38 +00:00
Miek Gieben
a49cd38336
Add quoteString function.
...
This is to just quote a string s -> "s"
2014-01-11 16:57:36 +00:00
Miek Gieben
3bd18e9a56
add test for matching text records
2014-01-11 16:32:08 +00:00
Miek Gieben
ef732d1050
RRSIGs: parse epoch timestamp too
...
According to RFC4034 the timestamp in RRSIG may also be an EPOCH.
Check for this when parsing. Knot DNS zone dumps contain timestamp
RRSIG, this makes those parseable by Go DNS.
2014-01-11 08:50:10 +00:00
Miek Gieben
c174304212
Add test for RRSIG with timestamp in epoch
...
This is standard's compliant but currently not supported.
2014-01-11 08:37:34 +00:00
Miek Gieben
f3af5834c2
Also add empty txt record in another test
2014-01-11 08:12:13 +00:00
Andrew Tunnell-Jones
938210c3ad
Test parsing of TXT records containing empty-strings
2014-01-11 05:31:43 +00:00
Andrew Tunnell-Jones
91f31a2b71
Define length in multi-entry TXT parse length test in terms of header + rrdata
2014-01-11 05:30:46 +00:00
Andrew Tunnell-Jones
4584fc0cb3
Fix single-entry TXT parse length test
2014-01-11 05:28:47 +00:00
Miek Gieben
1f2f21480f
merged
2013-12-05 19:46:03 +00:00
Miek Gieben
186871d2a9
Add check for > maxUint16 sizes TYPEXXXX or CLASSXXX
...
These were silently wrapped in a uint16, nicer to actually give
an error.
2013-12-05 09:54:46 +00:00
Miek Gieben
bc4b2fe244
Name this test better
2013-12-05 07:48:13 +00:00
Miek Gieben
792fd9743e
Allow for escape spaces in NewRR
...
Fix omission in NewRR where the parsing does not allow for
escaped spaces (unless \032 was used).
2013-12-03 09:12:21 +00:00
Miek Gieben
8fec6dd3a3
Use *Token instead of Token when parsing
...
This result in a 10% speedup when parsing a zone from disk.
2013-11-09 19:34:46 +00:00
Miek Gieben
ff7806469c
Implement EID and NIMLOC records
2013-10-19 21:31:12 +01:00
Miek Gieben
faf449027a
small tweak in the test
2013-10-19 19:49:16 +01:00
Miek Gieben
b435d836c6
gofmt
2013-10-15 14:21:47 +00:00
Miek Gieben
35bcc78d76
Implement PX record
2013-10-13 13:23:02 +01:00
Miek Gieben
cc2c42cc91
Implement GPOS record
2013-10-13 13:01:33 +01:00
Miek Gieben
961e137891
Add NSAP and NSAP-PTR record
2013-10-13 12:25:08 +01:00
Ask Bjørn Hansen
8418a22857
Whitespace cleanup
2013-09-20 08:15:27 -07:00
Miek Gieben
b76ac5bde6
Fix the test
2013-09-12 08:14:42 +01:00
Miek Gieben
ee8ace0477
Merge branch 'master' of github.com:miekg/dns
2013-09-11 08:22:23 +01:00
Miek Gieben
32b15d1807
Add more IsDomainName tests
2013-09-11 08:22:20 +01:00
Miek Gieben
9c1ee5d5ca
Update IsDomainName
...
This new functions just compiles the domain to wire format, if that
works, the name is deemed OK. It is also much less strict than the
older code. Almost everything is allowed in the name, except two
dots back to back (there is an explicit test for that).
2013-09-10 18:09:22 +00:00
Miek Gieben
a5ac1f46ee
...and fix the imports for the test files
2013-09-09 22:20:48 +01:00