feedreader

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: 6 Imported by: 0

Documentation

Overview

Package feedreader implements the FeedReader client parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Regex   string `yaml:"regex"`
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
	URL     string `yaml:"url"`
	// contains filtered or unexported fields
}

Entry represents a single feed reader definition from the YAML regex file.

func (*Entry) GetRegex

func (e *Entry) GetRegex() string

GetRegex is used for keyword extraction / indexing.

type Match

type Match struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

Match represents the result of a successful feed reader detection. This matches the PHP return structure (type/name/version).

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 feed reader client information. Created via ParserFactory.NewParser() - do not instantiate directly.

func (*Parser) Parse

func (p *Parser) Parse() *Match

Parse detects feed readers and returns a Match, or nil if not detected. Mirrors PHP: DeviceDetector\Parser\Client\FeedReader::parse(): ?array

type ParserFactory

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

ParserFactory holds pre-compiled regexes 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 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