Documentation
¶
Overview ¶
Package shelltv provides Shell TV detection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Match ¶
type Match struct {
IsShellTv bool `json:"is_shell_tv"`
}
Match represents the result of a successful Shell TV detection.
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 Shell TV information. Created via ParserFactory.NewParser() - do not instantiate directly.
func (*Parser) IsShellTv ¶
IsShellTv returns true if the UA is identified as a Shell TV device. Mirrors PHP: DeviceDetector\Parser\Device\ShellTv::isShellTv(): bool
func (*Parser) Parse ¶
Parse mirrors the PHP parser's parse() semantics at a high level: - only parse user agents containing Shell TV fragments - otherwise return nil
Note: For now this focuses on the behavior needed by the PHP unit test (isShellTv). Device brand/model parsing from shell_tv.yml can be added on top.
type ParserFactory ¶
type ParserFactory struct {
// contains filtered or unexported fields
}
ParserFactory holds pre-compiled matchers and creates Parser instances. Thread-safe for concurrent use - create once, use from multiple goroutines.
func NewParserFactory ¶
func NewParserFactory(opts ...common.FactoryOption) (*ParserFactory, error)
NewParserFactory creates a factory with all regexes compiled once.
func (*ParserFactory) IsShellTv ¶
func (f *ParserFactory) IsShellTv(ua string) bool
IsShellTv is a convenience method mirroring PHP's $parser->isShellTv().