Documentation
¶
Overview ¶
Package proxypool provides concurrent iteration over proxies stored one per line in a text file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode uint8
Mode specifies the iteration order used by a ProxyPool.
type ProxyPool ¶
type ProxyPool interface {
// Close releases resources held by the pool.
// Calls after the first return nil.
Close() error
// Next returns the next proxy.
// It reports false when the pool is closed, empty, or exhausted.
Next() (string, bool)
// NextBytes appends the next proxy to dst[:0] and returns the resulting slice.
// It reports false when the pool is closed, empty, or exhausted.
//
// If dst has sufficient capacity, the returned slice aliases dst and the
// call performs no allocation.
NextBytes(dst []byte) ([]byte, bool)
}
ProxyPool provides read-only iteration over proxies stored in a file. A ProxyPool is safe for concurrent use by multiple goroutines.
func New ¶
New opens path and returns a ProxyPool that reads one proxy per line.
Mode determines iteration order. If reuse is true, iteration begins another cycle after the final proxy. Otherwise, the pool remains exhausted.
ModeShuffled builds or reads a path+".idx" sidecar containing file offsets. [ProxyPool.Close] removes that sidecar.
Click to show internal directories.
Click to hide internal directories.