Documentation ¶
Index ¶
- Variables
- type Bot
- type BotMatcher
- type Browser
- func (b *Browser) Bot() *Bot
- func (b *Browser) Device() *Device
- func (b *Browser) IsAlipay() bool
- func (b *Browser) IsBlackBerry() bool
- func (b *Browser) IsBrave() bool
- func (b *Browser) IsBrowserKnown() bool
- func (b *Browser) IsChrome() bool
- func (b *Browser) IsDuckDuckGo() bool
- func (b *Browser) IsEdge() bool
- func (b *Browser) IsElectron() bool
- func (b *Browser) IsFirefox() bool
- func (b *Browser) IsGoogleSearchApp() bool
- func (b *Browser) IsHuaweiBrowser() bool
- func (b *Browser) IsInstagram() bool
- func (b *Browser) IsInternetExplorer() bool
- func (b *Browser) IsKonqueror() bool
- func (b *Browser) IsMaxthon() bool
- func (b *Browser) IsMicroMessenger() bool
- func (b *Browser) IsMiuiBrowser() bool
- func (b *Browser) IsNokia() bool
- func (b *Browser) IsOpera() bool
- func (b *Browser) IsOtter() bool
- func (b *Browser) IsPaleMoon() bool
- func (b *Browser) IsPuffin() bool
- func (b *Browser) IsQQ() bool
- func (b *Browser) IsSafari() bool
- func (b *Browser) IsSafariWebappMode() bool
- func (b *Browser) IsSamsungBrowser() bool
- func (b *Browser) IsSnapchat() bool
- func (b *Browser) IsSougouBrowser() bool
- func (b *Browser) IsSputnik() bool
- func (b *Browser) IsUCBrowser() bool
- func (b *Browser) IsUnknown() bool
- func (b *Browser) IsVivaldi() bool
- func (b *Browser) IsVivoBrowser() bool
- func (b *Browser) IsWechat() bool
- func (b *Browser) IsWeibo() bool
- func (b *Browser) IsYaaniBrowser() bool
- func (b *Browser) IsYandex() bool
- func (b *Browser) Name() string
- func (b *Browser) Platform() *Platform
- func (b *Browser) ShortVersion() string
- func (b *Browser) Version() string
- type BrowserMatcher
- type Device
- func (d *Device) IsBlackberryPlaybook() bool
- func (d *Device) IsConsole() bool
- func (d *Device) IsIPad() bool
- func (d *Device) IsIPhone() bool
- func (d *Device) IsIPodTouch() bool
- func (d *Device) IsKindle() bool
- func (d *Device) IsKindleFire() bool
- func (d *Device) IsMobile() bool
- func (d *Device) IsNintendo() bool
- func (d *Device) IsNintendoSwitch() bool
- func (d *Device) IsNintendoWii() bool
- func (d *Device) IsNintendoWiiU() bool
- func (d *Device) IsPSP() bool
- func (d *Device) IsPlayStation() bool
- func (d *Device) IsPs3() bool
- func (d *Device) IsPs4() bool
- func (d *Device) IsPs5() bool
- func (d *Device) IsSamsung() bool
- func (d *Device) IsSurface() bool
- func (d *Device) IsSwitch() bool
- func (d *Device) IsTV() bool
- func (d *Device) IsTablet() bool
- func (d *Device) IsWii() bool
- func (d *Device) IsWiiU() bool
- func (d *Device) IsXbox() bool
- func (d *Device) IsXbox360() bool
- func (d *Device) IsXboxOne() bool
- func (d *Device) Name() string
- type DeviceMatcher
- type Matcher
- type Platform
- func (p *Platform) IsAdobeAir() bool
- func (p *Platform) IsAdobeAirVersionCompatible(version string) bool
- func (p *Platform) IsAndroid() bool
- func (p *Platform) IsAndroidApp() bool
- func (p *Platform) IsAndroidWebview() bool
- func (p *Platform) IsBlackBerry() bool
- func (p *Platform) IsChromeOS() bool
- func (p *Platform) IsChromeOSVersionCompatible(version string) bool
- func (p *Platform) IsIOS() bool
- func (p *Platform) IsIOSApp() bool
- func (p *Platform) IsIOSWebview() bool
- func (p *Platform) IsKaiOS() bool
- func (p *Platform) IsLinux() bool
- func (p *Platform) IsWatchOS() bool
- func (p *Platform) IsWindows() bool
- func (p *Platform) IsWindows10() bool
- func (p *Platform) IsWindows7() bool
- func (p *Platform) IsWindows8() bool
- func (p *Platform) IsWindows8_1() bool
- func (p *Platform) IsWindowsMobile() bool
- func (p *Platform) IsWindowsPhone() bool
- func (p *Platform) IsWindowsRT() bool
- func (p *Platform) IsWindowsTouchScreenDesktop() bool
- func (p *Platform) IsWindowsVista() bool
- func (p *Platform) IsWindowsWOW64() bool
- func (p *Platform) IsWindowsX64() bool
- func (p *Platform) IsWindowsX64Inclusive() bool
- func (p *Platform) IsWindowsXP() bool
- func (p *Platform) Name() string
- func (p *Platform) Version() string
- type PlatformMatcher
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoUserAgent = fmt.Errorf("no user agent provided") ErrUserAgentSizeExceeded = fmt.Errorf("user agent size exceeds limit of %d", userAgentSizeLimit) )
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot is a struct that contains information about the user agent's bot
type BotMatcher ¶
type BotMatcher interface { Matcher }
BotMatcher is the interface for bot matchers
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
Browser is a struct that contains information about the user agent's browser. It contains information about the browser's name, version, platform and device.
func NewBrowser ¶
NewBrowser creates a new browser based on the user agent string. It builds the browser by matching the user agent string with the known browsers.
UserAgentSizeError is returned if the user agent string is larger than the limit.
func (*Browser) Device ¶
Device returns the device of the browser. It can used to further query information about the device.
func (*Browser) IsBlackBerry ¶
IsBlackBerry returns true if the browser is BlackBerry.
func (*Browser) IsBrowserKnown ¶
IsBrowserKnown returns true if a match was found for the browser.
func (*Browser) IsDuckDuckGo ¶
IsDuckDuckGo returns true if the browser is DuckDuckGo.
func (*Browser) IsElectron ¶
IsElectron returns true if the browser is Electron.
func (*Browser) IsGoogleSearchApp ¶
IsGoogleSearchApp returns true if the browser is GoogleSearchApp.
func (*Browser) IsHuaweiBrowser ¶
IsHuaweiBrowser returns true if the browser is HuaweiBrowser.
func (*Browser) IsInstagram ¶
IsInstagram returns true if the browser is Instagram.
func (*Browser) IsInternetExplorer ¶
IsInternetExplorer returns true if the browser is Internet Explorer.
func (*Browser) IsKonqueror ¶
IsKonqueror returns true if the browser is Konqueror.
func (*Browser) IsMicroMessenger ¶
IsMicroMessenger returns true if the browser is MicroMessenger.
func (*Browser) IsMiuiBrowser ¶
IsMiuiBrowser returns true if the browser is MiuiBrowser.
func (*Browser) IsPaleMoon ¶
IsPaleMoon returns true if the browser is PaleMoon.
func (*Browser) IsSafariWebappMode ¶
IsSafariWebappMode returns true if the browser is Safari Webapp Mode. It is true for iOS devices which have AppleWebKit in the user agent string.
func (*Browser) IsSamsungBrowser ¶
IsSamsungBrowser returns true if the browser is SamsungBrowser.
func (*Browser) IsSnapchat ¶
IsSnapchat returns true if the browser is Snapchat.
func (*Browser) IsSougouBrowser ¶
IsSougouBrowser returns true if the browser is SougouBrowser.
func (*Browser) IsUCBrowser ¶
IsUCBrowser returns true if the browser is UCBrowser.
func (*Browser) IsUnknown ¶
IsUnknown returns true if the browser is Unknown. Browsers are considered unknown when they do not match any of the known browsers.
func (*Browser) IsVivoBrowser ¶
IsVivoBrowser returns true if the browser is VivoBrowser.
func (*Browser) IsWechat ¶
IsWechat returns true if the browser is Wechat. Wechat is an alias for MicroMessenger.
func (*Browser) IsYaaniBrowser ¶
IsYaaniBrowser returns true if the browser is YaaniBrowser.
func (*Browser) Platform ¶
Platform returns the platform of the browser. It can used to further query information about the platform.
func (*Browser) ShortVersion ¶
ShortVersion returns the short version of the version of the matched browser. Below are some examples of how the short version is returned:
12.1.1 => 12
04.34 => 04
type BrowserMatcher ¶
type BrowserMatcher interface { Matcher // BrowserMatcher implements Matcher interface. Version() string // Version returns the full version of the browser. }
BrowserMatcher is an interface for browser matchers.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device is a struct that contains information about the user agent's device
func (*Device) IsBlackberryPlaybook ¶
IsBlackberryPlaybook returns true if the device is a Blackberry Playbook
func (*Device) IsConsole ¶
IsConsole returns true if the device is a console This includes PlayStation, Xbox, and Nintendo devices
func (*Device) IsIPodTouch ¶
IsIPodTouch returns true if the device is an iPod touch
func (*Device) IsKindleFire ¶
IsKindleFire returns true if the device is a Kindle Fire
func (*Device) IsNintendo ¶
IsNintendo returns true if the device is a Nintendo This includes Wii, Wii U, and Switch
func (*Device) IsNintendoSwitch ¶
IsNintendoSwitch returns true if the device is a Nintendo Switch IsNintendoSwitch is an alias for IsSwitch
func (*Device) IsNintendoWii ¶
IsNintendoWii returns true if the device is a Nintendo Wii IsNintendoWii is an alias for IsWii
func (*Device) IsNintendoWiiU ¶
IsNintendoWiiU returns true if the device is a Nintendo Wii U IsNintendoWiiU is an alias for IsWiiU
func (*Device) IsPlayStation ¶
IsPlayStation returns true if the device is a PlayStation This includes PlayStation 3, PlayStation 4, and PlayStation 5
func (*Device) IsTablet ¶
IsTablet returns true if the device is a tablet This includes iPad, PlayBook, Surface, and Android based tablets
func (*Device) IsXbox ¶
IsXbox returns true if the device is an Xbox This includes Xbox 360 and Xbox One
type DeviceMatcher ¶
type DeviceMatcher interface { Matcher }
DeviceMatcher is an interface for device matchers
type Matcher ¶
Matcher is an interface for user agent matchers. A matcher is used to detect a match from the user agent string.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform is a struct that contains information about the user agent's platforms.
func NewPlatform ¶
NewPlatform creates a new platform based on the user agent string.
UserAgentSizeError is returned if the user agent string is larger than the limit.
func (*Platform) IsAdobeAir ¶
IsAdobeAir returns true if the user agent string matches Adobe AIR.
func (*Platform) IsAdobeAirVersionCompatible ¶
func (*Platform) IsAndroidApp ¶
IsAndroidApp returns true if the platform is Android app and the user agent string contains wv. https://developer.chrome.com/docs/multidevice/user-agent/#webview_user_agent
func (*Platform) IsAndroidWebview ¶
IsAndroidWebview is an alias for IsAndroidApp.
func (*Platform) IsBlackBerry ¶
IsBlackBerry returns true if platform is BlackBerry.
func (*Platform) IsChromeOS ¶
IsChromeOS returns true if the user agent string matches Chrome OS.
func (*Platform) IsChromeOSVersionCompatible ¶
IsChromeOSVersionCompatible returns true if the user agent string matches Chrome OS and the version is greater than or equal to the specified version.
func (*Platform) IsIOSApp ¶
IsIOSApp returns true if the platform is iOS app and the user agent string does not contain Safari.
func (*Platform) IsIOSWebview ¶
IsIOSWebview is an alias for IsIOSApp.
func (*Platform) IsWindows10 ¶
IsWindows10 returns true if the platform is Windows 10.
func (*Platform) IsWindows7 ¶
IsWindows7 returns true if the platform is Windows 7.
func (*Platform) IsWindows8 ¶
IsWindows8 returns true if the platform is Windows 8.
func (*Platform) IsWindows8_1 ¶
IsWindows8_1 returns true if the platform is Windows 8.1.
func (*Platform) IsWindowsMobile ¶
IsWindowsMobile returns true if the platform is Windows Mobile.
func (*Platform) IsWindowsPhone ¶
IsWindowsPhone returns true if the platform is Windows Phone.
func (*Platform) IsWindowsRT ¶
IsWindowsRT returns true if the platform is Windows RT.
func (*Platform) IsWindowsTouchScreenDesktop ¶
IsWindowsTouchScreenDesktop returns true if the platform is Windows 8 and the user agent string contains Touch.
func (*Platform) IsWindowsVista ¶
IsWindowsVista returns true if the platform is Windows Vista.
func (*Platform) IsWindowsWOW64 ¶
func (*Platform) IsWindowsX64 ¶
IsWindowsX64 returns true if the platform is Windows x64.
func (*Platform) IsWindowsX64Inclusive ¶
func (*Platform) IsWindowsXP ¶
IsWindowsXP returns true if the platform is Windows XP.
type PlatformMatcher ¶
type PlatformMatcher interface { Matcher Version() string // Version returns the version of the platforms. }
PlatformMatcher is an interface for user agent platform matchers. A platform matcher is used to detect the platform from the user agent string.