Documentation ¶
Index ¶
- func ColorizeOutput(enabled bool) func(*Printer)
- func CrawlerForSites(crawler Crawler) func(*Report)
- func DecodeOutput(enabled bool) func(*Printer)
- func HideError(disabled bool) func(*Printer)
- func HideRedirect(disabled bool) func(*Printer)
- func NewReadableEventBus(size int) chan event
- func NoCookie() func(*colly.Collector)
- func NoRedirect() func(*colly.Collector)
- func OnError(bus EventBus) func(*colly.Collector)
- func OnHTML(base *url.URL, bus EventBus) func(*colly.Collector)
- func OnRequest() func(*colly.Collector)
- func OnResponse(bus EventBus) func(*colly.Collector)
- func OutputForPrinting(output io.Writer) func(*Printer)
- type Crawler
- type CrawlerConfig
- type CrawlerFunc
- type ErrorEvent
- type EventBus
- type Link
- type Page
- type Printer
- type ProblemEvent
- type Report
- type Reporter
- type ResponseEvent
- type Site
- type WalkEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorizeOutput ¶
ColorizeOutput sets the ink for the printer.
func CrawlerForSites ¶
CrawlerForSites sets the website crawler to a report builder.
func DecodeOutput ¶
DecodeOutput sets `net/url.PathUnescape` as a decoder.
func HideRedirect ¶
HideRedirect prevents URL's redirect output.
func NewReadableEventBus ¶
func NewReadableEventBus(size int) chan event
NewReadableEventBus returns read/write-channel of events.
func NoCookie ¶
func NoCookie() func(*colly.Collector)
NoCookie disables cookie for `github.com/gocolly/colly.Collector`.
func NoRedirect ¶
func NoRedirect() func(*colly.Collector)
NoRedirect disables redirects for `github.com/gocolly/colly.Collector`.
func OnError ¶
func OnError(bus EventBus) func(*colly.Collector)
OnError registers a callback by `github.com/gocolly/colly.Collector.OnError()`.
func OnRequest ¶
func OnRequest() func(*colly.Collector)
OnRequest registers a callback by `github.com/gocolly/colly.Collector.OnRequest()`.
func OnResponse ¶
func OnResponse(bus EventBus) func(*colly.Collector)
OnResponse registers a callback by `github.com/gocolly/colly.Collector.OnResponse()`.
func OutputForPrinting ¶
OutputForPrinting sets up printer output.
Types ¶
type Crawler ¶
type Crawler interface { // Visit starts to crawl a website starting with the passed URL. // All implementations must communicate with report builder // through the passed EventBus and close it when they're done. Visit(url string, bus EventBus) error }
Crawler defines general behavior of website crawlers.
func CrawlerColly ¶
func CrawlerColly(config CrawlerConfig) Crawler
CrawlerColly returns configured website crawler.
type CrawlerConfig ¶
CrawlerConfig holds a website crawler's configuration.
type CrawlerFunc ¶
CrawlerFunc adds possibility to use functions as a website crawler.
type ErrorEvent ¶
type ErrorEvent struct { StatusCode int Location string Redirect string Error error // contains filtered or unexported fields }
ErrorEvent contains a response' status code, its URL and an encountered error.
type EventBus ¶
type EventBus chan<- event
EventBus is a write-only channel to communicate between a website crawler and a report builder.
type Link ¶
type Link struct { Page *Page Internal bool StatusCode int Location string Redirect string Error error }
Link contains meta information about a web link.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer represents a printer.
func NewPrinter ¶
NewPrinter returns configured printer instance.
type ProblemEvent ¶
type ProblemEvent struct { Message string Context interface{} // contains filtered or unexported fields }
ProblemEvent contains information about unexpected error.
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
Report represents a report builder.
type Reporter ¶
type Reporter interface {
Sites() <-chan Site
}
Reporter defines general behavior of report providers.
type ResponseEvent ¶
type ResponseEvent struct { StatusCode int Location string // contains filtered or unexported fields }
ResponseEvent contains a response' status code and its URL.