Help us shape the future of Go! Take the 2026 Go Developer Survey

device

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const FixtureFileCamera = `cameras.yml`
View Source
const FixtureFileCar = `car_browsers.yml`
View Source
const FixtureFileConsole = `consoles.yml`
View Source
const FixtureFileHbbTv = `televisions.yml`
View Source
const FixtureFileMobile = `mobiles.yml`
View Source
const FixtureFilePortableMediaPlayer = `portable_media_player.yml`
View Source
const ParserNameCamera = `camera`
View Source
const ParserNameCar = `car browser`
View Source
const ParserNameConsole = `console`
View Source
const ParserNameHbbTv = `tv`
View Source
const ParserNameMobile = `mobile`
View Source
const ParserNamePortableMediaPlayer = `portablemediaplayer`
View Source
const UnknownBrand = "Unknown"

Variables

This section is empty.

Functions

func GetDeviceCreater

func GetDeviceCreater(name string) func(string) DeviceParser

func RegDeviceParser

func RegDeviceParser(name string, f func(string) DeviceParser)

Types

type Camera

type Camera struct {
	DeviceParserAbstract
}

Device parser for camera detection

func NewCamera

func NewCamera(fileName string) *Camera

func (*Camera) Parse

func (c *Camera) Parse(ua string) *DeviceMatchResult

type Car

type Car struct {
	DeviceParserAbstract
}

Device parser for car browser detection

func NewCar

func NewCar(fileName string) *Car

func (*Car) Parse

func (c *Car) Parse(ua string) *DeviceMatchResult

type Console

type Console struct {
	DeviceParserAbstract
}

Device parser for console detection

func NewConsole

func NewConsole(fileName string) *Console

func (*Console) Parse

func (c *Console) Parse(ua string) *DeviceMatchResult

type DeviceMatchResult

type DeviceMatchResult struct {
	Type  string `yaml:"type"`
	Model string `yaml:"model"`
	Brand string `yaml:"brand"`
}

type DeviceParser

type DeviceParser interface {
	PreMatch(string) bool
	Parse(string) *DeviceMatchResult
}

func NewDeviceParser

func NewDeviceParser(dir, name string) DeviceParser

func NewDeviceParsers

func NewDeviceParsers(dir string, names []string) []DeviceParser

type DeviceParserAbstract

type DeviceParserAbstract struct {
	Regexes map[string]*DeviceReg
	// contains filtered or unexported fields
}

func (*DeviceParserAbstract) Load

func (d *DeviceParserAbstract) Load(file string) error

func (*DeviceParserAbstract) Parse

func (*DeviceParserAbstract) PreMatch

func (d *DeviceParserAbstract) PreMatch(ua string) bool

type DeviceReg

type DeviceReg struct {
	Regular `yaml:",inline" json:",inline"`
	Model   string   `yaml:"model" json:"model"`
	Device  string   `yaml:"device" json:"device"`
	Models  []*Model `yaml:"models" json:"models"`
}

type HbbTv

type HbbTv struct {
	DeviceParserAbstract
	// contains filtered or unexported fields
}

Device parser for hbbtv detection

func NewHbbTv

func NewHbbTv(fileName string) *HbbTv

func (*HbbTv) IsHbbTv

func (h *HbbTv) IsHbbTv(ua string) bool

Returns if the parsed UA was identified as a HbbTV device

func (*HbbTv) Parse

func (h *HbbTv) Parse(ua string) *DeviceMatchResult

type Mobile

type Mobile struct {
	DeviceParserAbstract
}

Device parser for mobile detection

func NewMobile

func NewMobile(fileName string) *Mobile

type Model

type Model struct {
	Regular `yaml:",inline" json:",inline"`
	Model   string `yaml:"model" json:"model"`
	Device  string `yaml:"device" json:"device"` //mobile
	Brand   string `yaml:"brand" json:"brand"`   //mobile
}

type PortableMediaPlayer

type PortableMediaPlayer struct {
	DeviceParserAbstract
}

Device parser for portable media player detection

func NewPortableMediaPlayer

func NewPortableMediaPlayer(fileName string) *PortableMediaPlayer

func (*PortableMediaPlayer) Parse

Jump to

Keyboard shortcuts

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