Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Addr is the listen and serve address for the server. Addr string // LogFile is the file location to store the servers http request logs. LogFile string // Version is the current version of the program. In releases this is set as the git tag via build ldflags. Version string )
View Source
var ( // Workers controls number of max goroutines at a time for checking proxies. Workers int // Timeout sets http request timeouts for proxy checks Timeout time.Duration // Progress determines if we use progress bar when checking proxies. Progress bool )
View Source
var ( DB *sql.DB DbPath string )
View Source
var (
DownloadTimeout time.Duration
)
View Source
var ( //FileLimitMax sets max open file descriptors value FileLimitMax int )
View Source
var ( // MaxmindFilePath is the path to maxmind country db file. Used to resolve the geolocation of proxies. MaxmindFilePath string )
Functions ¶
func CheckInit ¶
func CheckInit()
CheckInit checks all proxies from GormDB to see if they are transparent or anonymous and if they work.
func DownloadInit ¶
func DownloadInit()
DownloadInit initializes DownloadProxies and saves results to GormDB
func IncrFdLimit ¶
IncrFdLimit attempts to increase max file handles per process
Types ¶
type Model ¶
type Model struct { ID uint `json:"-" gorm:"primary_key"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Model gets embedded into Proxy
type Proxies ¶
type Proxies []*Proxy
Proxies is a slice of Proxy
func DownloadProxies ¶
func DownloadProxies() Proxies
DownloadProxies downloads proxies from providers.
type Proxy ¶
type Proxy struct { Model RespTime *string `json:"response_time"` CheckCount uint `json:"check_count" gorm:"default:0"` Country string `json:"country" ` FailCount uint `json:"fail_count" gorm:"default:0"` LastStatus string `json:"last_status"` Proxy string `json:"proxy" gorm:"type:varchar(100);unique_index"` TimeoutCount uint `json:"timeout_count" gorm:"default:0"` Source string `json:"source"` SuccessCount uint `json:"success_count" gorm:"default:0"` Anonymous bool `json:"anonymous"` LosingStreak uint `json:"-" gorm:"default:0"` Deleted bool `json:"-" gorm:"default:false"` Judge string `json:"-"` }
Proxy represents a proxy record and is used to create the table for our db.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.