package obs
// knownNetwork is what the forge knows about an autonomous system
// beyond the registry's handle for it: a name a reader would recognise,
// and whether it rents machines to anyone who pays. A browser from a
// hosting network is somebody's server more often than somebody.
type knownNetwork struct {
name string
hosting bool
}
var networks = map[uint32]knownNetwork{
15169: {"Google", false},
396982: {"Google Cloud", true},
8075: {"Microsoft", true},
16509: {"Amazon", true},
14618: {"Amazon", true},
714: {"Apple", false},
32934: {"Meta", false},
13335: {"Cloudflare", true},
24940: {"Hetzner", true},
213230: {"Hetzner Cloud", true},
16276: {"OVH", true},
14061: {"DigitalOcean", true},
63949: {"Akamai (Linode)", true},
20473: {"Vultr", true},
45102: {"Alibaba Cloud", true},
37963: {"Alibaba Cloud", true},
132203: {"Tencent Cloud", true},
45090: {"Tencent Cloud", true},
31898: {"Oracle Cloud", true},
51167: {"Contabo", true},
12876: {"Scaleway", true},
60781: {"Leaseweb", true},
9009: {"M247", true},
136907: {"Huawei Cloud", true},
55967: {"Baidu", false},
13238: {"Yandex", false},
43037: {"Seznam", false},
7922: {"Comcast", false},
3320: {"Deutsche Telekom", false},
7018: {"AT&T", false},
701: {"Verizon", false},
22773: {"Cox", false},
20115: {"Charter", false},
2856: {"BT", false},
3215: {"Orange", false},
3352: {"Telefónica", false},
6830: {"Liberty Global", false},
36459: {"GitHub", true},
}
// NetworkName is the name a reader would recognise for an autonomous
// system, else the registry's own.
func NetworkName(asn uint32, registry string) string {
if n, ok := networks[asn]; ok {
return n.name
}
return registry
}
// verifiedBy is the network each named crawler must come from. A claim
// from anywhere else is an impostor. A crawler that is not listed is
// never called one: it is unverified, which says only that the forge
// cannot check it.
//
// By network rather than by each operator's published address list: the
// network table already answers it with no list of its own to keep
// fresh. It is coarser — anyone renting a machine on Azure can claim
// GPTBot and pass — and it still catches the common forgery, a
// crawler's name sent from a network that is nobody's crawler.
var verifiedBy = map[string][]uint32{
"Googlebot": {15169},
"GoogleOther": {15169},
"Google-Extended": {15169},
"bingbot": {8075},
"Applebot": {714},
"GPTBot": {8075},
"OAI-SearchBot": {8075},
"ChatGPT-User": {8075},
"YandexBot": {13238},
"Baiduspider": {55967},
"Meta": {32934},
"Amazonbot": {16509, 14618},
"SeznamBot": {43037},
}