Commit Graph

47 Commits

Author SHA1 Message Date
Tom Thorogood
c9b812d1d9 Remove redundant parenthesis (#727)
* Remove redundant parenthesis

These were caught with:
    gofmt -r '(a) -> a' -w *.go

This commit only includes the changes where the formatting makes the
ordering of operations clear.

* Remove more redundant parenthesis

These were caught with:
    gofmt -r '(a) -> a' -w *.go

This commit includes the remaining changes where the formatting does not
make the ordering of operations as clear as the previous commit.
2018-08-16 17:05:27 +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
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
Erik Dubbelboer
48ab6605c6 go fmt (#355) 2016-05-12 07:43:16 +01:00
Miek Gieben
84e9295e47 Improve docs on the label functions
Explicitly mention that the domain s must be valid before
given it to these functions.

Fixes: 306
2016-02-28 08:37:17 +00:00
tal@whatexit.org
808f9308ef Added new functions: TrimDomainName()/AddOrigin()
* TrimDomainName() Trims the domain off a FQDN.
  * AddOrigin() Adds a domain to a shortname or leaves a FQDN alone.
2016-01-25 12:08:29 -05:00
Miek Gieben
5b9c36bf67 Small doc cleanups 2015-08-23 12:55:01 +01:00
Miek Gieben
114b68f41b go vet fixes 2015-08-23 07:24:08 +01:00
Miek Gieben
e6b3ae712b extra docs 2014-09-21 07:43:46 +01:00
Miek Gieben
0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Alex Ciuba
e429f38a76 Overallocate label index buffer 2014-01-25 14:21:46 -05:00
Miek Gieben
e78a7436aa Check if the string is empty. 2014-01-18 22:02:49 +00:00
Miek Gieben
f938bc70df Remove long deprecated functions too 2013-09-30 20:24:18 +01:00
Miek Gieben
1f586fdcda Fixup PrevLabel and add a test 2013-09-12 09:58:42 +01:00
Miek Gieben
4ba292d8b6 Add a PrevLabel function to count back from the right 2013-09-12 09:36:39 +01:00
Miek Gieben
c67fc3a2a1 Add more tests for the labels 2013-09-12 09:18:54 +01:00
Miek Gieben
9764818db3 Make CountLabel faster
We don't need an allocation here, it works ok for non-fqdns and fqdns
2013-09-12 09:11:19 +01:00
Miek Gieben
b663a82eb3 Move deprecated function to the bottom of the file 2013-09-12 09:07:27 +01:00
Miek Gieben
8eb72eea8a Add . 2013-09-12 09:03:09 +01:00
Miek Gieben
08e7365dc2 Make SplitLabels faster
don't allocate a new string at all, it does not matter is the given
string is not fully qualified.
2013-09-12 08:57:37 +01:00
Miek Gieben
7ef3106262 Add panics to make older Go versions happy 2013-07-12 14:27:16 +00:00
Miek Gieben
55aa4480c7 Fix some typos 2013-06-27 19:46:26 +01:00
Ray Bejjani
9d2d8b36eb SplitDomainName handles non-FQDN labels correctly, doesn't return '.' in parts.
SplitDomainName would always include the '.' after each label segment. This was
inconsistent with the "." case (were it returned nil) and didn't seem too useful
since it required more processing to remove the '.' (like when building a
compression dictionary in Msg.Len() or Msg.Pack()). It also had issues with the
last segment, not including it in the split. It now returns all segments,
including the last, irrespective of the label being fully qualified.
A test has also been added to ensure no regressions.
2013-06-25 10:53:30 -07:00
Miek Gieben
45640bc8bd Slightly better documentation 2013-06-24 08:14:30 +00:00
Miek Gieben
38ea608d79 Rename the Label* functions
SplitLabels -> SplitDomainName
CompareLabels -> CompareDomainName
LenLabels -> CountLabel
          -> NextLabel was added as a simple iterator-like function
2013-06-22 07:21:15 +00:00
Miek Gieben
74a0da119d Uh uppercase it here too 2013-06-21 15:31:19 +00:00
Miek Gieben
ef73958b14 Make nextLabel public 2013-06-21 15:23:31 +00:00
Miek Gieben
9640d43c82 Make SplitLabels use Split 2013-06-21 15:17:12 +00:00
Miek Gieben
939abbfea7 Re-arrange some comments 2013-06-21 08:53:24 +00:00
Miek Gieben
a16b289765 Add todo 2013-06-20 20:36:13 +00:00
Miek Gieben
1d22bfdb4d Add more efficient label test functions
Also add tests for it.
2013-06-20 14:24:14 +00:00
Miek Gieben
cb1a259368 Add the first of faster/mem eff. labsl functions 2013-06-20 07:49:18 +01:00
Miek Gieben
81941d4422 Update all copyright notices 2013-05-12 16:15:52 +02:00
Miek Gieben
a2d98be202 lowercase the names 2012-09-04 20:08:55 +02:00
Miek Gieben
af2f485c8e Fix IsSubDomain 2012-07-16 19:16:36 +02:00
Miek Gieben
393719d659 Add LenLabels function - no allocations 2012-07-16 08:51:39 +02:00
Miek Gieben
89c05b4f74 gofmt 2012-02-23 19:37:08 +01:00
Miek Gieben
95ffaca79d typo 2012-02-14 22:43:04 +01:00
Miek Gieben
827e4a476f Force the root label to have 0 labels 2012-02-14 22:26:18 +01:00
Miek Gieben
2cb265697e Documentation
Need to think about the non-existing root-label and the label
functions.
2012-02-12 11:34:28 +01:00
Miek Gieben
09ac6c8dc5 gofmt 2012-01-28 00:35:37 +01:00
Miek Gieben
a61018d628 Allow quotes backslashes in names 2012-01-27 23:37:57 +01:00
Miek Gieben
99d2040a29 Fix escpaping in labels 2012-01-27 17:37:30 +01:00
Miek Gieben
b7466bd85d Remove this function again 2012-01-11 08:51:43 +01:00
Miek Gieben
79d092bd29 One more helper function for compression 2012-01-10 16:34:14 +01:00
Miek Gieben
8f8633d9a0 Better documentation 2012-01-10 16:04:32 +01:00
Miek Gieben
d2acd22822 Add label functions and tests 2012-01-10 15:55:52 +01:00