Documentation ¶
Overview ¶
Package worker provides the workers that do the actual loading & processing of pages.
Index ¶
- func Mangle(basename string) []string
- type HTMLWorker
- type PageWorker
- type Stoppable
- type Worker
- func (w *Worker) HandleTask(t *task.Task)
- func (w *Worker) KeepSpidering(code int) bool
- func (w *Worker) ResultForError(t *task.Task, resp *http.Response, err error) *results.Result
- func (w *Worker) ResultForResponse(t *task.Task, resp *http.Response) *results.Result
- func (w *Worker) Run()
- func (w *Worker) RunInBackground()
- func (w *Worker) SetPageWorker(pw PageWorker)
- func (w *Worker) Sleep()
- func (w *Worker) Stop()
- func (w *Worker) TryMangleTask(t *task.Task)
- func (w *Worker) TryTask(t *task.Task) int
- func (w *Worker) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTMLWorker ¶
type HTMLWorker struct {
// contains filtered or unexported fields
}
func NewHTMLWorker ¶
func NewHTMLWorker(adder workqueue.QueueAddFunc) *HTMLWorker
func (*HTMLWorker) Eligible ¶
func (*HTMLWorker) Eligible(resp *http.Response) bool
Check if this response can be handled by this worker
type PageWorker ¶
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Workers do the work of connecting to the server, issuing the request, and then optionally parsing the response. Normally a pool of several workers will be used due to network latency.
func NewWorker ¶
func NewWorker(settings *ss.ScanSettings, factory client.ClientFactory, src <-chan *task.Task, adder workqueue.QueueAddFunc, done workqueue.QueueDoneFunc, rchan chan<- *results.Result) *Worker
Construct a worker with given settings.
func StartWorkers ¶
func StartWorkers(settings *ss.ScanSettings, factory client.ClientFactory, src <-chan *task.Task, adder workqueue.QueueAddFunc, done workqueue.QueueDoneFunc, rchan chan<- *results.Result) []*Worker
Starts a batch of workers based on the relevant settings.
func (*Worker) HandleTask ¶
func (*Worker) KeepSpidering ¶
Should we keep spidering from this code?
func (*Worker) ResultForError ¶
func (*Worker) ResultForResponse ¶
func (*Worker) Run ¶
func (w *Worker) Run()
Run the worker, processing input from a channel until either signalled to stop or the input channel is closed.
func (*Worker) RunInBackground ¶
func (w *Worker) RunInBackground()
func (*Worker) SetPageWorker ¶
func (w *Worker) SetPageWorker(pw PageWorker)
func (*Worker) TryMangleTask ¶
Click to show internal directories.
Click to hide internal directories.