gitmyhub

cow

Go ★ 8.4k updated 3y ago

HTTP proxy written in Go. COW can automatically identify blocked sites and use parent proxies to access.

A self-configuring HTTP proxy that automatically detects which websites are blocked in China and routes only those through a secondary proxy, leaving all other traffic to connect directly.

Gosetup: moderatecomplexity 3/5

COW, which stands for "Climb Over the Wall", is an HTTP proxy server written in Go. Its primary purpose is to help users in China access websites that are blocked by the country's internet filtering system. The key design goal is automation: COW tries to detect which sites are blocked on its own and routes only those through an external proxy, leaving other traffic to connect directly. This avoids slowing down access to sites that do not need to go through a proxy.

When COW encounters a site it has not seen before, it first attempts a direct connection. If that connection is reset or times out in ways that match known blocking behavior, COW automatically retries the request through a secondary proxy. It records which sites needed the proxy and which did not, and uses that history to skip the detection step on future visits to the same site. After two minutes it will quietly retry a direct connection to avoid locking a site into the proxy path when the block was temporary or misdetected.

COW supports several types of secondary proxies: SOCKS5, HTTP proxies, Shadowsocks (a popular protocol for circumventing censorship), and other COW instances running on a remote server. You can configure multiple secondary proxies and COW will spread requests across them. The tool also generates a PAC file, which is a small script that browsers can use to route only certain domains through the proxy and connect to everything else directly, improving speed.

Configuration is done through a plain text file. COW comes with built-in lists of sites known to be blocked and sites known to be accessible without a proxy in China, so most users do not need to maintain those lists manually. The program runs on macOS, Linux (including ARM devices), and Windows. The README is written in Chinese, with a link to a separate English README in the repository.

Where it fits