Skip to content

Instantly share code, notes, and snippets.

@diyism
Last active May 7, 2022 11:29
Show Gist options
  • Save diyism/642ed3b0330f3224eb622c71daa9b1f5 to your computer and use it in GitHub Desktop.
Save diyism/642ed3b0330f3224eb622c71daa9b1f5 to your computer and use it in GitHub Desktop.
qv2ray gun over cloudflare gprc
#ssh into your vps
wget https://github.com/Qv2ray/gun/releases/download/0.2.1/gun-dedicated-linux-amd64
mv gun-dedicated-linux-amd64 gun
sudo install gun /usr/bin/
wget https://github.com/diyism/microsocks/releases/download/v1.0.3/microsocks
sudo install microsocks /usr/bin/
while true; do nohup /usr/bin/microsocks -i 127.0.0.1 -p 8081 >/dev/null 2>&1; sleep 1; done &
while true; do nohup /usr/bin/gun -mode server -local :8443 -remote 127.0.0.1:8081 -name <password> -cert cert.pem -key cert.key >/dev/null 2>&1; sleep 1; done &
#or share site key with caddy, cloudflair proxy 443, 8443(Plesk Panel SSL), 2083/2087/2096(Cpanel SSL), 2053(Kerberos remote login):
#gun -mode server -local :2096 -remote 127.0.0.1:8081 -name <password> -cert /root/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/mydomain.com/mydomain.com.crt -key /root/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/mydomain.com/mydomain.com.key
sudo iptables -I INPUT -p tcp -m tcp --dport 8443 -j ACCEPT
sudo iptables-save > /etc/iptables/rules.v4
#if oracle vps, need login "https://cloud.oracle.com/networking/vcns/vcn-.../subnet-.../Default Security List..." and add Ingress Rules: "No 0.0.0.0/0 TCP All 8443"
#login https://dash.cloudflare.com
#click "add a site" to add your domain name
#click "your domain/DNS" in left side menu
#click "edit" of your domain name "A" record, switch on "proxy status", click "save"
#click "your domain/SSL/TLS" in left side menu
#click "Flexible" to enable it
#click "your domain/Network" in left side menu
#click "gRPC" to allow gRPC connections to your origin server
exit
#exit your vps, now in your linux PC:
wget https://github.com/Qv2ray/gun/releases/download/0.2.1/gun-dedicated-linux-amd64
mv gun-dedicated-linux-amd64 gun
sudo install gun /usr/bin/
while true; do nohup /usr/bin/gun -mode client -local 127.0.0.1:8081 -remote yourdomain.com:8443 -name <password> >/dev/null 2>&1; sleep 1; done &
#test it:
time curl --socks5 127.0.0.1:8081 https://1.1.1.1 | head -n 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment