Documentation
¶
Overview ¶
Package device provides device dection based on the User-Agent header.
Index ¶
- Variables
- type Device
- func (d *Device) Brand() string
- func (d *Device) HWType() string
- func (d *Device) Identified() bool
- func (d *Device) IsDesktop() bool
- func (d *Device) IsDownloader() bool
- func (d *Device) IsEReader() bool
- func (d *Device) IsFeedreader() bool
- func (d *Device) IsGameConsole() bool
- func (d *Device) IsMediaPlayer() bool
- func (d *Device) IsMobile() bool
- func (d *Device) IsSmartTV() bool
- func (d *Device) IsTVPlayer() bool
- func (d *Device) IsTablet() bool
- func (d *Device) IsTouchscreen() bool
- func (d *Device) Model() string
- func (d *Device) Name() string
- func (d *Device) UserAgentBotName() string
- func (d *Device) UserAgentIsBot() bool
- func (d *Device) UserAgentMajor() string
- func (d *Device) UserAgentMinor() string
- func (d *Device) UserAgentName() string
- func (d *Device) UserAgentPatch() string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDeviceNotFound is returned when the device is not found. ErrDeviceNotFound = errors.New("device not found") // ErrUnexpected indicates that an unexpected error occurred. ErrUnexpected = errors.New("unexpected error") )
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) Brand ¶
Brand returns the brand of the client device, possibly different from the manufacturer of that device.
func (*Device) HWType ¶
HWType returns a string representation of the primary client platform hardware. The most commonly used device types are also identified via boolean variables. Because a device may have multiple device types and this variable only has the primary type, we recommend using the boolean variables for logic and using this string representation for logging.
func (*Device) Identified ¶ added in v1.6.0
UserAgentIdentified returns true if the client device was successfully identified
func (*Device) IsDownloader ¶ added in v1.6.0
UserAgentIsDownloader returns true if the client device is a downloader
func (*Device) IsEReader ¶
IsEReader returns true if the client device is a reading device (like a Kindle).
func (*Device) IsFeedreader ¶ added in v1.6.0
UserAgentIsFeedreader returns true if the client device is a feed reader
func (*Device) IsGameConsole ¶
IsGameConsole returns true if the client device is a video game console (like a PlayStation or Xbox).
func (*Device) IsMediaPlayer ¶
IsMediaPlayer returns true if the client device is a media player (like Blu-ray players, iPod devices, and smart speakers such as Amazon Echo).
func (*Device) IsTVPlayer ¶
IsTVPlayer returns true if the client device is a set-top box or other TV player (like a Roku or Apple TV).
func (*Device) IsTouchscreen ¶
IsTouchscreen returns true if the client device's screen is touch sensitive.
func (*Device) UserAgentBotName ¶ added in v1.6.0
UserAgentBotName returns the bot name (if the user agent is a bot)
func (*Device) UserAgentIsBot ¶ added in v1.6.0
UserAgentIsBot returns true if the client device is a bot
func (*Device) UserAgentMajor ¶ added in v1.6.0
UserAgentMajor returns the major version of the user agent
func (*Device) UserAgentMinor ¶ added in v1.6.0
UserAgentMinor returns the minor version of the user agent
func (*Device) UserAgentName ¶ added in v1.6.0
UserAgentName returns the name of the user agent
func (*Device) UserAgentPatch ¶ added in v1.6.0
UserAgentPatch returns the patch level version of the user agent