GeoAIGuard
Optional guard that restricts route access to verified AI bot requests. Uses GeoAIService.isAIBot() internally — no duplicate detection logic.
Usage
typescript
import { Controller, Get, UseGuards } from '@nestjs/common';
import { GeoAIGuard } from 'geo-ai-nest';
@Controller('ai')
export class AIController {
@Get('sitemap')
@UseGuards(GeoAIGuard)
getAISitemap() {
// Only AI bots (GPTBot, ClaudeBot, etc.) can access this
return 'AI-specific sitemap content';
}
}The guard returns
true when the User-Agent matches a known AI bot and false otherwise, resulting in a 403 for non-bot requests.