pool

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoProxiesLeft = fmt.Errorf("no proxies left")

Functions

This section is empty.

Types

type ApiEntry added in v0.1.3

type ApiEntry struct {
	Proxy          pmux.Proxy
	FirstSeen      int64
	LastSeen       int64
	ReanimateAfter time.Time
	Ok             bool
	Speed          time.Duration
	Seen           int
	Timeouts       int
	Offered        int
	Reanimated     int
	Succeed        int
	HourOffered    [24]int
	HourSucceed    [24]int
	Country        string
	Provider       string
	ASN            uint16
}

type Card

type Card struct {
	Name  string
	Value any
}

TODO: think of rather type Facet struct { Name, Field string; Values []string }

type Pool

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

func NewPool

func NewPool(history *history.History, ipLookup ipinfo.IpInfoGetter) *Pool

func (*Pool) Add

func (pool *Pool) Add(ctx context.Context, proxy pmux.Proxy, speed time.Duration)

func (*Pool) HttpGet

func (pool *Pool) HttpGet(r *http.Request) (any, error)

func (*Pool) Len

func (pool *Pool) Len() (res int)

func (*Pool) MarshalBinary

func (pool *Pool) MarshalBinary() ([]byte, error)

func (*Pool) RandomFast

func (pool *Pool) RandomFast(ctx context.Context) context.Context

func (*Pool) Remove

func (pool *Pool) Remove(proxy pmux.Proxy) bool

func (*Pool) RoundTrip

func (pool *Pool) RoundTrip(req *http.Request) (res *http.Response, err error)

func (*Pool) Session

func (pool *Pool) Session(ctx context.Context, fn func(context.Context, httpClient) error) error

Session rotates a random proxy per entire fn(ctx, client) call

func (*Pool) Start

func (pool *Pool) Start(ctx app.Context)

func (*Pool) UnmarshalBinary

func (pool *Pool) UnmarshalBinary(data []byte) error

type PoolStats

type PoolStats struct {
	Total   int
	Cards   []Card
	Entries []ApiEntry
}

Jump to

Keyboard shortcuts

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