What Data Sources Does CFnew Use for Subscription Generation?

CFnew aggregates proxy nodes for subscription generation from six configurable data sources—including manual IP lists, Cloudflare random IPs, remote URLs, and GitHub community lists—controlled via environment variables and KV store keys.

The byJoey/cfnew repository implements a Cloudflare Worker that dynamically assembles proxy subscriptions by merging multiple configurable data sources. Understanding these source mechanisms is essential for customizing node selection and optimizing connection performance across different network environments.

Manual Node Lists (KV Key yx)

The primary method for defining proxy nodes uses the yx KV key. As documented in [README.md](https://github.com/byJoey/cfnew/blob/main/README.md) (lines 152‑153), users enter a comma-separated list of IP:port#备注 strings directly into the web UI or KV store. The worker parses this string at runtime and converts each entry into a proxy node in the final subscription.


# Example KV value format

1.2.3.4:443#香港节点,5.6.7.8:8443#日本节点

Cloudflare Random IP Generation

When no manual list is provided, CFnew falls back to CF随机IP (Cloudflare random IPs). According to the source documentation (README lines 112‑114), this built-in mechanism generates random IP addresses from Cloudflare's own address ranges. This ensures the subscription always contains valid entry points even when custom configurations are absent.

Remote URL Endpoints (yxURL)

For dynamic node management, CFnew supports fetching lists from external sources via the yxURL environment variable. The worker performs an HTTP request to the specified URL, expects a plain-text response containing IP:port#备注 entries, and merges these with other active sources (README lines 152‑154).


# Environment configuration

yxURL=https://example.com/iplist.txt

GitHub Community Default List (egi)

The egi variable ( GitHub 默认优选) controls integration with the community-maintained repository byJoey/bestcfipas. When enabled (default: yes), CFnew automatically pulls a curated list of preferred IPs and incorporates them into the generated subscription (README lines 156‑158).

Disabling Auto-Selection (yxby)

Setting yxby=yes (关闭所有优选功能) disables all automatic selection mechanisms. When this flag is active, the subscription contains exclusively the manually supplied entries from the yx KV key, ignoring Cloudflare random IPs, remote URLs, and the GitHub default list (README lines 162‑164).

Region-Aware Filtering (epi and epd)

For performance optimization, CFnew implements region-based filtering through two toggle variables before finalizing the subscription:

  • epi (启用优选IP): Enables preferred IP selection
  • epd (启用优选域名): Enables preferred domain selection

When activated, the worker filters accumulated nodes by geographic region and latency metrics (README lines 155‑157). This logic executes after source aggregation but before format conversion to client-specific outputs such as Clash, Surge, or Sing-Box configurations.

Practical Configuration Examples

Combining Multiple Sources


# Environment variables or KV configuration

u=YOUR_UUID
yxURL=https://example.com/iplist.txt
yx=1.2.3.4:443#香港节点,5.6.7.8:8443#日本节点
epi=yes
egi=no

Strict Manual Mode Only


# Disable all auto-selection

yxby=yes
yx=8.8.8.8:53#GoogleDNS,1.1.1.1:443#CloudflareDNS

GitHub Default List Only

egi=yes
yxby=no
yx=""  # Empty manual list

Implementation Files

The subscription generation logic resides in the snippets/ directory, which contains the obfuscated JavaScript handling source merging, deduplication, and region filtering. Deployment configuration is managed in [wrangler.toml](https://github.com/byJoey/cfnew/blob/main/wrangler.toml), which defines the KV bindings and compatibility dates required for runtime data source lookups.

Summary

  • Six data sources: CFnew aggregates nodes from manual KV entries (yx), Cloudflare random IPs, remote URLs (yxURL), and GitHub community lists (egi), while supporting region filtering (epi/epd) and manual-only mode (yxby).
  • Environment-driven configuration: All sources are controlled via environment variables and KV keys read at runtime by the Worker.
  • Automatic deduplication: The worker merges active sources, removes duplicate entries, and converts the result to client-specific subscription formats.
  • Source documentation: Variable definitions are located in README.md (lines 112‑164), with implementation logic in snippets/ and deployment settings in wrangler.toml.

Frequently Asked Questions

How do I completely disable automatic IP generation in CFnew?

Set the yxby environment variable to yes. This disables Cloudflare random IPs, remote URL fetching, and the GitHub default list, restricting the subscription to only the IPs specified in the yx KV key (README lines 162‑164).

Can I combine multiple data sources in one subscription?

Yes. CFnew merges all enabled sources simultaneously. You can provide manual entries via yx, fetch additional nodes from yxURL, and enable the GitHub list via egi=yes at the same time. The worker automatically deduplicates entries before generating the final output.

What format does the remote URL (yxURL) need to return?

The endpoint must return plain text containing comma-separated or newline-separated entries in the format IP:port#备注 (e.g., 1.2.3.4:443#香港节点). The worker parses this response and merges it with other configured sources (README lines 152‑154).

Where is the subscription generation logic implemented?

The core logic resides in the snippets/ directory of the repository, containing the obfuscated JavaScript that handles source aggregation, region filtering (epi/epd), and format conversion. Configuration variables are documented in README.md and deployed via wrangler.toml.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →