udger

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 8 Imported by: 0

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 Client

type Client interface {
	// Lookup gathers information about the client using the provided user agent
	Lookup(ua string) (*Info, error)
	// LookupIP gathers information about the client using the provided IP
	LookupIP(ip net.IP) (*IPInfo, error)
}

func New

func New(dbPath string) (Client, 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

type Crawler

type Crawler struct {
	ID               int    `json:"id"`
	UA               string `json:"ua_string"`
	Ver              string `json:"ver"`
	VerMajor         string `json:"ver_major"`
	ClassID          int    `json:"class_id"`
	LastSeen         string `json:"last_seen"`
	RespectRobotstxt string `json:"respect_robotstxt"`
	Family           string `json:"family"`
	FamilyCode       string `json:"family_code"`
	FamilyHomepage   string `json:"family_homepage"`
	FamilyIcon       string `json:"family_icon"`
	Vendor           string `json:"vendor"`
	VendorCode       string `json:"vendor_code"`
	VendorHomepage   string `json:"vendor_homepage"`
	Name             string `json:"name"`
}

type CrawlerClass

type CrawlerClass struct {
	ID                        int    `json:"id"`
	CrawlerClassification     string `json:"crawler_classification"`
	CrawlerClassificationCode string `json:"crawler_classification_code"`
}

type DataCenter

type DataCenter struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	NameCode string `json:"name_code"`
	Homepage string `json:"homepage"`
}

type DataCenterRange

type DataCenterRange struct {
	DatacenterID int    `json:"datacenter_id"`
	IPFrom       string `json:"ip_from"`
	IPTo         string `json:"ip_to"`
	IPLongFrom   int    `json:"iplong_from"`
	IPLongTo     int    `json:"iplong_to"`
}

type DataCenterRange6

type DataCenterRange6 struct {
	DatacenterID int    `json:"datacenter_id"`
	IPFrom       string `json:"ip_from"`
	IPTo         string `json:"ip_to"`
	IPLongFrom0  int    `json:"iplong_from0"`
	IPLongFrom1  int    `json:"iplong_from1"`
	IPLongFrom2  int    `json:"iplong_from2"`
	IPLongFrom3  int    `json:"iplong_from3"`
	IPLongFrom4  int    `json:"iplong_from4"`
	IPLongFrom5  int    `json:"iplong_from5"`
	IPLongFrom6  int    `json:"iplong_from6"`
	IPLongFrom7  int    `json:"iplong_from7"`
	IPLongTo0    int    `json:"iplong_to0"`
	IPLongTo1    int    `json:"iplong_to1"`
	IPLongTo2    int    `json:"iplong_to2"`
	IPLongTo3    int    `json:"iplong_to3"`
	IPLongTo4    int    `json:"iplong_to4"`
	IPLongTo5    int    `json:"iplong_to5"`
	IPLongTo6    int    `json:"iplong_to6"`
	IPLongTo7    int    `json:"iplong_to7"`
}

type Device

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

Device contains all the information about the device type

type IP

type IP struct {
	IP            string `json:"ip"`
	ClassID       int    `json:"class_id"`
	CrawlerID     int    `json:"crawler_id"`
	IPLastSeen    string `json:"ip_last_seen"`
	IPHostname    string `json:"ip_hostname"`
	IPCountry     string `json:"ip_country"`
	IPCity        string `json:"ip_city"`
	IPCountryCode string `json:"ip_country_code"`
}

Device contains all the information about the device type

type IPClass

type IPClass struct {
	ID                   int    `json:"id"`
	IPClassification     string `json:"ip_classification"`
	IPClassificationCode string `json:"ip_classification_code"`
}

type IPInfo

type IPInfo struct {
	IP               IP               `json:"ip"`
	IPClass          IPClass          `json:"ip_class"`
	Crawler          Crawler          `json:"crawler"`
	CrawlerClass     CrawlerClass     `json:"crawler_class"`
	DataCenter       DataCenter       `json:"data_center"`
	DataCenterRange  DataCenterRange  `json:"data_center_range"`
	DataCenterRange6 DataCenterRange6 `json:"data_center_range6"`
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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