• Stars
    star
    163
  • Rank 231,141 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Transparent proxy servers for HTTP, HTTPS, DNS and TCP.

go-transproxy

Transparent proxy servers for HTTP, HTTPS, DNS and TCP. This repository is heavily under development.

Description

go-transproxy provides transparent proxy servers for HTTP, HTTPS, DNS and TCP with single binary. Nothing needs to setup many tools. Nothing needs to configure iptables. go-transproxy will start multiple proxy servers for these protocols. Futheremore, it will configure iptables automatically.

go-transproxy also provides two types of explicit proxy(not transparent proxy). One is a simple proxy delegating to upstream your proxy, another is for adding Proxy-Authorization header automatically.

Requirement

go-transproxy supports only Linux iptables.

Install

Binaly install

Download from Releases page.

Source install

Use Go 1.13 for the build.

make

Usage

Usage:

  transproxy [options]

Options:

  -disable-iptables
    	Disable automatic iptables configuration
  -dns-over-https-enabled
        Use DNS-over-HTTPS service as public DNS
  -dns-over-https-endpoint string
        DNS-over-HTTPS endpoint URL (default "https://dns.google.com/resolve")
  -dns-over-tcp-disabled
        Disable DNS-over-TCP for querying to public DNS
  -dns-proxy-listen [host]:port
        DNS Proxy listen address, as [host]:port (default ":3131")
  -dns-tcp
        DNS Listen on TCP (default true)
  -dns-udp
        DNS Listen on UDP (default true)
  -explicit-proxy-listen [host]:port
        Explicit Proxy listen address for HTTP/HTTPS, as [host]:port Note: This proxy doesn't use authentication info of the `http_proxy` and `https_proxy` environment variables (default ":3132")
  -explicit-proxy-only
        Boot Explicit Proxies only
  -explicit-proxy-with-auth-listen [host]:port
        Explicit Proxy with auth listen address for HTTP/HTTPS, as [host]:port Note: This proxy uses authentication info of the `http_proxy` and `https_proxy` environment variables (default ":3133")
  -http-proxy-listen [host]:port
        HTTP Proxy listen address, as [host]:port (default ":3129")
  -https-proxy-listen [host]:port
        HTTPS Proxy listen address, as [host]:port (default ":3130")
  -loglevel string
        Log level, one of: debug, info, warn, error, fatal, panic (default "info")
  -private-dns string
        Private DNS address for no_proxy targets (IP[:port])
  -public-dns string
        Public DNS address (IP[:port]) Note: Your proxy needs to support CONNECT method to the Public DNS port, and the public DNS needs to support TCP
  -tcp-proxy-dports port1,port2,...
        TCP Proxy dports, as port1,port2,... (default "22")
  -tcp-proxy-listen [host]:port
        TCP Proxy listen address, as [host]:port (default ":3128")

Proxy configuration is used from standard environment variables, http_proxy, https_proxy and no_proxy. Also you can use IP Address, CIDR, Suffix Domain Name in no_proxy.

Example

# Set your proxy environment
export http_proxy=http://foo:[email protected]:3128

# Set no_proxy if you need to access directly for internal
export no_proxy=example.org,192.168.0.0/24

# Start go-transproxy with admin privileges(sudo)
sudo -E transproxy -private-dns 192.168.0.100 -public-dns 8.8.8.8

For testing, using docker is easy way. Now, you can access to google from docker container with no proxy configuration as follows.

docker run --rm -it centos curl http://www.google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.co.jp/?gfe_rd=cr&amp;dcr=0&amp;ei=GCKtWbD0AaLEXuTmr7gK">here</A>.
</BODY></HTML>

If your proxy doesn't support CONNECT method to DNS port, it cannot resolve public domain name transparently. Fortunately, Google privides DNS-over-HTTPS service, so you can use this service as public DNS by adding -dns-over-https-enabled option instead of -public-dns option as below even if your proxy supports CONNECT method to 443 port only.

sudo -E transproxy -private-dns 192.168.0.100 -dns-over-https-enabled

If you can resolve all domains directly from local LAN, run command without dns related options as below. It disables DNS-Proxy.

sudo -E transproxy

If you need to use both public DNS and private DNS, and need to use public DNS directly, run command with -dns-over-tcp-disabled option as below. It suppresses to insert a iptables OUTPUT rule for DNS over TCP.

sudo -E transproxy -private-dns 192.168.0.100 -public-dns 172.16.0.1 -dns-over-tcp-disabled

If you want to use an application which access to internet using port 5000, run command with -tcp-proxy-dports option as below.

sudo -E transproxy -private-dns 192.168.0.100 -public-dns 8.8.8.8 -tcp-proxy-dports 22,5000

Current Limitation

  • HTTP proxy: Only works with HTTP host header.
  • HTTPS proxy: no_proxy only works with IP Address and CIDR if your https client doesn't support SNI.
  • TCP proxy: no_proxy only works with IP Address and CIDR.

Licence

Licensed under the MIT license.

Author

Hiroyuki Wada

More Repositories

1

keycloak-discord

Keycloak Identity Provider extension for Discord
Java
119
star
2

gin-react-boilerplate

JavaScript
38
star
3

keycloak-ecs-fargate

Shell
15
star
4

bitbucket-browser

Viewer for Atlassian Bitbucket (formerly Stash).
TypeScript
10
star
5

griddle-react-bootstrap

Bootstrap style for griddle-react
TypeScript
10
star
6

gitlab-ecs-cloudformation

Makefile
9
star
7

coredns-amazondns

Amazon DNS plugin for CoreDNS
Go
6
star
8

keycloak-light

Lightweight keycloak
Shell
5
star
9

gradle-samples

Groovy
5
star
10

typescript-library-boilerplate

A TypeScript Boilerplate for Libraries
TypeScript
5
star
11

go-transproxy-light

Transparent proxy servers for HTTP, HTTPS, SSH etc. (LIGHT VERSION).
Go
4
star
12

trac-multiselectlist-plugin

Python
4
star
13

struts-spring-example

Java
4
star
14

txgh-serverless

A serverless application that integrates Transifex with Github
JavaScript
3
star
15

mod_auth_openidc_rpmbuild_container

RPM build docker container for mod_auth_openidc
3
star
16

gitss

GitSS - Git Source Search
Go
3
star
17

nproxy

NPROXY
Go
3
star
18

alfresco-ext

Java
2
star
19

react-redux-typescript-boilerplate

The boilerplate for react / redux / typescript.
2
star
20

bitbucket-branch-author

An Atlassian Bitbucket(Stash) plugin to display branch author.
Java
2
star
21

s2-jbossas7

Java
2
star
22

Dockerfiles

Shell
1
star
23

simple-dashboard

Simple Dashboard
CSS
1
star
24

ant-tasks-ext

Java
1
star
25

dotfiles

My Dotfiles
Vim Script
1
star
26

sphinx4j

Java
1
star
27

maven

wadahiro's maven repository.
1
star
28

jackrabbit-copy-tool

The JCR copy tool for copy of repository.
Java
1
star
29

trac-revision-graph-plugin

Python
1
star
30

issue-note

TypeScript
1
star
31

trac-release-artifacts-plugin

Trac Plugin
JavaScript
1
star
32

mattermost-plugin-keycloak-ciba

Mattermost plugin to handle CIBA with keycloak
Go
1
star