Documentation ¶
Overview ¶
Package filterutil contains helper functions used by urlfilter
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractHostname ¶
ExtractHostname quickly retrieves hostname from the given URL.
NOTE: ExtractHostname is an optimized, best-effort function to retrieve a hostname from a URL-like string. The result is not guaranteed to be correct for some edge cases, which include non-hierarchical URLs and IPv6 hostnames.
TODO(a.garipov): Consider moving to golibs.
func FastHash ¶ added in v0.15.0
FastHash implements the djb2 hash algorithm.
TODO(e.burkov): Inspect all uses. Perhaps use maphash.
func FastHashBetween ¶ added in v0.15.0
FastHashBetween implements the djb2 hash algorithm.
func IsDomainName ¶ added in v0.12.0
IsDomainName - check if input string is a valid domain name Syntax: [label.]... label.label
Each label is 1 to 63 characters long, and may contain:
. ASCII letters a-z and A-Z . digits 0-9 . hyphen ('-')
. labels cannot start or end with hyphens (RFC 952) . max length of ascii hostname including dots is 253 characters . TLD is >=2 characters . TLD is [a-zA-Z]+ or "xn--[a-zA-Z0-9]+"
func IsProbablyIP ¶ added in v0.17.0
IsProbablyIP returns true if s only contains characters that can be part of an IP address. It's needed to avoid unnecessary allocations when parsing with [netip.ParseAddr].
Types ¶
This section is empty.