Documentation
¶
Index ¶
- Constants
- type AgentType
- type Knownagents
- func (Knownagents) CaddyModule() caddy.ModuleInfo
- func (m *Knownagents) FetchRobotsTxt(ctx caddy.Context) error
- func (m *Knownagents) Provision(ctx caddy.Context) error
- func (m Knownagents) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (m *Knownagents) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (m Knownagents) Validate() error
- type RobotsTxt
Constants ¶
const AnalyticsEndpoint = "https://api.knownagents.com/visits"
The address for the Known Agents agent analytics API endpoint.
const RobotsTxtEndpoint = "https://api.knownagents.com/robots-txts"
The address for the Known Agents robots.txt generation API endpoint.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentType ¶
type AgentType = string
AgentTypes are groups of agent classified by the Known Agents API.
const ( AIAssistant AgentType = "AI Assistant" AIDataScraper AgentType = "AI Data Scraper" AISearchCrawler AgentType = "AI Search Crawler" Archiver AgentType = "Archiver" DeveloperHelper AgentType = "Developer Helper" Fetcher AgentType = "Fetcher" HeadlessBrowser AgentType = "Headless Browser" IntelligenceGatherer AgentType = "Intelligence Gatherer" Scraper AgentType = "Scraper" SearchEngineCrawlers AgentType = "Search Engine Crawler" SEOCrawler AgentType = "SEO Crawler" Uncategorized AgentType = "Uncategorized" UndocumentedAIAgent AgentType = "Undocumented AI Agent" )
type Knownagents ¶
type Knownagents struct {
// The access token used to authenticate to the Known Agents agent
// analytics API endpoint.
AccessToken string `json:"access_token"`
// Enables generation of robots.txt derived from agent analytics data using
// the Known Agents robots.txt generation API endpoint.
RobotsTxt *RobotsTxt `json:"robots_txt,omitempty"`
// contains filtered or unexported fields
}
Knownagents is a middleware which implements a HTTP handler that sends HTTP request information as visit events to the Known Agents API.
Its API is still experimental and may be subject to change.
func (Knownagents) CaddyModule ¶
func (Knownagents) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Knownagents) FetchRobotsTxt ¶
func (m *Knownagents) FetchRobotsTxt(ctx caddy.Context) error
FetchRobotsTxt queries the Known Agents robots.txt generation API endpoint and stores the returned robots.txt content.
func (*Knownagents) Provision ¶
func (m *Knownagents) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (Knownagents) ServeHTTP ¶
func (m Knownagents) ServeHTTP( w http.ResponseWriter, r *http.Request, next caddyhttp.Handler, ) error
ServeHTTP implements caddyhttp.MiddlewareHandler.
func (*Knownagents) UnmarshalCaddyfile ¶
func (m *Knownagents) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements caddyfile.Unmarshaler.
func (Knownagents) Validate ¶
func (m Knownagents) Validate() error
Validate implements caddy.Validator.
type RobotsTxt ¶
type RobotsTxt struct {
// A list of agent types to block.
AgentTypes []AgentType `json:"agent_types"`
// The path to disallow access for the specified agent types.
Disallow string `json:"disallow,omitempty"`
// contains filtered or unexported fields
}
RobotsTxt configures automated generation of robots.txt via the Known Agents API.