ctfvisitor

package
v0.0.0-...-b515558 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CookieHandler

func CookieHandler(
	ctx context.Context, wd selenium.WebDriver,
	path string, cookies []*selenium.Cookie) error

VisitHandler is a generic wrapper around Get() that also installs cookies first before visiting the page

Types

type BrowserType

type BrowserType int
const (
	UNKNOWN BrowserType = iota
	CHROME
	FIREFOX
)

type Config

type Config struct {
	// SeleniumPath is the Selenium .jar.
	SeleniumPath string

	// QueueSize is the maximum number of handler events we can queue up at
	// once.
	QueueSize int

	Browser     BrowserType
	BrowserPath string

	MinPort int
	MaxPort int
}

type Dispatch

type Dispatch struct {
	MinPort int
	MaxPort int
	// contains filtered or unexported fields
}

func Init

func Init(c *Config) (*Dispatch, error)

func InitWithWC

func InitWithWC(c *Config, wc *WorkerConfig) (*Dispatch, error)

func (*Dispatch) LoopWithRestart

func (d *Dispatch) LoopWithRestart(ctx context.Context, workerCount int)

LoopWithRestart maintains a constant worker pool of `workerCount` workers.

func (*Dispatch) Queue

func (d *Dispatch) Queue(s *Site) error

type Handler

type Handler func(ctx context.Context, wd selenium.WebDriver) error

type Site

type Site struct {
	Path    string
	Cookies []*selenium.Cookie
}

type Worker

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

func InitWorker

func InitWorker(wc *WorkerConfig, id int, port int) (*Worker, func(), error)

func (*Worker) Cleanup

func (w *Worker) Cleanup(ctx context.Context) error

func (*Worker) Reset

func (w *Worker) Reset(ctx context.Context) error

func (*Worker) Run

func (w *Worker) Run(ctx context.Context, wq chan *Site) error

type WorkerConfig

type WorkerConfig struct {
	Port int
	// Dest must be a format string that includes Port.
	// ex: "http://localhost:%d/wd/hub"
	Dest string

	// SeleniumPath is the Selenium .jar.
	SeleniumPath string

	Caps        selenium.Capabilities
	ServiceOpts []selenium.ServiceOption
}

func DefaultWC

func DefaultWC(browser BrowserType, path string) *WorkerConfig

DefaultWC gives reasonable defaults as selenium configs per browser for a worker.

Jump to

Keyboard shortcuts

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