Commit Graph

20 Commits

Author SHA1 Message Date
Tom Thorogood b6ecf29d98 Improve performance by addressing some low hanging fruit. (#444)
* Remove unused bytes.Buffer from dns/idn.encode.

This buffer is truncated and written to but never read from. It
serves no purpose and all tests pass with it removed.

It appears to have been introduced when puncycode.go was first
added in miekg/dns@e3c2c07.

* Produce less pointless garbage.

This change:
- removes several needless []byte -> string conversions,
- removes two needless append calls in HashName, and
- writes the hash to the same nsec3 []byte in HashName rather
  than creating a new []byte on each of the k iterations.

These are all minor performance improvements that will likely
go entirely unnoticed. The changes will reduce the ammount of
garbage produced when calling CertificateToDANE, HashName,
(*SIG).Sign and TsigGenerate.
2017-02-02 07:33:49 +00:00
Masayoshi Sekimura a14e77725f tidyup a little with the latest golang.org/x/tools/cmd/vet 2015-09-29 23:04:25 -07:00
Erik Dubbelboer 6b8b49f49d Do simple prechecks to avoid heap allocations 2015-08-13 04:50:02 +00:00
Rafael Dantas Justo 7ed808b59f Avoid rune overflow when converting to unicode 2015-08-10 08:57:07 -03:00
Miek Gieben e220dd92fd Add test the crashes idn. 2015-08-10 07:36:10 +01:00
Rafael Dantas Justo c1abafe6ad add final dot in function comment 2015-07-17 07:17:18 -03:00
Rafael Dantas Justo 0ec31bb825 encode function should return nil when an invalid character is detected and
ToPunycode function should return an empty string when there's an invalid
domain name
2015-07-16 13:02:51 -03:00
Rafael Dantas Justo 4071a397d6 drop idna from names as we already are in the idn package and also avoid "else
if" when it's not necessary
2015-07-16 08:05:25 -03:00
Rafael Dantas Justo 0096e2aae0 moving logic from idna_table.go to punycode.go 2015-07-15 16:28:22 -03:00
Rafael Dantas Justo 340d862d2f check label for invalid code points according to RFC 5892, appendix B.1 2015-07-15 15:13:19 -03:00
Alex Sergeyev 3373659843 Addressed #198, correct decoding should only look at last separator. 2015-04-03 23:49:35 -04:00
Miek Gieben a8b5ce58e5 Small cleanups 2014-09-18 09:11:16 +00:00
Alex Sergeyev c37add8d9e Prevented crash on empty string to our funcs +...
* changed encodeBytes to encode and decodeBytes to decode
* fixed few comments
2014-09-15 09:02:51 -04:00
Alex Sergeyev c38aeeb355 Declared variables prior to entering main conversion loops 2014-09-15 08:43:08 -04:00
Alex Sergeyev d42c1e2bbc Replaced rune(0) to new const 2014-09-15 08:38:01 -04:00
Alex Sergeyev 950dac05e5 Changed label splitting and fixed behavior for final period in names. 2014-09-15 08:23:08 -04:00
Alex Sergeyev c383d91f69 Added package header. 2014-09-15 07:52:58 -04:00
Alex Sergeyev 61db5487dd Updated Punycode funcs
* docstrings
* changes to handling invalid punycode names
* updated tests
2014-09-13 22:11:53 -04:00
Alex Sergeyev e59305ec87 Fixed panic calls to be similar to others in library 2014-09-12 07:52:33 -04:00
Alex Sergeyev a906600891 Moved things to subdir and adding functions to convert strings. 2014-09-12 07:52:33 -04:00