Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fffaraz/gotcpproxy
TCP over TLS Proxy in Go
https://github.com/fffaraz/gotcpproxy
go golang proxy socks5 tcp tls
Last synced: about 20 hours ago
JSON representation
TCP over TLS Proxy in Go
- Host: GitHub
- URL: https://github.com/fffaraz/gotcpproxy
- Owner: fffaraz
- License: apache-2.0
- Created: 2022-12-14T02:45:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-29T05:56:20.000Z (6 months ago)
- Last Synced: 2024-06-20T12:03:22.129Z (5 months ago)
- Topics: go, golang, proxy, socks5, tcp, tls
- Language: Go
- Homepage: https://hub.docker.com/r/fffaraz/gotcpproxy
- Size: 48.8 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
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
```