MM-14617 Dependency upgrades and adding modules support. (#10517)
* Dependency upgrades and adding modules support. * Commenting out file tests playload verification portion. * Fixing viper. * Fixing hclog.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bd8a54bb08
Коммит
41d117c37b
2
vendor/github.com/avct/uasurfer/README.md
сгенерированный
поставляемый
2
vendor/github.com/avct/uasurfer/README.md
сгенерированный
поставляемый
@@ -70,6 +70,7 @@ where example UserAgent is:
|
||||
* `BrowserOpera` - [Opera](https://en.wikipedia.org/wiki/Opera_(web_browser))
|
||||
* `BrowserUCBrowser` - [UC Browser](https://en.wikipedia.org/wiki/UC_Browser)
|
||||
* `BrowserSilk` - Amazon [Silk](https://en.wikipedia.org/wiki/Amazon_Silk)
|
||||
* `BrowserQQ` - Tencent [QQ](https://en.wikipedia.org/wiki/Tencent_QQ)
|
||||
* `BrowserSpotify` - [Spotify](https://en.wikipedia.org/wiki/Spotify#Clients) desktop client
|
||||
* `BrowserBlackberry` - RIM [BlackBerry](https://en.wikipedia.org/wiki/BlackBerry)
|
||||
* `BrowserYandex` - [Yandex](https://en.wikipedia.org/wiki/Yandex_Browser)
|
||||
@@ -157,7 +158,6 @@ DeviceType is typically quite accurate, though determining between phones and ta
|
||||
* Better version support on Firefox derivatives (e.g. SeaMonkey)
|
||||
* Potential additional browser support:
|
||||
* "NetFront" (1% share in India)
|
||||
* "QQ Browser" (6.5% share in China)
|
||||
* "Sogou Explorer" (5% share in China)
|
||||
* "Maxthon" (1.5% share in China)
|
||||
* "Nokia"
|
||||
|
||||
17
vendor/github.com/avct/uasurfer/browser.go
сгенерированный
поставляемый
17
vendor/github.com/avct/uasurfer/browser.go
сгенерированный
поставляемый
@@ -23,7 +23,7 @@ func (u *UserAgent) evalBrowserName(ua string) bool {
|
||||
// Blackberry goes first because it reads as MSIE & Safari
|
||||
if strings.Contains(ua, "blackberry") || strings.Contains(ua, "playbook") || strings.Contains(ua, "bb10") || strings.Contains(ua, "rim ") {
|
||||
u.Browser.Name = BrowserBlackberry
|
||||
return u.isBot()
|
||||
return u.maybeBot()
|
||||
}
|
||||
|
||||
if strings.Contains(ua, "applewebkit") {
|
||||
@@ -31,6 +31,9 @@ func (u *UserAgent) evalBrowserName(ua string) bool {
|
||||
case strings.Contains(ua, "googlebot"):
|
||||
u.Browser.Name = BrowserGoogleBot
|
||||
|
||||
case strings.Contains(ua, "qq/") || strings.Contains(ua, "qqbrowser/"):
|
||||
u.Browser.Name = BrowserQQ
|
||||
|
||||
case strings.Contains(ua, "opr/") || strings.Contains(ua, "opios/"):
|
||||
u.Browser.Name = BrowserOpera
|
||||
|
||||
@@ -89,11 +92,14 @@ func (u *UserAgent) evalBrowserName(ua string) bool {
|
||||
goto notwebkit
|
||||
|
||||
}
|
||||
return u.isBot()
|
||||
return u.maybeBot()
|
||||
}
|
||||
|
||||
notwebkit:
|
||||
switch {
|
||||
case strings.Contains(ua, "qq/") || strings.Contains(ua, "qqbrowser/"):
|
||||
u.Browser.Name = BrowserQQ
|
||||
|
||||
case strings.Contains(ua, "msie") || strings.Contains(ua, "trident"):
|
||||
u.Browser.Name = BrowserIE
|
||||
|
||||
@@ -153,7 +159,7 @@ notwebkit:
|
||||
|
||||
}
|
||||
|
||||
return u.isBot()
|
||||
return u.maybeBot()
|
||||
}
|
||||
|
||||
// Retrieve browser version
|
||||
@@ -173,6 +179,11 @@ func (u *UserAgent) evalBrowserVersion(ua string) {
|
||||
_ = u.Browser.Version.findVersionNumber(ua, "chrome/") || u.Browser.Version.findVersionNumber(ua, "crios/") || u.Browser.Version.findVersionNumber(ua, "crmo/")
|
||||
case BrowserYandex:
|
||||
_ = u.Browser.Version.findVersionNumber(ua, "yabrowser/")
|
||||
case BrowserQQ:
|
||||
if u.Browser.Version.findVersionNumber(ua, "qq/") {
|
||||
return
|
||||
}
|
||||
_ = u.Browser.Version.findVersionNumber(ua, "qqbrowser/")
|
||||
case BrowserIE:
|
||||
if u.Browser.Version.findVersionNumber(ua, "msie ") || u.Browser.Version.findVersionNumber(ua, "edge/") {
|
||||
return
|
||||
|
||||
10
vendor/github.com/avct/uasurfer/const_string.go
сгенерированный
поставляемый
10
vendor/github.com/avct/uasurfer/const_string.go
сгенерированный
поставляемый
@@ -2,7 +2,7 @@
|
||||
|
||||
package uasurfer
|
||||
|
||||
import "fmt"
|
||||
import "strconv"
|
||||
|
||||
const _DeviceType_name = "DeviceUnknownDeviceComputerDeviceTabletDevicePhoneDeviceConsoleDeviceWearableDeviceTV"
|
||||
|
||||
@@ -10,7 +10,7 @@ var _DeviceType_index = [...]uint8{0, 13, 27, 39, 50, 63, 77, 85}
|
||||
|
||||
func (i DeviceType) String() string {
|
||||
if i < 0 || i >= DeviceType(len(_DeviceType_index)-1) {
|
||||
return fmt.Sprintf("DeviceType(%d)", i)
|
||||
return "DeviceType(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _DeviceType_name[_DeviceType_index[i]:_DeviceType_index[i+1]]
|
||||
}
|
||||
@@ -21,7 +21,7 @@ var _BrowserName_index = [...]uint16{0, 14, 27, 36, 49, 63, 77, 89, 106, 122, 13
|
||||
|
||||
func (i BrowserName) String() string {
|
||||
if i < 0 || i >= BrowserName(len(_BrowserName_index)-1) {
|
||||
return fmt.Sprintf("BrowserName(%d)", i)
|
||||
return "BrowserName(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _BrowserName_name[_BrowserName_index[i]:_BrowserName_index[i+1]]
|
||||
}
|
||||
@@ -32,7 +32,7 @@ var _OSName_index = [...]uint8{0, 9, 23, 32, 40, 45, 54, 66, 76, 84, 91, 98, 111
|
||||
|
||||
func (i OSName) String() string {
|
||||
if i < 0 || i >= OSName(len(_OSName_index)-1) {
|
||||
return fmt.Sprintf("OSName(%d)", i)
|
||||
return "OSName(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _OSName_name[_OSName_index[i]:_OSName_index[i+1]]
|
||||
}
|
||||
@@ -43,7 +43,7 @@ var _Platform_index = [...]uint8{0, 15, 30, 41, 54, 66, 80, 92, 110, 130, 149, 1
|
||||
|
||||
func (i Platform) String() string {
|
||||
if i < 0 || i >= Platform(len(_Platform_index)-1) {
|
||||
return fmt.Sprintf("Platform(%d)", i)
|
||||
return "Platform(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _Platform_name[_Platform_index[i]:_Platform_index[i+1]]
|
||||
}
|
||||
|
||||
16
vendor/github.com/avct/uasurfer/system.go
сгенерированный
поставляемый
16
vendor/github.com/avct/uasurfer/system.go
сгенерированный
поставляемый
@@ -11,7 +11,6 @@ var (
|
||||
)
|
||||
|
||||
func (u *UserAgent) evalOS(ua string) bool {
|
||||
|
||||
s := strings.IndexRune(ua, '(')
|
||||
e := strings.IndexRune(ua, ')')
|
||||
if s > e {
|
||||
@@ -102,23 +101,18 @@ func (u *UserAgent) evalOS(ua string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
return u.isBot()
|
||||
return u.maybeBot()
|
||||
}
|
||||
|
||||
func (u *UserAgent) isBot() bool {
|
||||
|
||||
if u.OS.Platform == PlatformBot || u.OS.Name == OSBot {
|
||||
u.DeviceType = DeviceComputer
|
||||
return true
|
||||
}
|
||||
|
||||
if u.Browser.Name >= BrowserBot && u.Browser.Name <= BrowserYahooBot {
|
||||
// maybeBot checks if the UserAgent is a bot and sets
|
||||
// all bot related fields if it is
|
||||
func (u *UserAgent) maybeBot() bool {
|
||||
if u.IsBot() {
|
||||
u.OS.Platform = PlatformBot
|
||||
u.OS.Name = OSBot
|
||||
u.DeviceType = DeviceComputer
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
34
vendor/github.com/avct/uasurfer/uasurfer.go
сгенерированный
поставляемый
34
vendor/github.com/avct/uasurfer/uasurfer.go
сгенерированный
поставляемый
@@ -24,6 +24,11 @@ const (
|
||||
DeviceTV
|
||||
)
|
||||
|
||||
// StringTrimPrefix is like String() but trims the "Device" prefix
|
||||
func (d DeviceType) StringTrimPrefix() string {
|
||||
return strings.TrimPrefix(d.String(), "Device")
|
||||
}
|
||||
|
||||
// BrowserName (int) returns a constant.
|
||||
type BrowserName int
|
||||
|
||||
@@ -66,6 +71,11 @@ const (
|
||||
BrowserYahooBot // Bot list ends here
|
||||
)
|
||||
|
||||
// StringTrimPrefix is like String() but trims the "Browser" prefix
|
||||
func (b BrowserName) StringTrimPrefix() string {
|
||||
return strings.TrimPrefix(b.String(), "Browser")
|
||||
}
|
||||
|
||||
// OSName (int) returns a constant.
|
||||
type OSName int
|
||||
|
||||
@@ -91,6 +101,11 @@ const (
|
||||
OSBot
|
||||
)
|
||||
|
||||
// StringTrimPrefix is like String() but trims the "OS" prefix
|
||||
func (o OSName) StringTrimPrefix() string {
|
||||
return strings.TrimPrefix(o.String(), "OS")
|
||||
}
|
||||
|
||||
// Platform (int) returns a constant.
|
||||
type Platform int
|
||||
|
||||
@@ -114,6 +129,11 @@ const (
|
||||
PlatformBot
|
||||
)
|
||||
|
||||
// StringTrimPrefix is like String() but trims the "Platform" prefix
|
||||
func (p Platform) StringTrimPrefix() string {
|
||||
return strings.TrimPrefix(p.String(), "Platform")
|
||||
}
|
||||
|
||||
type Version struct {
|
||||
Major int
|
||||
Minor int
|
||||
@@ -164,6 +184,20 @@ func (ua *UserAgent) Reset() {
|
||||
ua.DeviceType = DeviceUnknown
|
||||
}
|
||||
|
||||
// IsBot returns true if the UserAgent represent a bot
|
||||
func (ua *UserAgent) IsBot() bool {
|
||||
if ua.Browser.Name >= BrowserBot && ua.Browser.Name <= BrowserYahooBot {
|
||||
return true
|
||||
}
|
||||
if ua.OS.Name == OSBot {
|
||||
return true
|
||||
}
|
||||
if ua.OS.Platform == PlatformBot {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Parse accepts a raw user agent (string) and returns the UserAgent.
|
||||
func Parse(ua string) *UserAgent {
|
||||
dest := new(UserAgent)
|
||||
|
||||
Ссылка в новой задаче
Block a user