diff options
author | Kevin <kevinschoon@gmail.com> | 2019-07-14 01:50:31 +0300 |
---|---|---|
committer | Kevin <kevinschoon@gmail.com> | 2019-07-14 01:50:31 +0300 |
commit | 155c1a5afe846deb3d7429e2af2efa14ae8a59f9 (patch) | |
tree | 899d2c78f0941f8a0719205faaab3e0595122770 /useragent | |
parent | fb5fac92d2173c2a5b07ed4ecc7b5fefe8484ed2 (diff) |
return parsed and raw user agent
Diffstat (limited to 'useragent')
-rw-r--r-- | useragent/useragent.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/useragent/useragent.go b/useragent/useragent.go index e0de8e7..ebac6c4 100644 --- a/useragent/useragent.go +++ b/useragent/useragent.go @@ -5,9 +5,10 @@ import ( ) type UserAgent struct { - Product string - Version string - Comment string + Product string `json:"product,omitempty"` + Version string `json:"version,omitempty"` + Comment string `json:"comment,omitempty"` + RawValue string `json:"raw_value,omitempty"` } func Parse(s string) UserAgent { @@ -31,8 +32,9 @@ func Parse(s string) UserAgent { } } return UserAgent{ - Product: parts[0], - Version: version, - Comment: comment, + Product: parts[0], + Version: version, + Comment: comment, + RawValue: s, } } |