camera

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package camera provides digital camera detection based on Device Detector regexes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match struct {
	// Type is the Device Detector device type name, e.g. "camera".
	Type string `json:"type"`
	// Brand is the full brand name, e.g. "Samsung".
	Brand string `json:"brand"`
	// Model is the detected model string.
	Model string `json:"model"`
}

Match represents the parsed camera device match.

type Option

type Option func(*Parser)

Option is a functional option for configuring Parser behavior.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser parses a single user agent for Camera device information. Created via ParserFactory.NewParser() - do not instantiate directly.

func (*Parser) Parse

func (p *Parser) Parse() *Match

Parse matches the UA against camera patterns and returns the detected device match. Mirrors PHP: DeviceDetector\Parser\Device\Camera::parse(): ?array

type ParserFactory

type ParserFactory struct {
	// contains filtered or unexported fields
}

ParserFactory holds pre-compiled camera matchers and creates Parser instances. Thread-safe for concurrent use - create once, use from multiple goroutines.

func NewDefaultParserFactory

func NewDefaultParserFactory() (*ParserFactory, error)

NewDefaultParserFactory is an alias for NewParserFactory kept for compatibility.

func NewParserFactory

func NewParserFactory(opts ...common.FactoryOption) (*ParserFactory, error)

NewParserFactory creates a factory by loading and compiling camera regexes from the embedded YAML DB.

func (*ParserFactory) NewParser

func (f *ParserFactory) NewParser(ua string, opts ...Option) *Parser

NewParser creates a new Parser instance for parsing a single user agent.

func (*ParserFactory) Parse

func (f *ParserFactory) Parse(ua string, opts ...Option) *Match

Parse is a convenience method that creates a parser and immediately parses.

Jump to

Keyboard shortcuts

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