How cmliu/cf-workers-bpsub works
Purpose and deployment
This is a single Cloudflare Workers service that generates VLESS proxy subscriptions from upstream “BPSUB” node data. Its primary deployment artifact and request handler is _worker.js; wrangler.toml configures Worker deployment. The project runs on the Cloudflare Workers JavaScript runtime rather than a conventional server.
Request entry points
The Worker serves both a browser-oriented landing/configuration experience and API endpoints. Core documented routes are / for the UI, /sub for generated subscriptions, and /uuid.json for raw node data. Route dispatch, query parsing, response construction, and environment-variable access are centralized in _worker.js.
Paths: _worker.js, wrangler.toml
Subscription generation pipeline
A /sub request combines configured or query-supplied preferred IPs, proxy settings, SOCKS5 options, and node metadata into VLESS links. The response is selected or transformed based on client User-Agent, enabling base64/V2Ray-style output and client-specific forms such as Clash or SingBox.
Paths: _worker.js
Node and preferred-IP inputs
The Worker fetches or assembles source node information, exposes inspectable node data at /uuid.json, and parses preferred-address lists supplied through ips or the ADD environment variable. Preferred inputs can be literal host/port entries with labels or remote API URLs, establishing an external-fetch boundary before generated links are emitted.
Paths: _worker.js, snippet/ak.js, snippet/ca110us.js
Runtime configuration boundary
Cloudflare Worker environment variables provide deployment-specific behavior without source changes: upstream host(s), subscription conversion backend/configuration, default proxy IP, preferred addresses, subscription name, and node remark suffix. Request query parameters can override relevant defaults for an individual subscription request.
Paths: _worker.js, wrangler.toml
External services and transport behavior
The Worker depends on Cloudflare’s edge/CDN runtime and makes outbound requests to configured node hosts, optional preferred-IP APIs, and an optional subscription-conversion service (SUBAPI with SUBCONFIG). Generated VLESS configurations support TLS and multiple transport variants; protocol-specific implementations or embedded source fragments are represented by the snippet files.
Paths: _worker.js, snippet/gl.js, snippet/ca110us.js, snippet/t12.js
Alternate packaged proxy host
A separate proxy-host Worker artifact exists under proxy_host/, including source and a deployable ZIP. This appears to be an auxiliary proxy-host deployment boundary, distinct from the subscription-generator Worker, likely intended to provide or package proxy-host functionality used by generated configurations.
Paths: proxy_host/_worker.js, proxy_host/proxy_host.zip
Main entry points: _worker.js Subscription Worker · wrangler.toml Worker deployment config · gl.js Transport fragments · ak.js Preferred-IP fragments
Components 19
Subscription Worker
Cloudflare Worker deployment handling UI and subscription requests.
- Worker deployment config · Defines deployment-time Worker configuration.
wrangler.toml - Subscription Worker · Central request handler, routing, configuration, and response assembly.
_worker.js - Landing UI · Browser-oriented configuration experience.
_worker.js - Subscription endpoint · Builds client-targeted VLESS subscription output.
_worker.js - Raw node endpoint · Exposes inspectable source node data.
_worker.js - Runtime environment · Provides upstreams, proxy defaults, conversion settings, and naming values.
_worker.js - Query overrides · Overrides applicable deployment defaults per subscription request.
_worker.js - Node assembly · Fetches or assembles upstream BPSUB node metadata.
_worker.js - Preferred IP parser · Parses literal addresses and remote preferred-IP API sources.
_worker.js - VLESS link builder · Combines nodes, proxy options, SOCKS5 settings, and transport settings.
_worker.js - Client formatter · Selects base64, V2Ray, Clash, SingBox, or related output by User-Agent.
_worker.js
Input Sources
- Transport fragments · Embedded TLS and transport-variant implementation fragments.
snippet/gl.js - Preferred-IP fragments
snippet/ak.js
External Services
- Configured node hosts
- Preferred-IP APIs
- Subscription conversion service · Optional conversion backend configured with SUBCONFIG.
- Cloudflare edge runtime
Proxy Host Package
Separate auxiliary Worker deployment artifact.
- Proxy-host Worker · Separate proxy-host deployment source.
proxy_host/_worker.js - Proxy-host ZIP
proxy_host/proxy_host.zip
Connections 20
- Worker deployment config → Subscription Worker: deploys and configures
- Cloudflare edge runtime → Subscription Worker: executes
- Subscription Worker → Landing UI: serves
- Subscription Worker → Subscription endpoint: dispatches
- Subscription Worker → Raw node endpoint: dispatches
- Runtime environment → Subscription Worker: supplies defaults
- Query overrides → Subscription endpoint: overrides defaults
- Subscription endpoint → Node assembly: loads nodes
- Raw node endpoint → Node assembly: returns nodes from
- Configured node hosts → Node assembly: fetched from
- Subscription endpoint → Preferred IP parser: resolves addresses
- Preferred-IP APIs → Preferred IP parser: fetched from
- Preferred-IP fragments → Preferred IP parser: provides source data
- Node assembly → VLESS link builder: provides metadata
- Preferred IP parser → VLESS link builder: provides addresses
- Transport fragments → VLESS link builder: supports transports
- VLESS link builder → Client formatter: produces links
- Client formatter → Subscription conversion service: optionally converts through
- Client formatter → Subscription endpoint: returns formatted subscription
- Proxy-host Worker → Proxy-host ZIP: packaged as