Skip to content

Use Cloudflare Workers to access your v2ray Vmess, Vless and Trojan configs through Websockets.

License

Notifications You must be signed in to change notification settings

Surfboardv2ray/v2ray-refiner

Repository files navigation

V2ray Refiner

Access your configs by handling websocket requests via Cloudflare.

English 🇬🇧 | 🇮🇷 فارسی

Version Download Stars

Introduction

🟢 In an environment where direct connection to v2ray configs is not available, this alternative way can route the traffic to the destination server via Cloudflare.

Prerequisites

  1. Login or Signup at https://dash.cloudflare.com and verify your email address.
  2. Head to Workers and Pages to create and name a worker.
  3. Click Edit Code code to enter the editing environment.

0

TLS Version (Cloudflare-registered domain with PROXY switched to ON)

html.jpg

🟡 This method only works if your v2ray panel has a domain registered on Cloudflare with a TLS certificate, and Cloudflare proxy status switch to ON.

🟡 In your VPS v2ray panel, create a config with these specifications:

  • Type: Vmess, Vless or Trojan
  • Transporation: Websocket (WS)
  • Security: TLS
  • Host: Cloudflare-registered TLS-Certified Domain/Subdomain
  • Port: 443

🟡 Get the latest version of the TLS V2ray Refiner Worker Script, copy and paste/upload the entire content to your Cloudflare worker and hit deploy. (Alternatively, you could copy the worker script from here)

🟡 Open the deployed version of the worker and enter the TLS config you created on your VPS, and hit Refine.

0

Non-TLS Version (No Cloudflare-registered domains, or domain with no TLS Certification)

html.jpg

🟠 This method only works if your v2ray panel is not bound to a Cloudflare-registered domain, or the domain doesn't have a TLS Certificate.

🟠 First create a hostname with Type A pointing to your server IPv4 address, in any free DNS websites like https://noip.com/

🟠 In your VPS v2ray panel, create a config with these specifications:

  • Type: Vmess, Vless or Trojan
  • Transporation: Websocket (WS)
  • Security: None
  • Host: Hostname pointing to your server's IP Address (If on Cloudflare, switch the PROXY to OFF)
  • Port: 80

🟠 Get the latest version of the Non-TLS V2ray Refiner Worker Script, copy and paste/upload the entire content to your Cloudflare worker and hit deploy. (Alternatively, you could copy the worker script from here)

🟠 Open the deployed version of the worker and enter the Non-TLS config you created on your VPS. Set the hostname to the one you created in step 2. Enter a clean Cloudflare IP address that works on your network, and finally, hit Refine Config.

0

Editing the Non-TLS Script

🟢 The default port is 80. If your VPS config uses another port, edit the port in the script over at const workerPort = 80 and url.port = 80 accordingly (You need to edit both).

Editing the TLS Script

🟢 Allowed ports are those of Cloudflare TLS (443, 8443, 2053, 2083, 2087, 2096), changeable under const allowedPorts.

Additional Notes

🟢 You could get Clean IPs via IRCF Space Repo, but it's recommended to use Scanners.

0

Acknowledgements

  • Handling Websockets snippet and the idea of Rewriting Configs UI tribute to Vfarid's v2ray-worker-merge.
  • Handling Non-TLS configs snippet tribute to GetAFreeNode.