Documentation
¶
Index ¶
- func Canonicalize(rawURL string) (string, error)
- func DefaultExcludes() []*regexp.Regexp
- func MaybeGunzip(r io.ReadCloser, hdr http.Header, url string) (io.Reader, func() error, error)
- func ParseSitemap(r io.Reader, sourceURL string, onEntry func(SitemapEntry) error) error
- func SameHost(origin, candidate string) bool
- func SitemapURLs(host string) []string
- type Config
- type Crawler
- type SitemapEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Canonicalize ¶
Canonicalize returns the canonical form of rawURL:
- scheme + host lowercased
- default ports stripped (:80, :443)
- fragment removed
- query params sorted alphabetically; tracking params and utm_* stripped
- dot segments resolved
- single trailing slash removed from non-root paths
func DefaultExcludes ¶
DefaultExcludes are the patterns described in the schema.
func MaybeGunzip ¶
MaybeGunzip wraps r in a gzip.Reader if header says so or URL ends .gz.
func ParseSitemap ¶
ParseSitemap streams an XML sitemap or sitemap-index, yielding entries via callback. depth caps recursive sitemap-index processing. The reader is closed by the caller.
func SitemapURLs ¶
SitemapURLs returns the candidate sitemap URL paths to probe when robots.txt doesn't declare one. step 2.
Types ¶
type Config ¶
type Config struct {
Site string
Seeds []string
MaxPages int
MaxDepth int
Concurrency int
Rate float64
IgnoreRobots bool
RespectCanon bool
UserAgent string
Include []*regexp.Regexp
Exclude []*regexp.Regexp
HTTPTimeout time.Duration
ThinThreshold int
MaxRetries int
RetryBaseDelay time.Duration
RetryMaxDelay time.Duration
}
Config bundles the crawl-relevant settings derived from CLI flags.
Click to show internal directories.
Click to hide internal directories.