This commit is contained in:
WebShare Proxy Bot
2025-10-09 01:21:44 +00:00
parent fc791e1d61
commit 169196a372
17 changed files with 1306 additions and 0 deletions

28
.kiro/steering/product.md Normal file
View File

@@ -0,0 +1,28 @@
---
inclusion: always
---
# Product Overview
This is a proxy management tool that fetches proxy lists from Webshare API and generates configuration files for multiple proxy clients.
## Core Functionality
- Fetches SOCKS/HTTP proxies from Webshare.io API using download tokens
- Supports multiple output formats: raw, HTTP, SOCKS5
- Generates configuration files for popular proxy clients:
- Clash (YAML format)
- SingBox (JSON format)
- V2Ray (JSON config + Base64 subscription)
## Key Features
- Automatic API key management from `.env` file or environment variables
- Multiple authentication methods (username/password, IP auth)
- Country and location filtering support
- Automatic proxy health checking and failover configurations
- Chinese language support with UTF-8 encoding
## Target Users
Developers and users who need to manage proxy configurations across different clients and platforms, particularly those requiring access to geo-restricted content or enhanced privacy.

View File

@@ -0,0 +1,52 @@
---
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`

56
.kiro/steering/tech.md Normal file
View File

@@ -0,0 +1,56 @@
---
inclusion: always
---
# Technology Stack
## Language & Runtime
- **Python 3**: Main scripting language with UTF-8 encoding support
- **Bash**: Shell scripting for automation
## Dependencies
- `requests`: HTTP client for API calls
- `yaml`: YAML configuration file generation
- `json`: JSON configuration handling
- `base64`: Encoding for V2Ray subscriptions
- `os`: Environment variable and file system operations
## Configuration Formats
- **YAML**: Clash proxy client configurations
- **JSON**: SingBox and V2Ray configurations
- **Plain text**: Raw proxy lists in various formats
- **Base64**: V2Ray subscription links
## Common Commands
### Setup
```bash
# Install dependencies (if using pip)
pip install requests pyyaml
# Set up environment
echo "TOKEN=your_webshare_api_key" > .env
```
### Execution
```bash
# Run the main proxy fetcher
python3 fetch_proxies.py
# Quick API test (manual)
bash pr.sh
```
### Output Files Generated
- `proxies_raw.txt`: Raw format (host:port:username:password)
- `proxies_http.txt`: HTTP format URLs
- `proxies_socks5.txt`: SOCKS5 format URLs
- `clash_config.yaml`: Clash client configuration
- `singbox_config.json`: SingBox client configuration
- `v2ray_config.json`: V2Ray client configuration
- `v2ray_subscription.txt`: Base64 encoded subscription
## API Integration
- **Webshare.io API v2**: Primary proxy source
- Token-based authentication with download tokens
- RESTful endpoints for proxy list retrieval