How disaina/workervless2sub works
This project—WorkerVless2sub—is a Cloudflare Workers–based subscription generator for VLESS nodes. Its primary purpose is to automatically generate subscription content (with support for different formats like Clash and Singbox) based on configurations provided via environment variables as well as data from external static files (plain text, CSV, and a socks5Data file).
Project Type and Purpose
• The project is a serverless application built on Cloudflare Workers (with an optional deployment via Cloudflare Pages) meant to generate and serve subscription content for VLESS nodes.
• The README clearly explains two deployment methods: one using Cloudflare Pages (which serves a static front-end) and another using Cloudflare Workers (for dynamic content generation), along with instructions on setting up environment variables for customizing the subscription output.
File Structure
• Key Files:
• LICENSE and README.md for documentation and legal info.
• _worker.js is the core Worker script that runs on Cloudflare Workers.
• Static data files: addressesapi.txt, addressesipv6api.txt, addressescsv.csv—these provide source data for IP addresses or node information.
• socks5Data file holds information for a SOCKS5 proxy pool.
• The minimal file tree indicates that the project is light and self-contained (no complex directory hierarchy), which is typical for serverless Workers that focus on processing HTTP requests and returning generated subscription content.
Main Architectural Components
• Client/User: An end user or client that makes HTTP requests (e.g., to the /auto or /sub endpoints) to generate customized subscription data.
• Cloudflare Worker: The _worker.js script acts as the dynamic backend logic. It reads query parameters (TOKEN, HOST, UUID, PATH, etc.) and integrates with external data sources.
• Environment Variables: They configure behavior (the subscription paths, addresses, API endpoints, etc.). They enable quick updates and customization without code changes.
• External Data Sources: These include URLs pointing to static text (addressesapi.txt), CSV files (addressescsv.csv), and additional files (socks5Data) that are fetched at runtime.
• Cloudflare Pages (Optional): When deployed via Pages, the solution may incorporate static site hosting for configuration or additional interfaces, with instructions provided in the README.
Relationships and Data Flow
• The Worker reads the environment variables and request parameters to determine which subscription to generate.
• Optionally, if there are integrations (for example, with a TG bot for notifications or a subscription conversion service), include those as additional nodes that interact with the Worker.
Architectural Patterns and Design Principles
• Serverless Architecture: Emphasize that the system is built around Cloudflare Workers (stateless functions) which offer scalability and low latency.
• Modular Data Sources: Highlight the external static files (from Github or other URLs) as plug-in data sources that update node lists dynamically.
• API Endpoint Abstraction: The Worker supports both quick and custom subscription generation endpoints. Represent endpoints with different labeled routes (e.g., /auto, /sub).
Relevant Technologies and Tools
• Cloudflare Workers and Cloudflare Pages.
• Standard HTTP/HTTPS for client requests and external data fetching.
• Possibly GitHub (as the repository host) and CDN (for the static files).
• Environment variables for dynamic behavior.
• The supported output formats (VLESS subscriptions for different clients, including Clash and Singbox).