* Improve sprintName tests
* Fix sprintName handling of escaped dots
* Make sprintName consistently drop dangling incomplete escapes
* Be consistent about domain name label character escaping
Fixes#1121
* Replace strings.IndexByte with faster special-purpose function
* fix check for bad offset on 32 bit systems
* parse integers into int64 rather than platform dependent ints
Co-authored-by: Michael Hudson-Doyle <Michael Hudson-Doyle michael.hudson@ubuntu.com>
* Implements ExchangeWithConn, a function that allows callers to pass in a connection instead of having the library create a new one for them. Exchange now wraps around this, implementing the existing behavior by creating a new connection and passing it to ExchangeWithConn. c.exchange has been updated to support this behavior as well.
* adding tab
* formatting problem
* adds test case for ExchangeWithConn
Paraphrase @miekg's response to emphasize that multiple
questions in the question section of a DNS message
is not supported in practice.
refs miekg/dns#1092
Co-authored-by: Adam Chalkley <atc0005@users.noreply.github.com>
* add Canonical function to get name in canonical form
* replace strings.ToLower with Canonical
* rename Canonical to CanonicalName
* replace Fqdn with CanonicalName in ServeMux
* Fixed the default values of HorizPre and VertPre
According to RFC-1876 those fields should be:
"a pair of four-bit unsigned
integers, each ranging from zero to nine, with the most
significant four bits representing the base and the second
number representing the power of ten by which to multiply
the base. This allows sizes from 0e0 (<1cm) to 9e9
(90,000km) to be expressed"
Current values for HorizPre and VertPre (165=0xA5 and 162=0xA2)
are incorrect because the first HEX digit is greater then 9
The default values should be:
HorizPre = 10000m = 10000 * 100 cm = 10^6 = 0x16
VertPre = 10m = 10 * 100 cm = 10^3 = 0x13
Size = 1m = 1 * 100 cm = 10^2 = 0x12
The value of Size was correct, but this PR changes it to HEX
representation to be more readable
* Informative comments
Made comments on LOC record default field values more informative
Co-Authored-By: Richard Gibson <richard.gibson@gmail.com>
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
* Doc updates
Was reading https://pkg.go.dev/github.com/miekg/dns?tab=doc and spotted
some types and things to could be slightly better.
Make v unexported, as this version stuff should not be part of the
public API.
Signed-off-by: Miek Gieben <miek@miek.nl>
* fix test
Signed-off-by: Miek Gieben <miek@miek.nl>
* APL record: add structure and code point
* APL record: add wire format support
* APL record: add presentation format support
* APL record: add isDuplicate implementation
* APL record: add copy implementation
* APL record: add len implementation
* APL record: run go generate
* APL record: fix condition checking for equality
* APL record: use switches to map family to address length
* APL record: check bounds of individual fields rather than whole header
* APL record: stylistic changes
* APL record: remove APLPrefix methods from public interface
* APL record: update README
* APL record: additional cleanup for code review
* APL record: change return type from pointer to struct
* APL record: refactor of pack and unpack to eliminate extra variables
* Support the zero length EDNS0 EXPIRE option
* EDNS0 EXPIRE: Just reference the RFC, don't link to it
Co-Authored-By: Miek Gieben <miek@miek.nl>
Co-authored-by: Miek Gieben <miek@miek.nl>
* doc: fix xfr example.
The currently example code has a data race, put in the proper code.
Fixes: #1061
Signed-off-by: Miek Gieben <miek@miek.nl>
* Feedback
Signed-off-by: Miek Gieben <miek@miek.nl>
* Doc fixes
Polish the docs a bit; fix a link to miek.nl, remove edns0client subnet
draft link and point to the RFC. Some layout fixes and pull GOPATH from
the readme as we do go modules now.
Signed-off-by: Miek Gieben <miek@miek.nl>
* review comments
Signed-off-by: Miek Gieben <miek@miek.nl>
This license file is not being recognized by Github, nor by the new
google golang thingy recently launched. Don't remove those lines just
yet, but put them at the bottom
Signed-off-by: Miek Gieben <miek@miek.nl>
git shows:
git shortlog -sne | head
3311 Miek Gieben <miek@miek.nl>
157 Tom Thorogood <me+github@tomthorogood.co.uk>
39 Alex Sergeyev <asergeyev@dyn.com>
37 Andrew Tunnell-Jones <andrew@tj.id.au>
34 Filippo Valsorda <filippo@cloudflare.com>
21 Rafael Dantas Justo <rafael@registro.br>
19 Michael Haro <mharo@google.com>
14 Alex Sergeyev <abc@alexsergeyev.com>
13 chantra <chantra@users.noreply.github.com>
11 Alex Ciuba <alexciuba@gmail.com>
I took the top 2, but happy to extend this obvs.
Signed-off-by: Miek Gieben <miek@miek.nl>
Replace all the private methods in the EDNS0 with public methods.
Additionally, as suggested in issue #857, made Pack receive a
pre-allocated byte array, introduce a Len method, and have Pack
and Unpack return the number of octets written and read (respectively)
if there was no error.
Closes#857
* change NextLabel and PrevLabel to be faster
This reduces readability, but they are in the hot path of coredns.
* @redyeti pointed out, that my implementation disregarded triple backslashes
* add synthetic benchmark-tests for PrevLabel and NextLabel
* rename ii -> j
* invert compare
* PrevLabel: add empty string check + test case
* NextLabel: fix and add testcase for NextLabel("", offset>0)
While the range number of GENERATE is now limited, one can pass
a line with 2 $GENERATE directive that will exponentially increase the
time spent generating RRs.
Limit to only one per line.
Fixes#1020