Documentation ¶
Overview ¶
Package cappa provides a matching mechanism over Browscap http://browscap.org/ CSV file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern is just a wrapper of regexp.Regexp. The reason why this thing exists is the NewPattern function, that does some preprocessing of Pattern String.
func NewPattern ¶
NewPattern preprocessed, creates and returns new Pattern used for Match.
type UA ¶
type UA struct { Pattern *Pattern PropertyName string // 0 MasterParent string // 1 LiteMode string // 2 Parent string // 3 Comment string // 4 // TODO: Create Browser type Browser string // 5 BrowserType string // 6 BrowserBits string // 7 BrowserMaker string // 8 BrowserModus string // 9 Version string // 10 MajorVer string // 11 MinorVer string // 12 // TODO: Create Platform type Platform string // 13 PlatformVersion string // 14 PlatformDescription string // 15 PlatformBits string // 16 PlatformMaker string // 17 Alpha string // 18 Beta string // 19 Win16 string // 20 Win32 string // 21 Win64 string // 22 Frames string // 23 IFrames string // 24 Tables string // 25 Cookies string // 26 BackgroundSounds string // 27 JavaScript string // 28 VBScript string // 29 JavaApplets string // 30 ActiveXControls string // 31 IsMobileDevice string // 32 IsTablet string // 33 IsSyndicationReader string // 34 Crawler string // 35 IsFake string // 36 IsAnonymized string // 37 IsModified string // 38 CSSVersion string // 39 AolVersion string // 40 // TODO: Create Device type DeviceName string // 41 DeviceMaker string // 42 DeviceType string // 43 DevicePointingMethod string // 44 DeviceCodeName string // 45 DeviceBrandName string // 46 // TODO: Create RenderEngine type RenderingEngineName string // 47 RenderingEngineVersion string // 48 RenderingEngineDescription string // 49 RenderingEngineMaker string // 50 }
UA contains all Browscap properties along with the Pattern structure, that used to be matched against. Most of the properties are self-describing, but you may consult with Browscap http://browscap.org/.
func NewUAFromLine ¶
NewUAFromLine creates a User-Agent from the slice of strings, that represents a parsed and separated line of the CSV file.
type UAs ¶
type UAs []*UA
UAs type is a synonym for slice of User-Agents. It's a main structure you will use unless you want to construct your own pattern with custom properties.
func ReadUAsFromCSV ¶
ReadUAsFromCSV loads User-Agents from the given CSV file. CSV file must be sanitized before loading in such manner that first 4 lines of CSV were deleted.
For example, this lines must be deleted: "GJK_Browscap_Version","GJK_Browscap_Version" "6021","Tue, 31 Jan 2017 15:21:58 +0000" "PropertyName","MasterParent","LiteMode","Parent","Comment","Browser","Browser_Type","Browser_Bits","Browser_Maker","Browser_Modus","Version","MajorVer","MinorVer","Platform","Platform_Version","Platform_Description","Platform_Bits","Platform_Maker","Alpha","Beta","Win16","Win32","Win64","Frames","IFrames","Tables","Cookies","BackgroundSounds","JavaScript","VBScript","JavaApplets","ActiveXControls","isMobileDevice","isTablet","isSyndicationReader","Crawler","isFake","isAnonymized","isModified","CssVersion","AolVersion","Device_Name","Device_Maker","Device_Type","Device_Pointing_Method","Device_Code_Name","Device_Brand_Name","RenderingEngine_Name","RenderingEngine_Version","RenderingEngine_Description","RenderingEngine_Maker" "DefaultProperties","true","true","","DefaultProperties","DefaultProperties","","0","","","0.0","0","0","","","","0","","false","false","false","false","false","false","false","false","false","false","false","false","false","false","false","false","false","false","false","false","false","0","0","","","","","","","","","",""