Documentation
¶
Overview ¶
Package config defines gocrawl's layered configuration (defaults -> YAML file -> env -> flags) and maps it onto crawler.Options.
Index ¶
Constants ¶
View Source
const ExampleYAML = `` /* 2549-byte string literal not displayed */
ExampleYAML is a fully-commented starter configuration written by `gocrawl init`.
Variables ¶
This section is empty.
Functions ¶
func WriteExample ¶
WriteExample writes the example configuration to path, refusing to overwrite an existing file.
Types ¶
type AnalyzersConfig ¶
type AnalyzersConfig struct {
Enabled []string `mapstructure:"enabled"`
Disabled []string `mapstructure:"disabled"`
// Specialized turns on opt-in checks that are off by default: the lower-confidence
// AI-search heuristics (AEO direct-answer-lead, GEO quotable-density) and the WordPress
// analyzer's active security-endpoint probes. They only fire when this is set.
Specialized bool `mapstructure:"specialized"`
}
AnalyzersConfig selects which analyzers run.
type Config ¶
type Config struct {
Seed string `mapstructure:"seed"`
Render string `mapstructure:"render"`
Crawl CrawlConfig `mapstructure:"crawl"`
Output OutputConfig `mapstructure:"output"`
Analyzers AnalyzersConfig `mapstructure:"analyzers"`
}
Config is the full gocrawl configuration.
func Load ¶
Load reads configuration from the optional YAML file at path (empty = none), overlaid on defaults, then GOCRAWL_* environment variables.
type CrawlConfig ¶
type CrawlConfig struct {
MaxDepth int `mapstructure:"max_depth"`
MaxPages int `mapstructure:"max_pages"`
Concurrency int `mapstructure:"concurrency"`
RatePerSecond float64 `mapstructure:"rate_per_second"`
UserAgent string `mapstructure:"user_agent"`
// UserAgents is an optional pool of User-Agent strings rotated across requests; it
// supersedes UserAgent when set. UserAgentRotation is off, round-robin, or random.
UserAgents []string `mapstructure:"user_agents"`
UserAgentRotation string `mapstructure:"user_agent_rotation"`
// Proxy is a single proxy URL; Proxies is a pool to rotate across (Proxy, if set, is
// prepended to the pool). ProxyRotation is off, round-robin, random, or sticky-host.
Proxy string `mapstructure:"proxy"`
Proxies []string `mapstructure:"proxies"`
ProxyRotation string `mapstructure:"proxy_rotation"`
Timeout time.Duration `mapstructure:"timeout"`
MaxBodyBytes int64 `mapstructure:"max_body_bytes"`
RespectRobots bool `mapstructure:"respect_robots"`
AllowSubdomains bool `mapstructure:"allow_subdomains"`
FollowExternal bool `mapstructure:"follow_external"`
FollowNofollow bool `mapstructure:"follow_nofollow"`
StripQuery bool `mapstructure:"strip_query"`
Verbose bool `mapstructure:"verbose"`
AdaptiveDelay bool `mapstructure:"adaptive_delay"`
Include []string `mapstructure:"include"`
Exclude []string `mapstructure:"exclude"`
}
CrawlConfig controls crawl scope and politeness.
type OutputConfig ¶
type OutputConfig struct {
Format string `mapstructure:"format"`
Path string `mapstructure:"path"`
// SitemapPath, when set, writes a standard sitemap.xml of the crawled pages to that path as
// a side output (independent of Format). The crawled site is also always rendered as a "Site
// map" tab in the HTML report.
SitemapPath string `mapstructure:"sitemap_path"`
}
OutputConfig controls report output.
Click to show internal directories.
Click to hide internal directories.