binuap

package module
v0.0.0-...-cb631d4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

README

ARCHIVED: https://github.com/ua-parser/uap-core now does this by default.

binuap

This is a trivial wrapper around https://github.com/ua-parser/uap-core that includes the regexes.yaml database as go source code. This removes the runtime dependency on regexes.yaml.

Usage

import "github.com/vektah/binuap"

func main() {
	ua := UAP.Parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true")

	fmt.Println(res.Device.Family)
}

See the docs on https://github.com/ua-parser/uap-go/tree/master/uaparser for details on ua itself.

Updating the data

# Make sure you have go-bindata
go get -u github.com/jteeuwen/go-bindata/...

# Then generate the new data file
go generate

# And make sure you run the tests. It will validate all the regexes
go test

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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