Skip to content

memclutter/proxycheck

Repository files navigation

proxycheck

Proxy list checker for Go — feed it a list of ip:port proxies and it reports which are alive, which protocols (http, https, socks4, socks5) each supports, and how fast each responds.

Release Go Reference Go Report Card Go version CI golangci-lint codecov License: MIT

proxycheck validates raw proxy lists. Each proxy is tested by routing a request to an external proxy judge through it: if the judge answers HTTP 200, the proxy is considered to work for that protocol. The tool tries all four protocols per address and reports the ones that succeed, together with a response-speed figure.

It ships two ways:

  • a CLI binary (proxycheck) that reads proxies from arguments or stdin and prints the working ones, and
  • an importable Go package (github.com/memclutter/proxycheck) exposing the Check function and the Feed / Judge interfaces for use in other programs.

Contents

Install

Build the binary from source (Go 1.18+):

go install github.com/memclutter/proxycheck/cmd@latest

or clone and build locally:

git clone https://github.com/memclutter/proxycheck.git
cd proxycheck
go build -o proxycheck ./cmd

CLI usage

Pass proxies as arguments:

proxycheck 108.20.30.1:8080 89.33.123.100:3128

or pipe a list (one ip:port per line, blank lines ignored) on stdin:

cat proxies.txt | proxycheck --threads 50
Flag Default Description
--threads 10 Number of proxies checked concurrently.
--judge proxyjudge.us Proxy judge name (see How it works).

An address may be a bare ip, in which case port 80 is assumed.

Output format

Working proxies are written to stdout, one per line, tab-separated:

<addr>\t<protocols>\t<speed>
  • <protocols> — a comma-separated subset of http,https,socks4,socks5.
  • <speed> — a Go duration string, e.g. 412ms.

Proxies that fail every protocol are reported on stderr and are absent from stdout, so you can pipe the clean list onward while still seeing failures:

cat proxies.txt | proxycheck > working.tsv 2> failures.log

Library usage

package main

import (
	"fmt"

	"github.com/memclutter/proxycheck"
)

func main() {
	res := proxycheck.Check("108.20.30.1:8080", proxycheck.AZEnvPhpJudge{})
	if res.Online {
		fmt.Printf("online via %v in %s\n", res.Protocols, res.Speed)
	} else {
		fmt.Printf("offline: %v\n", res.Err)
	}
}

The package also exports the Feed interface (SliceFeed, FileFeed) for streaming proxy sources, the Judge interface with the shipped judges and the Judges registry, and ProxyRequest for a single timed request through a proxy.

How it works

A judge is an external endpoint that echoes request details; reaching it through a proxy proves the proxy forwards traffic. Two judges ship:

Name Target URL Timeout
azenv.php http://www.wfuchs.de/azenv.php 3s
proxyjudge.us http://proxyjudge.us/ 1s

For each proxy, Check tries http, https, socks4, and socks5 in turn (HTTP/HTTPS via Go's proxy transport, SOCKS via h12.io/socks). A protocol counts as working only when the request completes with an HTTP 200. The proxy is "online" if at least one protocol succeeds.

Contributing

Contributions are welcome — see CONTRIBUTING.md for setup, coding conventions, and the commit/PR process. Changes are recorded in CHANGELOG.md.

License

Released under the MIT License.

About

Fast concurrent proxy checker for HTTP, HTTPS, SOCKS4 and SOCKS5 — a Go CLI and library that validates proxy lists against proxy judges and reports working proxies with speed.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors

Languages