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

shelltv

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: LGPL-3.0 Imports: 2 Imported by: 0

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

func (p *Parser) IsShellTv() bool

IsShellTv returns true if the UA is identified as a Shell TV device. Mirrors PHP: DeviceDetector\Parser\Device\ShellTv::isShellTv(): bool

func (*Parser) Parse

func (p *Parser) Parse() *Match

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().

func (*ParserFactory) NewParser

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

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

Jump to

Keyboard shortcuts

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