feat: expose constants in a new agents lib #58
Merged
+537
−326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This exposes all the user agent string consts in a new
go-useragent/agents
sub-directory which can be referenced by consumers.The trie structure was also refactored to store matched tokens as
uint8
instead of strings, which should help reduce idle memory consumption a little bit.New
A couple new methods have introduced on the
UserAgent
type:Browser()
returns newBrowser
string alias (GetBrowser()
has been deprecated)OS()
returns newOS
string alias (GetOS()
has been deprecated)Device()
returns a newDevice
string alias (GetDevice()
has been deprecated)BrowserVersion()
returns browser version (GetVersion()
has been deprecated as we prepare for OS versions)BrowserVersionMajor()
returns major browser version (GetMajorVersion()
has been deprecated as we prepare for OS versions)BrowserVersionMinor()
BrowserVersionPatch()