Documentation
¶
Overview ¶
Package surferua is a lightweight and high performance Golang package that generate HTTP User-Agent strings with particular attention to device type.
For a full guide visit https://github.com/jiusanzhou/surferua
Index ¶
- Constants
- Variables
- func NewBot() string
- func NewBotAlexa() string
- func NewBotBaidu() string
- func NewBotBing() string
- func NewBotBlex() string
- func NewBotDuck() string
- func NewBotExa() string
- func NewBotFacebook() string
- func NewBotGoogle() string
- func NewBotMj12() string
- func NewBotMsn() string
- func NewBotScoutJet() string
- func NewBotSimplePie() string
- func NewBotSogou() string
- func NewBotSogouOrin() string
- func NewBotYahoo() string
- func NewBotYandex() string
- func NewPlatformInfoList(m map[interface{}]interface{}) (types []string, l [][]*PlatformInfo)
- func RandStringBytesMaskImpr(n int) string
- func RandStringBytesMaskImprSrc(n int) string
- func Seed(seed int64)
- type Bot
- type Browser
- type BrowserInfo
- type Endpoint
- type Engine
- type EngineInfo
- type Platform
- type PlatformInfo
- type PreRelease
- type Semver
- type UserAgent
- func (ua *UserAgent) Android() *UserAgent
- func (ua *UserAgent) Chrome() *UserAgent
- func (ua *UserAgent) Desktop() *UserAgent
- func (ua *UserAgent) Firefox() *UserAgent
- func (ua *UserAgent) IOS() *UserAgent
- func (ua *UserAgent) Linux() *UserAgent
- func (ua *UserAgent) MacOS() *UserAgent
- func (ua *UserAgent) Phone() *UserAgent
- func (ua *UserAgent) Safari() *UserAgent
- func (ua *UserAgent) String() (us string)
- func (ua *UserAgent) Windows() *UserAgent
- type VersionInfo
Examples ¶
Constants ¶
View Source
const Mozilla = "Mozilla"
View Source
const MozillaWithVersion = "Mozilla/5.0"
Variables ¶
View Source
var VERSION = "0.1.0"
Functions ¶
func NewBotFacebook ¶
func NewBotFacebook() string
NewBotFacebook returns full user-agent string of facebook.
func NewBotGoogle ¶
func NewBotGoogle() string
NewBotGoogle returns full user-agent string of google.
func NewBotScoutJet ¶
func NewBotScoutJet() string
NewBotScoutJet returns full user-agent string of scoutJet.
func NewBotSimplePie ¶
func NewBotSimplePie() string
NewBotSimplePie returns full user-agent string of simplePie.
func NewBotSogouOrin ¶
func NewBotSogouOrin() string
NewBotSogouOrin returns full user-agent string of sogouOrin.
func NewBotYandex ¶
func NewBotYandex() string
NewBotYandex returns full user-agent string of yandex.
func NewPlatformInfoList ¶
func NewPlatformInfoList(m map[interface{}]interface{}) (types []string, l [][]*PlatformInfo)
func RandStringBytesMaskImpr ¶
Types ¶
type Bot ¶
type Bot struct {
// The name of bot
Name string
// The version of bot
Version string
// The url of bot
URL string
}
Bot Crawler UA strings
type Browser ¶
type Browser struct {
// The name of the browser.
Name string
// The name of the browser's engine.
Engine Engine
// The version of the browser.
Semver Semver
}
Browser is br
type BrowserInfo ¶
type BrowserInfo struct {
Name string
EngineInfo EngineInfo
VersionInfo VersionInfo
}
func NewBrowserInfo ¶
func NewBrowserInfo(name string, m interface{}) (bi *BrowserInfo)
func NewBrowserInfoList ¶
func NewBrowserInfoList(m map[interface{}]interface{}) (l []*BrowserInfo)
func (*BrowserInfo) Random ¶
func (bi *BrowserInfo) Random() *Browser
type EngineInfo ¶
type EngineInfo struct {
Name string
VersionInfo VersionInfo
}
func NewEngineInfo ¶
func NewEngineInfo(m interface{}) (ei EngineInfo)
func (*EngineInfo) Random ¶
func (ei *EngineInfo) Random() (e *Engine)
type Platform ¶
type Platform struct {
// Name of the operating system. This is sometimes a shorter version of the
// operating system name, e.g. "Mac OS X" instead of "Intel Mac OS X"
Name string
// Operating system version, e.g. 7 for Windows 7 or 10.8 for Max OS X Mountain Lion
Semver Semver
// Comment
Comment string
}
Represents full information on the operating system extracted from the user agent.
type PlatformInfo ¶
type PlatformInfo struct {
Name string
VersionInfo VersionInfo
// this should be random
Comment string
}
func NewPlatformInfo ¶
func NewPlatformInfo(name string, m interface{}) (pi *PlatformInfo)
func (*PlatformInfo) Random ¶
func (p *PlatformInfo) Random() *Platform
type PreRelease ¶
type PreRelease string
type Semver ¶
type Semver struct {
Major int
Minor int
Patch int
PreRelease PreRelease
Metadata string
}
type UserAgent ¶
type UserAgent struct {
// contains filtered or unexported fields
}
func New ¶
Example ¶
fmt.Println(New().String())
// functions depends on your generated inputting data.
fmt.Println(NewBot())
fmt.Println(NewBotGoogle())
fmt.Println(New().Phone().String())
fmt.Println(New().Android().String())
fmt.Println(New().Desktop().Chrome().String())
// new function from v0.2
// fmt.Println(New(Browser("Chrome", "50"), "Android"))
type VersionInfo ¶
func NewVersionInfo ¶
func NewVersionInfo(m interface{}) (vi VersionInfo)
func (*VersionInfo) Random ¶
func (vi *VersionInfo) Random() (s *Semver)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.