Documentation ¶
Overview ¶
Package udger package allow you to load in memory and lookup the user agent database to extract value from the provided user agent
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Browser ¶
type Browser struct { Name string `json:"name"` Family string `json:"family"` Version string `json:"version"` Engine string `json:"engine"` Type string `json:"type"` Company string `json:"company"` Icon string `json:"icon"` // contains filtered or unexported fields }
Browser contains information about the browser type, engine and off course its name
type Info ¶
type Info struct { Browser Browser `json:"browser"` OS OS `json:"os"` Device Device `json:"device"` }
Info is the struct returned by the Lookup(ua string) function, contains everything about the UA
type OS ¶
type OS struct { Name string `json:"name"` Family string `json:"family"` Icon string `json:"icon"` Company string `json:"company"` }
OS contains all the information about the operating system
type Udger ¶
type Udger struct { Browsers map[int]Browser OS map[int]OS Devices map[int]Device // contains filtered or unexported fields }
Udger contains the data and exposes the Lookup(ua string) function
func New ¶
New creates a new instance of Udger from the dbPath database loaded in memory for fast lookup.
func (*Udger) Lookup ¶
Lookup returns all the metadata possible for the given user agent string ua.
Example ¶
udger, err := New("./udgerdb_v3.dat") if err != nil { panic(err) } info, err := udger.Lookup("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2575.0 Safari/537.36") if err != nil { panic(err) } fmt.Println(info.Browser.Family, info.OS.Family)
Output: Chrome OS X
Click to show internal directories.
Click to hide internal directories.