This is fork project from https://github.com/ryanchapman/go-any-proxy, but add a few features.
transparent-proxy is a server that can transparently proxy any tcp connection through an upstream proxy server. This type of setup is common in corporate environments. It is written in golang and has been load tested with 10,000 concurrent connections successfully on a Vyatta running a 64-bit kernel.
For more info, see original post http://blog.rchapman.org/post/47406142744/transparently-proxying-http-and-https-connections
You can add basic authentication parameters if needed, like this:
any_proxy -l :3140 -p "MyLogin:[email protected]:8080"
You may need to run go get for library dependencies.
This project support docker and integrated iptables for container start/stop.
Additional features supported:
socks5 proxy type in advanced proxy routing (The port of socks5 proxy should not in list of proxy ports)Using the following command to start transparent proxy on host:
docker run -it --rm --privileged -e HTTP_PROXY=proxy.corporate.com:8080 -e NO_PROXY=192.176.0.1/8,172.10.0.1/8 -e LISTEN_PORT=3129 -e IPTABLE_MARK=2515 -e PROXY_PORTS=80,443,22 -e DNS_PORT=53 --net=host fengzhou/transparent-proxy
The options are important for run docker:
To enable advanced proxy routing, "-df" option for application, or "PROXY_CONFIG_FILE" environment for docker can be used.
Each proxy configuration can set proxy type with value: http or socks5. If no type defined, by default it is http proxy.
Here is sample configuration file.
---
proxy:
rules:
- 10.0.0.0/8
- 192.168.0.0/16
- '*.example.net'
---
proxy: proxy1.example.com:8080
rules:
- '172.168.1.0/16'
- '*.example.com'
- '*.example.*'
---
proxy: proxy2.example.com:8080
rules:
- '*.net'
proxy: proxy3.example.com:1080
type: socks5
rules:
- '*.io'
Each proxy routing is separated by ---. For proxy with empty value, it is special rule for additional direct connect (no proxy).
For others, it will be tested from top to bottom and use if ip/ip-net/domain matching. If nothing matched, use default proxy in "HTTP_PROXY" environment.
To support the domain-based rule, the "DNS_PORT" should be explicitly enabled.
Content type
Image
Digest
Size
7 MB
Last updated
about 7 years ago
docker pull fengzhou/transparent-proxy