foxcloud

FoxCloud Architecture

This document describes the architecture of FoxCloud, a VLESS proxy server built for Cloudflare Workers.

Overview

FoxCloud is designed as a lightweight, high-performance proxy server that runs on Cloudflare’s edge network. It leverages Cloudflare Workers’ serverless architecture to provide global, low-latency access to proxy services.

System Components

1. Core Handler (src/core/handler.ts)

The main request handler that processes incoming HTTP requests and WebSocket upgrade requests:

2. Worker Entry Point (src/worker.ts)

The main entry point for the Cloudflare Worker:

3. Subscription Service (src/services/subscription.ts)

Generates VLESS configuration strings and objects:

4. Web Interface (src/pages/index.ts)

Provides HTML interfaces for:

5. Network Components

WebSocket Handler (src/network/websocket.ts)

TCP Utilities (src/network/tcp.ts)

DNS Utilities (src/network/dns.ts)

6. Utilities

Array Utilities (src/utils/array.ts)

Helper Functions (src/utils/helpers.ts)

Data Flow

  1. Incoming Request: Client sends HTTP request to Cloudflare Worker
  2. Request Routing: Core handler determines request type:
    • WebSocket upgrade request → WebSocket handler
    • /sub path → Subscription page
    • UUID path → VLESS configuration response
    • Other paths → Main index page
  3. WebSocket Connection: For proxy traffic:
    • Establishes WebSocket connection with client
    • Connects to configured proxy server
    • Transfers data bidirectionally
  4. Configuration Generation: For subscription requests:
    • Generates VLESS configuration based on environment variables
    • Returns configuration as URL or JSON

Environment Variables

The system uses two primary environment variables:

These variables are injected by Cloudflare Workers at runtime and are accessible through the Env interface.

Security Model

Scalability

Deployment Model

Limitations

Future Enhancements