client

package
v0.0.0-...-c59d28f Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const FixtureFileBrowser = `browsers.yml`
View Source
const FixtureFileBrowserEngine = `browser_engine.yml`
View Source
const FixtureFileFeedReader = `feed_readers.yml`
View Source
const FixtureFileLibrary = `libraries.yml`
View Source
const FixtureFileMediaPlayer = `mediaplayers.yml`
View Source
const FixtureFileMobileApp = `mobile_apps.yml`
View Source
const FixtureFilePim = `pim.yml`
View Source
const ParserNameBrowser = `browser`
View Source
const ParserNameBrowserEngine = `browserengine`
View Source
const ParserNameFeedReader = `feed reader`
View Source
const ParserNameLibrary = `library`
View Source
const ParserNameMediaPlayer = `mediaplayer`
View Source
const ParserNameMobileApp = `mobile app`
View Source
const ParserNamePim = `pim`

Variables

This section is empty.

Functions

func GetBrowserFamily

func GetBrowserFamily(browserLabel string) (string, bool)

func GetClientCreater

func GetClientCreater(name string) func(string) ClientParser

func IsMobileOnlyBrowser

func IsMobileOnlyBrowser(browser string) bool

Returns if the given browser is mobile only

func RegClientParser

func RegClientParser(name string, f func(string) ClientParser)

Types

type Browser

type Browser struct {
	Regexes []*BrowserItem
	// contains filtered or unexported fields
}

Client parser for browser detection

func NewBrowser

func NewBrowser(fileName string) *Browser

func (*Browser) BuildEngine

func (b *Browser) BuildEngine(engineData *Engine, browserVersion, ua string) string

func (*Browser) BuildEngineVersion

func (b *Browser) BuildEngineVersion(engine, ua string) string

func (*Browser) Load

func (b *Browser) Load(file string) error

func (*Browser) Parse

func (b *Browser) Parse(ua string) *BrowserMatchResult

func (*Browser) PreMatch

func (b *Browser) PreMatch(ua string) bool

type BrowserEngine

type BrowserEngine struct {
	ClientParserAbstract
}

func NewBrowserEngine

func NewBrowserEngine(fileName string) *BrowserEngine

func (*BrowserEngine) Parse

func (d *BrowserEngine) Parse(ua string) *ClientMatchResult

type BrowserItem

type BrowserItem struct {
	Regular `yaml:",inline" json:",inline"`
	Name    string  `yaml:"name" json:"name"`
	Version string  `yaml:"version" json:"version"`
	Engine  *Engine `yaml:"engine" json:"engine"`
}

type BrowserMatchResult

type BrowserMatchResult = ClientMatchResult

type ClientMatchResult

type ClientMatchResult struct {
	Type    string `yaml:"type" json:"type"`
	Name    string `yaml:"name" json:"name"`
	Version string `yaml:"version" json:"version"`

	ShortName     string `yaml:"short_name" json:"short_name"`
	Engine        string `yaml:"engine" json:"engine"`
	EngineVersion string `yaml:"engine_version" json:"engine_version"`
}

type ClientParser

type ClientParser interface {
	PreMatch(string) bool
	Parse(string) *ClientMatchResult
}

func NewClientParser

func NewClientParser(dir, name string) ClientParser

func NewClientParsers

func NewClientParsers(dir string, names []string) []ClientParser

type ClientParserAbstract

type ClientParserAbstract struct {
	Regexes    []*ClientReg
	ParserName string
	// contains filtered or unexported fields
}

Parses the current UA and checks whether it contains any client information

func (*ClientParserAbstract) GetAvailableClients

func (c *ClientParserAbstract) GetAvailableClients() []string

Returns all names defined in the regexes Attention: This method might not return all names of detected clients

func (*ClientParserAbstract) Load

func (c *ClientParserAbstract) Load(file string) error

func (*ClientParserAbstract) Parse

Parses the current UA and checks whether it contains any client information

func (*ClientParserAbstract) PreMatch

func (c *ClientParserAbstract) PreMatch(ua string) bool

type ClientReg

type ClientReg struct {
	Regular `yaml:",inline" json:",inline"`
	Name    string `yaml:"name" json:"name"`
	Version string `yaml:"version" json:"version"`
}

type Engine

type Engine struct {
	Default  string            `yaml:"default" json:"default"`
	Versions map[string]string `yaml:"versions" json:"versions"`
}

type FeedReader

type FeedReader struct {
	ClientParserAbstract
}

Client parser for feed reader detection

func NewFeedReader

func NewFeedReader(fileName string) *FeedReader

type Library

type Library struct {
	ClientParserAbstract
}

Client parser for tool & software detection

func NewLibrary

func NewLibrary(fileName string) *Library

type MediaPlayer

type MediaPlayer struct {
	ClientParserAbstract
}

Client parser for mediaplayer detection

func NewMediaPlayer

func NewMediaPlayer(fileName string) *MediaPlayer

type MobileApp

type MobileApp struct {
	ClientParserAbstract
}

Client parser for mobile app detection

func NewMobileApp

func NewMobileApp(fileName string) *MobileApp

type Pim

type Pim struct {
	ClientParserAbstract
}

Client parser for pim (personal information manager) detection

func NewPim

func NewPim(fileName string) *Pim

type Version

type Version struct {
	Engine string `yaml:"engine" json:"engine"`
	// contains filtered or unexported fields
}

Client parser for browser engine version detection

func (*Version) Compile

func (r *Version) Compile()

func (*Version) Parse

func (r *Version) Parse(ua string) string

Jump to

Keyboard shortcuts

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