store

package
v0.0.0-...-e5f7078 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAddress

func CheckAddress(address *model.Address) bool

CheckAddress checks the address work or not.

func CheckProxyDB

func CheckProxyDB()

CheckProxyDB checks proxy addresses in DB.

func CountProxy

func CountProxy() int64

CountProxy returns the count of proxies in storage.

func RandomHTTPS

func RandomHTTPS() *model.Address

RandomHTTPS returns a random address based on https protocol.

func RandomOne

func RandomOne() *model.Address

RandomOne returns a random address in storage.

func SetCustomStore

func SetCustomStore(s Store)

SetCustomStore replaces the default store with s.

func ValidateProxy

func ValidateProxy(address *model.Address)

ValidateProxy checks addresses and decides whether to store.

Types

type Store

type Store interface {
	Set(address *model.Address) error
	Get(key string) (*model.Address, error)
	GetRandOne() (*model.Address, error)
	GetRandHTTPS() (*model.Address, error)
	GetAll() ([]*model.Address, error)
	Delete(key string) error
	Update(address *model.Address) error
	Count() (int64, error)
	Close() error
}

Store an object implementing Store interface can be registered with SetCustomStore to replace the default redis store.

Jump to

Keyboard shortcuts

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