Commit Graph

8 Commits

Author SHA1 Message Date
Richard Gibson 978b9a827a
Be consistent about domain name label character escaping (#1122)
* 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
2020-07-06 10:07:56 +02:00
Alex Fattouche b28dcc1849
Fix URI and CAA parsing on quotes and backslashes. (#1101) (#1104)
Automatically submitted.
2020-05-13 19:24:22 +00:00
Charlie Vieth e393768b85 types: improve the performance of sprintName by ~30% and halve allocs (#1008)
```
benchmark                                          old ns/op     new ns/op     delta
BenchmarkSprintName-12                             174           117           -32.76%

benchmark                                          old allocs     new allocs     delta
BenchmarkSprintName-12                             2              1              -50.00%

benchmark                                          old bytes     new bytes     delta
BenchmarkSprintName-12                             48            32            -33.33%
```
2019-09-23 07:17:00 +01:00
Tom Thorogood 39e689aa4a Fix String formatting of RP record (#914) 2019-02-28 06:28:44 +00:00
Tom Thorogood 0d29b283ac
Optimise sprintX functions in types.go (#757)
* Simplify appendByte

* Add test case and benchmark for sprintName

* Add test case and benchmark for sprintTxtOctet

* Add test case and benchmark for sprintTxt

* Use strings.Builder for sprint* functions in types.go

* Use writeByte helper in unpackString

* Rename writeByte to writeEscapedByte

This better captures the purpose of this function.
2018-10-06 02:06:59 +09:30
Miek Gieben 9cfd42f1df
Tests: add ListenAndServe tests (#562)
This increases the test coverage as these methods where not tested.
Add some cosmetic changes to the mix.
2017-11-10 10:11:23 +00:00
Miek Gieben 46df8c9462 Fix for miekg/dns issue #289: support the SMIMEA record (#410)
1) Refactoring of tlsa.go
   - moved routine to create the certificate rdata to its own go module
     as this is shared between TLSA and SMIMEA records
2) Added support for creating an SMIMEA domain name
3) Developed in accordance with draft-ietf-dane-smime-12 RFC

Miek,

Submitting for your review. Happy to make any recommended changes or
address omissions.

Lightly tested against our internal DNS service which hosts DANE
SMIMEA records for our email certificates.

Parse tests are added.
2016-10-17 18:09:52 +01: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