How to allow google bot,when i open "i'm under attack" mode?

as this title.
i want open “i’m under attack” mode and allow google bot.
can set whitelist?
how to?

The only way I can think of is to use a Firewall Rule that checks if the User Agent is NOT the Googlebot string, then Javascript Challenge the visitor.

The problem would be if an attacker is spoofing a Googlebot User Agent string.

first:User Agent can forged,
so The best way is Tracking IP source.

There’s no list of IP addresses Googlebots use, so you won’t be able to whitelist by IP address.

yes,no list.
but can use nslookup cli query Isn’t it google bot.