fiftyonedegrees

package module
Version: v0.0.0-...-60eec0b Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: BSD-2-Clause Imports: 4 Imported by: 0

README

#51Degrees for golang 51Degrees UserAgent. Note that the primary difference between https://github.com/hdczsf/51degrees.go and https://github.com/simplereach/51degrees is that the SimpleReach version supports the 3.2 data file format.

Installation

go get github.com/simplereach/51degrees

Example

package main

import (
	"fmt"
	"github.com/simplereach/51degrees"
)

func main() {
	properties := "DeviceType, IsMobile, IsSmartPhone, IsTablet, IsTv, HardwareName, HardwareVendor, HardwareModel, BrowserName, BrowserVersion, PlatformName, PlatformVersion, ScreenPixelsWidth, ScreenPixelsHeight"
	testUA := "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
	item, err := NewFiftyoneDegrees("51Degrees-EnterpriseV3_2.dat", properties)
	if err != nil {
		fmt.Println("err=", err)
		return
	}
	fmt.Println(item.Parse(testUA))
	item.Close()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FiftyoneDegreesDataSet

type FiftyoneDegreesDataSet struct {
	// contains filtered or unexported fields
}

func NewFiftyoneDegreesDataSet

func NewFiftyoneDegreesDataSet(fileName, properties string) (*FiftyoneDegreesDataSet, error)

func (*FiftyoneDegreesDataSet) Close

func (fdds *FiftyoneDegreesDataSet) Close()

func (*FiftyoneDegreesDataSet) Parse

func (fdds *FiftyoneDegreesDataSet) Parse(userAgent string) string

type FiftyoneDegreesProvider

type FiftyoneDegreesProvider struct {
	// contains filtered or unexported fields
}

func NewFiftyoneDegreesProvider

func NewFiftyoneDegreesProvider(fileName string, properties string, poolSize int, cacheSize int) (*FiftyoneDegreesProvider, error)

func (*FiftyoneDegreesProvider) Close

func (fdp *FiftyoneDegreesProvider) Close()

func (*FiftyoneDegreesProvider) Parse

func (fdp *FiftyoneDegreesProvider) Parse(userAgent string) string

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL