Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpolden/echoip.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin <kevinschoon@gmail.com>2019-07-14 01:50:31 +0300
committerKevin <kevinschoon@gmail.com>2019-07-14 01:50:31 +0300
commit155c1a5afe846deb3d7429e2af2efa14ae8a59f9 (patch)
tree899d2c78f0941f8a0719205faaab3e0595122770 /useragent
parentfb5fac92d2173c2a5b07ed4ecc7b5fefe8484ed2 (diff)
return parsed and raw user agent
Diffstat (limited to 'useragent')
-rw-r--r--useragent/useragent.go14
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,
}
}