worker

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	FilePath string
	Result   *JobResult
}

type JobResult

type JobResult struct {
	IsWhite    bool
	IsPass     bool
	Success    bool
	TimeCost   int64
	StatusCode int
	Err        string
}

type Output

type Output struct {
	Out string
	Err string
}

type Progress

type Progress interface {
	Add(n int) error
}

type Result

type Result struct {
	Total           int64 // total poc
	Error           int64
	Success         int64 // success poc
	SuccessTimeCost int64 // success success cost
	TN              int64
	FN              int64
	TP              int64
	FP              int64
	Job             *Job
}

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(
	addr string,
	isHttps bool,
	fileList []string,
	blockStatusCode int,
	options ...WorkerOption,
) *Worker

func (*Worker) Run

func (w *Worker) Run()

func (*Worker) Stop

func (w *Worker) Stop()

type WorkerOption

type WorkerOption func(*Worker)

func WithConcurrence

func WithConcurrence(c int) WorkerOption

func WithProgressBar

func WithProgressBar(pb Progress) WorkerOption

func WithReqHost

func WithReqHost(reqHost string) WorkerOption

func WithReqPerSession

func WithReqPerSession(reqPerSession bool) WorkerOption

func WithResultCh

func WithResultCh(ch chan *Result) WorkerOption

func WithTimeout

func WithTimeout(timeout int) WorkerOption

func WithUseEmbedFS

func WithUseEmbedFS(useEmbedFS bool) WorkerOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL