forked from avct/uasurfer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconst_string.go
118 lines (106 loc) · 3.02 KB
/
const_string.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package uasurfer
var deviceTypeStrings = map[DeviceType]string{
DeviceUnknown: "unknown",
DeviceComputer: "desktop",
DeviceTablet: "tablet",
DevicePhone: "mobile",
DeviceConsole: "console",
DeviceWearable: "wearable",
DeviceTV: "tv",
}
func (dt DeviceType) String() string {
if deviceType, ok := deviceTypeStrings[dt]; ok {
return deviceType
}
return "unknown"
}
var browserTypeStrings = map[BrowserName]string{
BrowserUnknown: "Unknown",
BrowserChrome: "Chrome",
BrowserIE: "IE",
BrowserSafari: "Safari",
BrowserFirefox: "Firefox",
BrowserOpera: "Opera",
BrowserBlackberry: "Blackberry",
BrowserUCBrowser: "UCBrowser",
BrowserSilk: "Silk",
BrowserNokia: "Nokia",
BrowserNetFront: "NetFront",
BrowserQQ: "QQ",
BrowserMaxthon: "Maxthon",
BrowserSogouExplorer: "SogouExplorer",
BrowserSpotify: "Spotify",
BrowserWebView: "WebView",
BrowserSamsung: "SamsungBrowser",
BrowserFacebook: "Facebook",
BrowserMiui: "MiuiBrowser",
BrowserCocCoc: "CocCocBrowser",
BrowserCrosswalk: "Crosswalk",
BrowserLine: "LINE",
BrowserEdge: "Edge",
BrowserVivo: "VivoBrowser",
BrowserYandex: "YandexBrowser",
BrowserDuckDuckGo: "DuckDuckGo",
BrowserAvast: "Avast",
BrowserAppleBot: "AppleBot",
BrowserBaiduBot: "BaiduBot",
BrowserBingBot: "BingBot",
BrowserDuckDuckGoBot: "DuckDuckGoBot",
BrowserFacebookBot: "FacebookBot",
BrowserGoogleBot: "GoogleBot",
BrowserLinkedInBot: "LinkedInBot",
BrowserMsnBot: "MsnBot",
BrowserPingdomBot: "PingdomBot",
BrowserTwitterBot: "TwitterBot",
BrowserYandexBot: "YandexBot",
}
func (bn BrowserName) String() string {
if browserType, ok := browserTypeStrings[bn]; ok {
return browserType
}
return "Unknown"
}
var osTypeStrings = map[OSName]string{
OSUnknown: "Unknown",
OSWindowsPhone: "WindowsPhoneOS",
OSWindows: "Windows",
OSMacOSX: "OS X",
OSiOS: "iOS",
OSAndroid: "Android",
OSBlackberry: "Blackberry",
OSChromeOS: "ChromeOS",
OSKindle: "Kindle",
OSWebOS: "webOS",
OSLinux: "Linux",
OSPlaystation: "Playstation",
OSXbox: "Xbox",
OSNintendo: "Nintendo",
OSBot: "Bot",
}
func (os OSName) String() string {
if osType, ok := osTypeStrings[os]; ok {
return osType
}
return "Unknown"
}
var platformStrings = map[Platform]string{
PlatformUnknown: "Unknown",
PlatformWindows: "Windows",
PlatformMac: "Mac",
PlatformLinux: "Linux",
PlatformiPad: "iPad",
PlatformiPhone: "iPhone",
PlatformiPod: "iPod",
PlatformBlackberry: "Blackberry",
PlatformWindowsPhone: "WindowsPhone",
PlatformPlaystation: "Playstation",
PlatformXbox: "Xbox",
PlatformNintendo: "Nintendo",
PlatformBot: "Bot",
}
func (p Platform) String() string {
if platform, ok := platformStrings[p]; ok {
return platform
}
return "Unknown"
}