github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/agents/agents.go (about) 1 // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn . 2 3 package agents 4 5 import "strings" 6 7 var AllAgents = []*Agent{ 8 NewAgent("baidu", []string{".baidu.com."}, nil, []string{"Baidu"}), 9 NewAgent("google", []string{".googlebot.com."}, nil, []string{"Google"}), 10 NewAgent("bing", []string{".search.msn.com."}, nil, []string{"bingbot"}), 11 NewAgent("sogou", []string{".sogou.com."}, nil, []string{"Sogou"}), 12 NewAgent("youdao", []string{".163.com."}, nil, []string{"Youdao"}), 13 NewAgent("yahoo", []string{".yahoo.com."}, nil, []string{"Yahoo"}), 14 NewAgent("bytedance", []string{".bytedance.com."}, nil, []string{"Bytespider"}), 15 NewAgent("sm", []string{".sm.cn."}, nil, []string{"YisouSpider"}), 16 NewAgent("yandex", []string{".yandex.com.", ".yndx.net."}, nil, []string{"Yandex"}), 17 NewAgent("semrush", []string{".semrush.com."}, nil, []string{"SEMrush"}), 18 } 19 20 func IsAgentFromUserAgent(userAgent string) bool { 21 for _, agent := range AllAgents { 22 if len(agent.Keywords) > 0 { 23 for _, keyword := range agent.Keywords { 24 if strings.Contains(userAgent, keyword) { 25 return true 26 } 27 } 28 } 29 } 30 return false 31 }