udger

package module
v0.0.0-...-41a723f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2017 License: MIT Imports: 6 Imported by: 1

README

Udger golang (format V3)

this package reads in memory all the database from udger and lets you lookup user agents's metadatas.

install

go get github.com/udger/udger

Documentation

For detailed documentation and basic usage examples, please see the package documentation at https://godoc.org/github.com/udger/udger

Automatic updates download

For autoupdate data use Udger data updater (https://udger.com/support/documentation/?doc=62)

old v2 format

If you still use the previous format of the db (v2), please see the branch old_format_v2

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

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 it's name

type Device

type Device struct {
	Name string `json:"name"`
	Icon string `json:"icon"`
}

Device contains all the information about the device type

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

func New(dbPath string) (*Udger, error)

New creates a new instance of Udger and load all the database in memory to allow fast lookup you need to pass the sqlite database in parameter

func (*Udger) Lookup

func (udger *Udger) Lookup(ua string) (*Info, error)

Lookup one user agent and return a Info struct who contains all the metadata possible for the UA.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL