uaparser

package
v0.0.0-...-fe9dfa4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2016 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EOsLookUpMode        = 1 /* 00000001 */
	EUserAgentLookUpMode = 2 /* 00000010 */
	EDeviceLookUpMode    = 4 /* 00000100 */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	UserAgent *UserAgent
	Os        *Os
	Device    *Device
}

type Device

type Device struct {
	Family string
	Brand  string
	Model  string
}

func (*Device) ToString

func (dvc *Device) ToString() string

type DeviceSorter

type DeviceSorter []*deviceParser

func (DeviceSorter) Len

func (a DeviceSorter) Len() int

func (DeviceSorter) Less

func (a DeviceSorter) Less(i, j int) bool

func (DeviceSorter) Swap

func (a DeviceSorter) Swap(i, j int)

type Os

type Os struct {
	Family     string
	Major      string
	Minor      string
	Patch      string
	PatchMinor string `yaml:"patch_minor"`
}

func (*Os) ToString

func (os *Os) ToString() string

func (*Os) ToVersionString

func (os *Os) ToVersionString() string

type OsSorter

type OsSorter []*osParser

func (OsSorter) Len

func (a OsSorter) Len() int

func (OsSorter) Less

func (a OsSorter) Less(i, j int) bool

func (OsSorter) Swap

func (a OsSorter) Swap(i, j int)

type Parser

type Parser struct {
	RegexesDefinitions
	UserAgentMisses uint64
	OsMisses        uint64
	DeviceMisses    uint64
	Mode            int
	UseSort         bool
	// contains filtered or unexported fields
}

func New

func New(regexFile string) (*Parser, error)

func NewFromBytes

func NewFromBytes(data []byte) (*Parser, error)

func NewWithOptions

func NewWithOptions(regexFile string, mode, treshold, topCnt int, useSort, debugMode bool) (*Parser, error)

func (*Parser) Parse

func (parser *Parser) Parse(line string) *Client

func (*Parser) ParseDevice

func (parser *Parser) ParseDevice(line string) *Device

func (*Parser) ParseOs

func (parser *Parser) ParseOs(line string) *Os

func (*Parser) ParseUserAgent

func (parser *Parser) ParseUserAgent(line string) *UserAgent

type RegexesDefinitions

type RegexesDefinitions struct {
	UA     []*uaParser     `yaml:"user_agent_parsers"`
	OS     []*osParser     `yaml:"os_parsers"`
	Device []*deviceParser `yaml:"device_parsers"`
	sync.RWMutex
}

type UserAgent

type UserAgent struct {
	Family string
	Major  string
	Minor  string
	Patch  string
}

func (*UserAgent) ToString

func (ua *UserAgent) ToString() string

func (*UserAgent) ToVersionString

func (ua *UserAgent) ToVersionString() string

type UserAgentSorter

type UserAgentSorter []*uaParser

func (UserAgentSorter) Len

func (a UserAgentSorter) Len() int

func (UserAgentSorter) Less

func (a UserAgentSorter) Less(i, j int) bool

func (UserAgentSorter) Swap

func (a UserAgentSorter) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL