gotcpproxy

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

GoTCPproxy

TCP over TLS Proxy in Go

Generate certificates

for i in {1..3}; do
    openssl genpkey -algorithm ed25519 -out $i.key
    openssl req -new -x509 -sha256 -key $i.key -out $i.crt -days 3650 -subj '/CN=localhost' -addext 'subjectAltName=DNS:localhost,IP:127.0.0.1'
done

Build

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" .
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags "-s -w" .
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags "-s -w" .

Install

go install github.com/fffaraz/gotcpproxy@latest

Use case 1

client <--(plain)--> GoTCPproxy (local) <----(TLS)----> GoTCPproxy (remote) <--(plain)--> target

./gotcpproxy.exe -local-port 8080 -remote-addr 127.0.0.1:8081 -local-crt cert/1.crt -local-key cert/1.key -remote-crt cert/2.crt -remote-tls
./gotcpproxy.exe -local-port 8081 -remote-addr 192.168.1.2:22 -local-crt cert/2.crt -local-key cert/2.key -peer-crt cert/1.crt -local-tls

Use case 2

client <--(plain)--> GoTCPproxy (local) <----(TLS)----> GoTCPproxy (middle) <----(TLS)----> GoTCPproxy (remote) <--(plain)--> target

./gotcpproxy.exe -local-port 8080 -remote-addr 127.0.0.1:8081 -local-crt cert/1.crt -local-key cert/1.key -remote-crt cert/2.crt -remote-tls
./gotcpproxy.exe -local-port 8081 -remote-addr 127.0.0.1:8082
./gotcpproxy.exe -local-port 8082 -remote-addr 192.168.1.2:22 -local-crt cert/2.crt -local-key cert/2.key -peer-crt cert/1.crt -local-tls

Use case 3

client <--(plain)--> GoTCPproxy (local) <----(TLS)----> GoTCPproxy (middle) <----(TLS)----> GoTCPproxy (remote) <--(plain)--> target

./gotcpproxy.exe -local-port 8080 -remote-addr 127.0.0.1:8081 -local-crt cert/1.crt -local-key cert/1.key -remote-crt cert/2.crt -remote-tls
./gotcpproxy.exe -local-port 8081 -remote-addr 127.0.0.1:8082 -local-crt cert/2.crt -local-key cert/2.key -peer-crt cert/1.crt -remote-crt cert/3.crt -local-tls -remote-tls
./gotcpproxy.exe -local-port 8082 -remote-addr 192.168.1.2:22 -local-crt cert/3.crt -local-key cert/3.key -peer-crt cert/2.crt -local-tls

Use case 4

client <--(plain)--> GoTCPproxy (logger) <--(plain)--> target

./gotcpproxy.exe -local-port 8080 -remote-addr 192.168.1.2:22 -log-data

Use case 5

client <--(plain)--> GoTCPproxy (local) <----(Zip)----> GoTCPproxy (remote) <--(plain)--> target

./gotcpproxy.exe -local-port 8080 -remote-addr 127.0.0.1:8081 -remote-zip
./gotcpproxy.exe -local-port 8081 -remote-addr 192.168.1.2:22 -local-zip

HTTP/SOCKS5 Proxy

docker run -it --rm -p "127.0.0.13128:3128" ginuerzh/gost:latest -L=":3128?whitelist=tcp:*:80,443&dns=1.1.1.2"

Docker compose

docker-compose -f docker-compose.client.yml up
docker-compose -f docker-compose.middle.yml up
docker-compose -f docker-compose.server.yml up

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL