52 lines
2.0 KiB
Markdown
52 lines
2.0 KiB
Markdown
---
|
|
inclusion: always
|
|
---
|
|
|
|
# Project Structure
|
|
|
|
## Root Directory Layout
|
|
|
|
```
|
|
├── fetch_proxies.py # Main Python script - core functionality
|
|
├── pr.sh # Shell script for manual API testing
|
|
├── .env # Environment variables (API keys)
|
|
├── user_info.txt # User account information
|
|
├── README.md # Project documentation
|
|
└── .gitignore # Git ignore rules
|
|
```
|
|
|
|
## Generated Output Files
|
|
|
|
```
|
|
├── proxies_raw.txt # Raw proxy format (host:port:user:pass)
|
|
├── proxies_http.txt # HTTP proxy URLs
|
|
├── proxies_socks5.txt # SOCKS5 proxy URLs
|
|
├── clash_config.yaml # Clash client configuration
|
|
├── singbox_config.json # SingBox client configuration
|
|
├── v2ray_config.json # V2Ray client configuration
|
|
└── v2ray_subscription.txt # Base64 encoded V2Ray subscription
|
|
```
|
|
|
|
## Code Organization
|
|
|
|
### Main Script (`fetch_proxies.py`)
|
|
- **API Functions**: `load_api_key()`, `get_download_token()`, `download_proxies()`
|
|
- **Parsing Functions**: `parse_proxies()`, `format_proxy_list()`
|
|
- **Output Functions**: `save_proxies()`, `save_*_config()` for each client type
|
|
- **Config Generators**: `generate_clash_config()`, `generate_singbox_config()`, `generate_v2ray_config()`
|
|
|
|
### Configuration Patterns
|
|
- All functions use UTF-8 encoding
|
|
- Error handling with descriptive Chinese messages
|
|
- Modular design - each client type has dedicated generator functions
|
|
- Consistent proxy data structure: `{'host', 'port', 'username', 'password'}`
|
|
|
|
## File Naming Conventions
|
|
- Snake_case for Python files and generated outputs
|
|
- Descriptive prefixes: `proxies_*` for proxy lists, `*_config.*` for client configs
|
|
- Standard extensions: `.py`, `.yaml`, `.json`, `.txt`, `.sh`
|
|
|
|
## Environment Management
|
|
- `.env` file for sensitive API keys
|
|
- Environment variables as fallback: `TOKEN` or `WEBSHARE_API_KEY`
|
|
- All sensitive data excluded from version control via `.gitignore` |