Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Blacklist = []string{}/* 1257 elements not displayed */
Blacklist is a list of User-Agents to ignore.
View Source
var RegexBlacklist = []*regexp.Regexp{ regexp.MustCompile(" *and *['\"(0-9a-za-z]* *(=|like) *['\"(0-9a-za-z]*"), regexp.MustCompile("-[0-9]* *or *[0-9]*="), regexp.MustCompile("case *when.*then.*else.*end"), regexp.MustCompile("iif *(.*,.*,.*)"), }
RegexBlacklist is a list of User-Agents to ignore.
Functions ¶
func ContainsNonASCIICharacters ¶
ContainsNonASCIICharacters returns true if the string only consists out of ASCII characters.
Types ¶
type UserAgent ¶ added in v6.7.0
type UserAgent struct { // Time is the creation date for the database record. Time time.Time // UserAgent is the raw User-Agent string. UserAgent string // Browser is the browser name. Browser string // BrowserVersion is the browser (non-technical) version number. BrowserVersion string // OS is the operating system. OS string // OSVersion is the operating system version number. OSVersion string // Mobile indicated whether this is a mobile device from client hint headers. // It'll be set to null if the header is not present or empty. Mobile null.Bool }
UserAgent contains information extracted from the User-Agent header. The creation time and User-Agent are stored in the database to find bots.
func Parse ¶
Parse parses the User-Agent header for given request and returns the extracted information. This supports major browsers and operating systems.
Click to show internal directories.
Click to hide internal directories.