v2ray-refiner

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

APACHE-2.0 License

Stars
18

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.

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

๐ŸŸก 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.

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

๐ŸŸ  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.

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.

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.
Badges
Extracted from project README
Version Download Stars
Related Projects