You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4 KiB

package prox5
import (
// Statistics is used to encapsulate various swampy stats
type Statistics struct {
// Valid4 is the amount of SOCKS4 proxies validated
Valid4 int
// Valid4a is the amount of SOCKS4a proxies validated
Valid4a int
// Valid5 is the amount of SOCKS5 proxies validated
Valid5 int
// ValidHTTP is the amount of HTTP proxies validated
ValidHTTP int
// Dispensed is a simple ticker to keep track of proxies dispensed via our getters
Dispensed int
// Stale is the amount of proxies that failed our stale policy upon dispensing
Stale int
// Checked is the amount of proxies we've checked.
Checked int
// birthday represents the time we started checking proxies with this pool
birthday time.Time
mu *sync.Mutex
func (stats *Statistics) dispense() {
func (stats *Statistics) stale() {
func (stats *Statistics) v4() {
func (stats *Statistics) v4a() {
func (stats *Statistics) v5() {
func (stats *Statistics) http() {
// GetTotalValidated retrieves our grand total validated proxy count.
func (s *Swamp) GetTotalValidated() int {
return s.Stats.Valid4a + s.Stats.Valid4 + s.Stats.Valid5 + s.Stats.ValidHTTP
// GetUptime returns the total lifetime duration of our pool.
func (stats *Statistics) GetUptime() time.Duration {
return time.Since(stats.birthday)