/
githubmirror
/
photoprism
Обзор
Документация
Войти
/
githubmirror
/
photoprism
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
pkg/http/header/bots.go
32 строки
627 B
Michael Mayer
Pkg: Move /service/http/... to /http/... and add package /http/dns
19 окт 2025, 22:08
19 окт 2025, 22:08
a921f82
Код
Авторство
О чём код?
package header import ( "fmt" "regexp" "strings" ) // Bots contains common search engine bot names. var Bots = []string{ "Googlebot", "PetalBot", "Bingbot", "DuckDuckBot", "Yahoo! Slurp", "Baiduspider", "Bytespider", "YandexBot", "Sogou", "Exabot", "Applebot", "facebot", "github-camo", } // BotsRegexp matches common search engine bot names. var BotsRegexp = regexp.MustCompile(fmt.Sprintf("(%s)", strings.Join(Bots, "|"))) // IsBot checks whether the specified user agent string probably belongs to a search engine bot. func IsBot(userAgent string) bool { return BotsRegexp.FindString(userAgent) != "" }