ginuerzh / gost

GO Simple Tunnel - a simple tunnel written in golang
MIT License
15.45k stars 2.42k forks source link

UDP over TCP configuration #855

Open barbuslex opened 1 year ago

barbuslex commented 1 year ago

Hi,

I need help to do this configuration : image

In my company the firewall block UDP protocol and use DPI to block any website. Shadowsocks works perfectly but on TCP only because outgoing UDP is blocked. So, I want create UDP over TCP tunnel to a remote machine.

ENTREPRISE-PC ---> UDP-TO-TCP --> REMOTE-INTERNET-MACHINE (Port 443)

Is it possible to do this ?

Thanks

ginuerzh commented 1 year ago

REMOTE-INTERNET-MACHINE:

gost -L relay+tls://:443

ENTREPRISE-PC:

gost -L socks5://:1080 -F relay+tls://IP:443
barbuslex commented 1 year ago

Thanks @ginuerzh but i have issue configured like this :

Entreprise-PC image

Remote-PC image

Firefox (on Entreprise-PC) image

ginuerzh commented 1 year ago

If you want to proxy HTTP and SOCKS5 traffic to the same service, you can run your client as below:

gost -L :1080 -F relay+tls://IP:443

then, the 1080 is both an HTTP and SOCKS5 proxy server.

barbuslex commented 1 year ago

@ginuerzh thanks :)

The proxy respond correctly but impossible to display a web page :S

REMOTE-PC

C:\Program Files\Gost>gost -L relay+tls://:443
2022/08/22 13:45:16 route.go:694: relay+tls://:443 on [::]:443
2022/08/22 13:46:02 relay.go:142: [relay] ENTREPRISE-IP:23096 - 192.168.1.102:443 : read tcp 192.168.1.102:443->ENTREPRISE-IP:23096: wsarecv: An existing connection was forcibly closed by the remote host.

ENTREPRISE-PC

C:\Program Files\Gost>gost.exe -L :8282 -F relay+tls://REMOTE-IP:443
2022/08/22 13:45:57 route.go:694: auto://:8282 on [::]:8282
2022/08/22 13:46:02 http.go:161: [http] 127.0.0.1:29570 -> auto://:8282 -> mozilla.cloudflare-dns.com:443
2022/08/22 13:46:02 http.go:161: [http] 127.0.0.1:29571 -> auto://:8282 -> mozilla.cloudflare-dns.com:443
2022/08/22 13:46:02 http.go:256: [route] 127.0.0.1:29570 -> auto://:8282 -> 1@relay+tls://REMOTE-IP:443 -> mozilla.cloudflare-dns.com:443
2022/08/22 13:46:02 http.go:256: [route] 127.0.0.1:29571 -> auto://:8282 -> 1@relay+tls://REMOTE-IP:443 -> mozilla.cloudflare-dns.com:443
2022/08/22 13:46:02 http.go:277: [http] 127.0.0.1:29571 -> 127.0.0.1:8282 : read tcp 10.218.10.200:29572->REMOTE-IP:443: wsarecv: Une connexion existante a dû être fermée par l’hôte distant.
2022/08/22 13:46:02 http.go:277: [http] 127.0.0.1:29570 -> 127.0.0.1:8282 : read tcp 10.218.10.200:29573->REMOTE-IP:443: wsarecv: Une connexion existante a dû être fermée par l’hôte distant.
pandvan commented 1 year ago

Looking into this as I'm trying to proxy a web service that uses Real-Time Media Flow Protocol (RTMFP) for media straming. Browser doesn't seem to send UDP datagrams to the configured proxy :disappointed:

janisblaus commented 12 months ago

@barbuslex did you managed to get this working?

barbuslex commented 12 months ago

@janisblaus not really...

MAkC8 commented 11 months ago

@barbuslex I used UDP-over-TCP based on this solution: client: gost -L tcp://:8811 -L udp://:8811 -F relay+ssh://<USER>:<PASS>@<SERVER_ADDR>:22

server: gost -L "relay+ssh://<USER>:<PASS>@<SERVER_ADDR>:22/:8811" -L "ss://AEAD_AES_128_GCM:<SS_PASS>@:8811" -L "ssu://AEAD_AES_128_GCM:<SS_PASS>@:8811"

Instead of socks I'm using Shadowsocks protocol (VPN) and route the connection through SSH.(Shadowsocks banned by Firewall), relay do the UDP-over-TCP. In the server relay send tcp to the SS and udp to the SSU (Use socks in server instead of SS and SSU)