An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/sebest/go-uasparser

Package uas provides a go implementation of the http://user-agent-string.info/ processor. Standard usage is to provide a user-agent string to the Parse method of a Manifest instance and retrieve an Agent instance in return. From the Agent, you can obtain: browser details, operating system details, and device details. You must create a Manifest instance by providing an XML file from the UAS.info site (http://user-agent-string.info/rpc/get_data.php?key=free&format=xml&download=y) to the LoadFile function; or you can provide a Reader of similar ilk to the Load function. This package currently doesn't support downloading Manifests automatically, but you can also easily create new instances of different Manifests; i.e. a Manifest is not a global object. This package also does not yet support the .ini format; mostly this was to make processing easier by using the built-in XML unmarshalling capabilities of Go. Given a Manifest, you can now easily parse an Agent like so: You can check out the model structure to figure out what other values are available. Unlike other implementations, the values are not simply returned as a flat map. Currently, robots are treated differently in that any agent recognized as one is returned from Parse as a nil value. You can check to see if the agent is indeed a robot by asking if it's so:

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/sebest/go-uasparser
License: MIT
Latest release: over 10 years ago
First release: over 10 years ago
Namespace: github.com/sebest
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 17 days ago

    Loading...
    Readme
    Loading...