Documentation
¶
Index ¶
- Constants
- Variables
- func CreateList(timeout int64) map[string]struct{}
- func CreateNewCacheFile(fqdn string, urls []string, timeout int64) (map[string]struct{}, error)
- func DownloadFile(url string, timeout int64) ([]byte, error)
- func DownloadUrls2List(urls []string, timeout int64) map[string]struct{}
- func GetEnvInt64(envVar string, base int, bitSize int, defaultValue int64) int64
- func GetEnvString(envVar string, defaultValue string) string
- func GetKeys(list map[string]struct{}) []string
- func IsIPv4(ip net.IP) bool
- func IsIPv6(ip net.IP) bool
- func LoadCache(fqdn string, urls []string, refresh bool, timeout int64) (map[string]struct{}, error)
- func LoadCacheFile(fqdn string) (map[string]struct{}, error)
- func NormalizeLines(buffer string) []string
- func ReadFile(fqfn string) ([]byte, error)
- func RemoveNoiseLines(srcLines []string) []string
- func SafeParseInt(str string, base int, bitSize int, defaultValue int64) int64
- func SubDomain(domain string) (string, string)
- func WriteFile(fqfn string, buffer []byte) error
- type Result
- type TLDExtract
- type TldNode
Constants ¶
View Source
const ( DefaultCacheTimeout int64 = 10 // Use raw strings to avoid having to quote the backslashes. // \p{Han} allows matching a Chinese, Japanese, and Korean characters // \p{Greek} allows matching a Greek characters DomainRegexText = `^[a-z0-9-\p{Han}-\p{Greek}]{1,63}$` SchemeRegexText = `^([a-z0-9\+\-\.]+:)?//` Malformed = iota Domain IPv4 IPv6 )
Variables ¶
View Source
var (
DefaultTldUrls = []string{
"https://publicsuffix.org/list/public_suffix_list.dat",
"https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat",
}
)
Functions ¶
func CreateNewCacheFile ¶
CreateNewCacheFile - create new cache file from URLs
func DownloadFile ¶
DownloadFile - Get body from URL
func DownloadUrls2List ¶
DownloadUrls2List - Download N number of URLs and merge the unique rows into a generic key map
func GetEnvString ¶
func LoadCache ¶
func LoadCache(fqdn string, urls []string, refresh bool, timeout int64) (map[string]struct{}, error)
LoadCache - Load cache file with Refresh and fail over options
func LoadCacheFile ¶
LoadCacheFile - read cache file and Normalize contents (remove comments, split lines, etc)
func NormalizeLines ¶
NormalizeLines - split string into array of strings and remove noise lines
func RemoveNoiseLines ¶
RemoveNoiseLines - remove blank lines and comments, converting each kept line to lowercase
Types ¶
type TLDExtract ¶
func (*TLDExtract) Extract ¶
func (tlde *TLDExtract) Extract(urlString string) *Result
Click to show internal directories.
Click to hide internal directories.