Skip to content

Commit 36a19bc

Browse files
committed
docs: update project documentation with recent architecture changes
Reflect the addition of Trojan protocol support, UDP handling, and updated file structure in the project guide. Update configuration options and request flow description to match current implementation.
1 parent e554cf3 commit 36a19bc

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

CLAUDE.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
EDtunnel is a Cloudflare Worker/Pages-based VLESS proxy tool that implements WebSocket transport protocol for tunneling traffic. It runs on Cloudflare's serverless infrastructure and provides a web-based proxy service with multi-protocol support.
7+
EDtunnel is a Cloudflare Worker/Pages-based proxy tool that implements WebSocket transport protocol for tunneling traffic. It runs on Cloudflare's serverless infrastructure and provides a web-based proxy service with multi-protocol support (VLESS and Trojan).
88

99
## Development Commands
1010

@@ -33,12 +33,17 @@ src/
3333
├── handlers/
3434
│ ├── main.js # Main request router
3535
│ ├── http.js # HTTP request handling
36-
│ └── websocket.js # WebSocket upgrade and VLESS processing
36+
│ └── websocket.js # WebSocket upgrade and protocol processing
3737
├── protocol/
3838
│ ├── vless.js # VLESS protocol parsing
39+
│ ├── trojan.js # Trojan protocol parsing
3940
│ └── dns.js # DNS query handling over UDP
4041
├── proxy/
4142
│ ├── tcp.js # TCP connection management
43+
│ ├── udp.js # UDP connection handling
44+
│ ├── udp-handler.js # UDP packet processing
45+
│ ├── http.js # HTTP proxy support
46+
│ ├── vless.js # VLESS proxy implementation
4247
│ ├── stream.js # Stream processing utilities
4348
│ └── socks5.js # SOCKS5 proxy client
4449
├── generators/
@@ -48,21 +53,24 @@ src/
4853
├── encoding.js # Base64 encoding/decoding
4954
├── validation.js # UUID validation
5055
├── parser.js # Configuration parsing
56+
├── crypto.js # Cryptographic utilities
57+
├── proxyResolver.js # Proxy address resolution
5158
└── websocket.js # WebSocket utilities
5259
```
5360

5461
### Production Files
5562

5663
- **`_worker.js`** - Obfuscated bundle for Cloudflare deployment
5764
- **`wrangler.toml`** - Cloudflare Worker configuration
65+
- **`dist/bundle.js`** - Non-obfuscated bundle (intermediate build)
5866

5967
### Request Flow
6068

6169
1. `src/index.js` → exports `fetch` handler
62-
2. `handlers/main.js` → routes by URL path (`/cf`, `/{uuid}`, `/sub/{uuid}`)
63-
3. `handlers/websocket.js` → WebSocket upgrade for VLESS tunneling
64-
4. `protocol/vless.js` → parse VLESS header, extract destination
65-
5. `proxy/tcp.js` or `proxy/socks5.js` → establish outbound connection
70+
2. `handlers/main.js` → routes by URL path (`/cf`, `/{uuid}`, `/sub/{uuid}`, `/trojan`)
71+
3. `handlers/websocket.js` → WebSocket upgrade for VLESS/Trojan tunneling
72+
4. `protocol/vless.js` or `protocol/trojan.js` → parse protocol header, extract destination
73+
5. `proxy/tcp.js`, `proxy/udp.js`, or `proxy/socks5.js` → establish outbound connection
6674

6775
## Configuration
6876

@@ -73,13 +81,19 @@ Environment variables (set in `wrangler.toml` or Cloudflare Dashboard):
7381
| `UUID` | User authentication (comma-separated for multiple) |
7482
| `PROXYIP` | Proxy server addresses (comma-separated, with optional port) |
7583
| `SOCKS5` | SOCKS5 proxy (`user:pass@host:port`) |
76-
| `SOCKS5_RELAY` | Enable SOCKS5 relay (`true`/`false`) |
84+
| `TROJAN_PASSWORD` | Trojan protocol password (optional, uses UUID if not set) |
7785

78-
URL query parameters can override: `proxyip`, `socks5`, `socks5_relay` (UUID cannot be overridden for security).
86+
URL query parameters can override: `proxyip`, `socks5` (UUID cannot be overridden for security).
7987

8088
## Key Implementation Details
8189

8290
- Uses Cloudflare's `cloudflare:sockets` for TCP connections
8391
- VLESS protocol version 0 with WebSocket transport
92+
- Trojan protocol support with SHA-224 password hashing
93+
- UDP support for DNS queries
8494
- Multi-proxy load balancing via random selection
8595
- Subscription formats: VLESS links, Clash YAML, Base64 encoded
96+
97+
## Testing
98+
99+
Test files are located in the `test/` directory. Run tests during development to verify changes.

0 commit comments

Comments
 (0)