Documentation ¶
Overview ¶
Package user_agent implements an HTTP User Agent string parser. It defines the type UserAgent that contains all the information from the parsed string. It also implements the Parse function and getters for all the relevant information that has been extracted from a parsed User Agent string.
Index ¶
- type Browser
- type UASection
- type UserAgent
- func (p *UserAgent) Bot() bool
- func (p *UserAgent) Browser() (string, string)
- func (p *UserAgent) Engine() (string, string)
- func (p *UserAgent) Localization() string
- func (p *UserAgent) Mobile() bool
- func (p *UserAgent) Mozilla() string
- func (p *UserAgent) OS() string
- func (p *UserAgent) Parse(ua string) (err error)
- func (p *UserAgent) Platform() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
A struct containing all the information that we might be interested from the browser.
type UASection ¶
type UASection struct {
// contains filtered or unexported fields
}
A "section" of the User-Agent string. A section contains the name of the product, its version and an optional comment.
type UserAgent ¶
type UserAgent struct {
// contains filtered or unexported fields
}
The UserAgent struct contains all the info that can be extracted from the User-Agent string.
func (*UserAgent) Browser ¶
Public: get the info from the browser itself. Returns:
- a string containing the name of the browser.
- a string containing the version of the browser.
func (*UserAgent) Engine ¶
Public: get the info from the browser's rendering engine. Returns:
- a string containing the name of the Engine.
- a string containing the version of the Engine.
func (*UserAgent) Localization ¶
Returns a string containing the localization.
func (*UserAgent) Mozilla ¶
Public: get the mozilla version (it's how the User Agent string begins: "Mozilla/5.0 ...", unless we're dealing with Opera, of course). Returns a string containing the mozilla version.