luanshaotong / proxy

A simple golang tcp proxy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kahlys/proxy

godoc build go report

Simple tcp proxy package and executable binary in Golang.

⚠️ This code is for test purpose, it is sometimes ugly, it is not production ready, and the API will probably change. ⚠️

Installation

With a correctly configured Go toolchain:

$ git clone github.com/kahlys/proxy/
$ cd proxy
$ go install cmd/tcpproxy/*.go

Example

The example executable provides both TCP and TCP/TLS connection: cmd/tcpproxy/main.go

By default, the proxy address is localhost:4444 and the target address is localhost:80.

$ tcpproxy
2018/12/13 17:10:25 Proxying from :4444 to :80

You can specify some options.

$ tcpproxy -help
Usage of tcpproxy:
  -lcert string
        certificate file for proxy server side
  -lhost string
        proxy local address (default ":4444")
  -lkey string
        key x509 file for proxy server side
  -ltls
        tls/ssl between client and proxy, you must set 'lcert' and 'lkey'
  -rcert string
        certificate file for proxy client side
  -rhost string
        proxy remote address (default ":80")
  -rkey string
        key x509 file for proxy client side
  -rtls
        tls/ssl between proxy and target, you must set 'rcert' and 'rkey'

About

A simple golang tcp proxy.

License:MIT License


Languages

Language:Go 77.0%Language:Shell 20.1%Language:Dockerfile 2.9%