Commit Graph

3599 Commits

Author SHA1 Message Date
Miek Gieben 388f6eea29
Tests updates (#556)
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.
2017-11-08 10:01:19 +00:00
Miek Gieben 813f928d53
readme: small bunch updates (#554)
Remove specifying the versions of Go, just say the last two, this is
getting stale every single time.
2017-11-07 17:37:25 +00:00
Miek Gieben 4bcc48899c
golint fixes (#553)
* golint fixes

Comment all RR with references to relevant RFC or other docs.
Some lint fixes in edns0.go.

* Some more fixes
2017-11-07 13:45:27 +00:00
Miek Gieben f73262699a
Add goreportcard badge (#552) 2017-11-07 11:23:24 +00:00
Miek Gieben 13c92255fe
codecov: add shield to README (#551) 2017-11-07 09:35:32 +00:00
Miek Gieben ae5ce096eb
codecov: add test coverage (#550) 2017-11-07 09:17:19 +00:00
Miek Gieben b38dc3dcb7
Cleanup: gofmt -w -s *.go (#548)
Some renames of internal names to make go lint happier.
2017-11-03 16:15:35 +00:00
Miek Gieben 348c84f37e
Test: remove all Logf/Log (#547)
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.
2017-11-03 15:50:01 +00:00
andrewtj 145266a717 Make compress generate output stable and edns.go formatting (#542)
* make compress_generate.go produce stable output

* go fmt edns.go
2017-11-03 14:41:20 +00:00
David McNett a5852667e3 Document SetTsig() needs to be final RRset change (#544)
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
2017-10-30 06:55:49 +00:00
Ethan J. Jackson 822ae18e71 Change quilt.io link in the README to kelda.io (#539)
The project renamed itself, so this patch updates the relevant link.
2017-10-19 07:42:25 +01:00
Neo Zhuo b02ebddc7f Add Apex in Users (#538) 2017-10-18 13:32:32 +01:00
Miek Gieben 54ceb83127 Optimize CompareDomainName (#535)
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.
2017-10-15 16:22:03 +02:00
sarneaud ca092a4398 Allow parsing resolv.conf from io.Reader (#532)
* 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
2017-10-15 16:18:44 +02:00
Star Brilliant f218fef126 Fix EDNS0_SUBNET compatibility with dig (#530)
Do not complain about AddressFamily=0, if SubnetNetmask is also 0.

Fixes issue #529
2017-10-13 18:04:01 +02:00
Star Brilliant 6f3c0a126c Fix EDNS Extended RCODE (#517)
* Fix EDNS Extended RCODE

Issue #516

* Fix EDNS Extended RCODE

Issue #516
2017-10-13 17:21:46 +02:00
kahnert be519e51ff Fix IXFR may end prematurely (#512) (#507)
Fix make IXFR work with single line answers (#507)
2017-10-13 17:21:31 +02:00
Tom Thorogood 5f64fb22f9 Simplify compressed length code (#527)
* Add BenchmarkMsgLengthNoCompression

* Simplify compressedLen loops

* Fix typo in compressionLenSlice
2017-10-13 17:21:12 +02:00
insomniac 9f7460ee9c Go version bump in CI (#534) 2017-10-13 08:57:18 +02:00
James Hartig 946bd9fbed Fix DialTimeout always using udp (#526) 2017-09-30 19:54:08 +01:00
insomniac aade52d68e Redesigned Client API around net.Dialer (#511)
* Redesigned Client API around net.Dialer

* Moved Dialer under Client; reverted msgHash; removed unneeded deprecation

* Reverted client_compat.go into client.go and renamed dialer variable

* Shortened comment lines

* Erroneously removed pointer declaration
2017-09-29 10:52:01 +01:00
James Hartig 032fbabc82 Correctly set the Source IP to the received Destination IP (#524)
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.
2017-09-29 10:38:26 +01:00
Richard Gibson eccf8bbe83 Correctly parse omitted TTLs and relative domains (#513)
* 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
2017-09-26 11:15:37 -04:00
Roland Bracewell Shoemaker 689d334b01 Implement EDNS(0) Padding option code (#520)
* Implement EDNS(0) Padding option code

* Fix EDNS0_PADDING.String
2017-09-21 13:50:49 +01:00
Miek Gieben e420576857 scan: Fix $INCLUDE arguments to parseZone (#508)
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.
2017-08-18 14:14:42 +01:00
Matthijs Mekking 0598bd43cf Fix TSIG bug releated to ID substitution (#504)
* 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
2017-08-12 20:21:44 +01:00
Tim Esselens bbca4873b3 variable shadowing of token (#503)
* Added test for $INCLUDE statement parser in zone files

* FIX: localized l to switch statement, shadowed later call to os.Open(l.token)
2017-08-08 15:19:10 -07:00
Pat Moroney 0f3adef2e2 document RCodes from the IANA registry (#499)
* document RCodes from the IANA registry

* added URL to IANA registry for DNS parameters
2017-07-21 08:02:54 -07:00
Lars Lehtonen 0559e6d230 Fix ignored err variables. (#498)
* Fix ignored err variables.

* Removed unneeded err return.
2017-07-08 23:56:13 -07:00
Jacob Hoffman-Andrews e46719b2fe Add ExchangeContext methods. (#497)
These obey the timeouts provided in a Context.
2017-06-30 04:44:44 -07:00
Miek Gieben e78414ef75 xfr: return sane error when !RcodeSuccess (#496)
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
2017-06-04 13:30:08 +01:00
Dmitriy Akulov fb6fbed0f5 Added dnsperf (#494) 2017-06-02 12:50:00 +01:00
everclear e8c11471fe Added new user (#495) 2017-06-02 12:47:46 +01:00
Alexey Palazhchenko 0c23f842c8 Use latest Go patch releases as well as tip. (#493) 2017-05-25 23:19:06 +01:00
Ray Bellis 193f91db0b Fix default response generation (#492)
- response Opcode must match request
- RD and CD semantics are only defined for QUERY
2017-05-24 15:34:52 +01:00
Miek Gieben babbdab23a parsing: error on unbalanced braces (#489)
When done parsing, check if we have balanced braces, if not error out.

Fixes #488
2017-05-23 11:21:56 +01:00
Miek Gieben f282f80e24 bump travis to 1.7/1.8 2017-05-01 16:26:13 +01:00
Danny Berger 113c7538ea Fix minor typos in comments (#486) 2017-04-26 18:46:52 +01:00
Roland Bracewell Shoemaker 6ebcb714d3 NSEC/3 Cover+Match cleanup (#479)
* Initial NSEC cleanup

* Use readable names

* Finish tests

* Use existing functions, simplify hash/zone split

* Make IsSubDomain case insensitive, add tests

* Use internal Split instead of strings.Split
2017-04-12 19:47:48 +01:00
Piper Chester dcffd061aa README: Fix typo (#483) 2017-03-31 07:08:51 +01:00
Miek Gieben 767422ac12 Add AVC record (#480)
See
https://www.iana.org/assignments/dns-parameters/AVC/avc-completed-template
for the template, a new record that is (again) a mirror of the TXT
record. For lack of a better name, name the rdata Txt - as we do in SPF
and TXT.
2017-03-29 22:17:13 +02:00
saurori 89d392d274 Fix large RSA exponent check (#481) 2017-03-29 21:52:38 +02:00
Richard Gibson c1bdeb82b2 Domain name limits (#478)
* 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
2017-03-29 20:43:02 +01:00
Tom Limoncelli b54e1be39a Add DNSControl to the list of users (#477) 2017-03-22 21:36:10 +00:00
andrewtj 765aea0018 Cover NSEC3 Salt and allow mixed case in NSEC3 NextDomain (#475)
* Add test to cover packing of NSEC3 salt

* Allow mixed case in NSEC3 NextDomain
2017-03-22 06:49:16 +00:00
Roland Bracewell Shoemaker fb16e4c487 Only pack NSEC3/NSEC3PARAM salt when it is not empty (#474)
* Only pack when salt is not empty

* Actually generate things properly

* Use string literal
2017-03-21 19:35:21 +00:00
Miek Gieben 25ac7f1714 Revert "limiting domain names to 255/63 octets/labels (#463)"
This reverts commit 0b729df06c.
2017-03-21 07:03:31 +00:00
Julius Rickert 2d7eb4f050 Fixed typo (#472) 2017-03-19 15:10:46 +00:00
Jon Nappi c862b7e359 Replace Atoi with ParseUint where appropriate (#470)
* replace Atoi with ParseUint where appropriate

* more Atoi replacements
2017-03-10 21:57:03 +00:00
Michael 59e593b27b Added coredns to list of users (#468) 2017-03-08 07:08:31 +00:00