validator

package
v0.0.0-...-87cf5a2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPClientWithProxy

func HTTPClientWithProxy(proxy string) *http.Client

HTTPClientWithProxy returns a new http.Client with the proxyURl it will desable keepalive

func RegisterValidateFunc

func RegisterValidateFunc(name string, validate ValidateFunc)

Types

type Queue

type Queue interface {
	// Enqueue enqueues a new unverified proxy addr
	Enqueue(addr string)
}

Queue ...

type ValidateFunc

type ValidateFunc func(addr string) error

type Validator

type Validator interface {
	// Validate enqueues a new unverified proxy addr, handle
	// it asynchronously
	Validate(add string)

	// Run starts the Validator
	Run()
	// Stop stops the Validator
	Stop()

	// generic validator for proxy
	// Get returns a validated proxy
	Get() *v2.Proxy
	// Add adds a validated proxy
	Add(*v2.Proxy)
	// Delete delete the proxy
	Delete(*v2.Proxy)
	// Count returns the counts of validated proxy
	Count() int
}

Validator ...

func New

func New(name string, validate func(add string)) Validator

New ...

type Validators

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

Validators ...

func NewValidators

func NewValidators() *Validators

func (*Validators) Delete

func (v *Validators) Delete(name string)

Delete deletes the value for a key.

func (*Validators) Enqueue

func (v *Validators) Enqueue(addr string)

func (*Validators) Load

func (v *Validators) Load(name string) (Validator, bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Validators) LoadOrStore

func (v *Validators) LoadOrStore(name string, vv Validator) (Validator, bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.

func (*Validators) Run

func (v *Validators) Run()

func (*Validators) Stop

func (v *Validators) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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