summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/net/publicsuffix/list.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2022-12-27 08:29:42 +0000
committerLibravatar GitHub <noreply@github.com>2022-12-27 08:29:42 +0000
commitb966d3b15712f645b53bc2396fdd29f4ce706850 (patch)
treeb86d17b6c153fd97d31b12bc581f83778101aa19 /vendor/golang.org/x/net/publicsuffix/list.go
parent[chore]: Bump codeberg.org/gruf/go-bytesize from 1.0.0 to 1.0.2 (#1285) (diff)
downloadgotosocial-b966d3b15712f645b53bc2396fdd29f4ce706850.tar.xz
[chore]: Bump github.com/gin-gonic/gin from 1.8.1 to 1.8.2 (#1286)
Bumps [github.com/gin-gonic/gin](https://github.com/gin-gonic/gin) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/gin-gonic/gin/releases) - [Changelog](https://github.com/gin-gonic/gin/blob/master/CHANGELOG.md) - [Commits](https://github.com/gin-gonic/gin/compare/v1.8.1...v1.8.2) --- updated-dependencies: - dependency-name: github.com/gin-gonic/gin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/golang.org/x/net/publicsuffix/list.go')
-rw-r--r--vendor/golang.org/x/net/publicsuffix/list.go36
1 files changed, 24 insertions, 12 deletions
diff --git a/vendor/golang.org/x/net/publicsuffix/list.go b/vendor/golang.org/x/net/publicsuffix/list.go
index 7caeeaa69..d56e9e762 100644
--- a/vendor/golang.org/x/net/publicsuffix/list.go
+++ b/vendor/golang.org/x/net/publicsuffix/list.go
@@ -101,10 +101,10 @@ loop:
break
}
- u := uint32(nodeValue(f) >> (nodesBitsTextOffset + nodesBitsTextLength))
+ u := uint32(nodes.get(f) >> (nodesBitsTextOffset + nodesBitsTextLength))
icannNode = u&(1<<nodesBitsICANN-1) != 0
u >>= nodesBitsICANN
- u = children[u&(1<<nodesBitsChildren-1)]
+ u = children.get(u & (1<<nodesBitsChildren - 1))
lo = u & (1<<childrenBitsLo - 1)
u >>= childrenBitsLo
hi = u & (1<<childrenBitsHi - 1)
@@ -154,18 +154,9 @@ func find(label string, lo, hi uint32) uint32 {
return notFound
}
-func nodeValue(i uint32) uint64 {
- off := uint64(i * (nodesBits / 8))
- return uint64(nodes[off])<<32 |
- uint64(nodes[off+1])<<24 |
- uint64(nodes[off+2])<<16 |
- uint64(nodes[off+3])<<8 |
- uint64(nodes[off+4])
-}
-
// nodeLabel returns the label for the i'th node.
func nodeLabel(i uint32) string {
- x := nodeValue(i)
+ x := nodes.get(i)
length := x & (1<<nodesBitsTextLength - 1)
x >>= nodesBitsTextLength
offset := x & (1<<nodesBitsTextOffset - 1)
@@ -189,3 +180,24 @@ func EffectiveTLDPlusOne(domain string) (string, error) {
}
return domain[1+strings.LastIndex(domain[:i], "."):], nil
}
+
+type uint32String string
+
+func (u uint32String) get(i uint32) uint32 {
+ off := i * 4
+ return (uint32(u[off])<<24 |
+ uint32(u[off+1])<<16 |
+ uint32(u[off+2])<<8 |
+ uint32(u[off+3]))
+}
+
+type uint40String string
+
+func (u uint40String) get(i uint32) uint64 {
+ off := uint64(i * (nodesBits / 8))
+ return uint64(u[off])<<32 |
+ uint64(u[off+1])<<24 |
+ uint64(u[off+2])<<16 |
+ uint64(u[off+3])<<8 |
+ uint64(u[off+4])
+}