Complete Guide to ProxyCat: Building and Operating Tunnel Proxy Pools
⏱️ Estimated reading time: 15 minutes
Complete Guide to ProxyCat: Building and Operating Tunnel Proxy Pools
ProxyCat is an innovative tunnel proxy pool middleware that transforms short-term proxy IPs into fixed IPs for continuous use. This comprehensive guide covers everything from installation to advanced configuration and operational best practices.
What is ProxyCat?
ProxyCat is an open-source tunnel proxy pool middleware available on GitHub. It converts short-term proxy IPs (lasting 1-60 minutes) into fixed IPs, providing a cost-effective proxy solution for various use cases.
Key Features
- Multi-Protocol Support: HTTP/HTTPS/SOCKS5 protocol support
- Intelligent Proxy Management: Automatic proxy validation and switching
- Web UI Interface: Intuitive web management interface
- Docker Support: Easy container-based deployment
- Dynamic Configuration: Configuration changes without restart
System Requirements
Minimum Requirements
- OS: Linux (Ubuntu 18.04+), macOS, Windows
- Python: 3.7 or higher
- Memory: 512MB RAM
- Storage: 1GB free space
- Network: Stable internet connection
Recommended Specifications
- OS: Ubuntu 20.04 LTS
- Python: 3.9 or higher
- Memory: 2GB RAM
- Storage: 5GB SSD
- Network: 100Mbps or higher
Installation Methods
1. Git Clone and Dependency Installation
# Clone repository
git clone https://github.com/honmashironeko/ProxyCat.git
cd ProxyCat
# Create Python virtual environment (recommended)
python3 -m venv proxycat_env
source proxycat_env/bin/activate # Linux/macOS
# proxycat_env\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
2. Docker Installation (Recommended)
# Install using Docker Compose
git clone https://github.com/honmashironeko/ProxyCat.git
cd ProxyCat
docker-compose up -d
3. Configuration Setup
# Copy configuration file
cp config/config.ini.example config/config.ini
# Edit configuration file
nano config/config.ini
Basic Configuration
config.ini Configuration Example
[server]
# Server settings
host = 0.0.0.0
port = 8080
debug = false
[proxy]
# Proxy mode settings
mode = random # random, order, custom
timeout = 30
retry_count = 3
[auth]
# Authentication settings
enable_auth = false
username = admin
password = password123
[log]
# Log settings
level = INFO
file = logs/proxycat.log
Web UI Usage
1. Web Interface Access
After installation, access the web interface at:
http://localhost:8080
2. Key Features
- Proxy Status Monitoring: Real-time proxy status checking
- Configuration Changes: Modify settings through web interface
- Log Viewing: Real-time log monitoring
- Statistics Information: Traffic and performance statistics
Advanced Configuration
1. Proxy Pool Configuration
# Proxy pool configuration example
proxy_pool = [
{
"type": "http",
"host": "proxy1.example.com",
"port": 8080,
"username": "user1",
"password": "pass1"
},
{
"type": "socks5",
"host": "proxy2.example.com",
"port": 1080,
"username": "user2",
"password": "pass2"
}
]
2. Automatic Proxy Switching Configuration
[advanced]
# Advanced settings
auto_switch = true
switch_interval = 300 # Switch every 5 minutes
health_check_interval = 60 # Health check every minute
max_failures = 3 # Maximum failure count
3. Security Configuration
[security]
# Security settings
whitelist_enabled = true
whitelist_ips = 192.168.1.0/24,10.0.0.0/8
blacklist_enabled = true
blacklist_ips = 192.168.1.100
rate_limit = 1000 # Requests per minute limit
Production Operations Guide
1. Monitoring Setup
# System resource monitoring
htop
iostat -x 1
netstat -tulpn | grep :8080
2. Log Analysis
# Real-time log monitoring
tail -f logs/proxycat.log
# Error log filtering
grep "ERROR" logs/proxycat.log
# Performance statistics
grep "STATS" logs/proxycat.log | tail -100
3. Backup and Recovery
# Configuration backup
cp -r config/ backup/config_$(date +%Y%m%d)/
cp -r logs/ backup/logs_$(date +%Y%m%d)/
# Database backup (if using database)
mysqldump -u root -p proxycat_db > backup/db_$(date +%Y%m%d).sql
Performance Optimization
1. System Tuning
# Increase network buffer size
echo 'net.core.rmem_max = 16777216' >> /etc/sysctl.conf
echo 'net.core.wmem_max = 16777216' >> /etc/sysctl.conf
sysctl -p
# Increase file descriptor limit
echo '* soft nofile 65536' >> /etc/security/limits.conf
echo '* hard nofile 65536' >> /etc/security/limits.conf
2. Proxy Pool Optimization
# Proxy pool size optimization
OPTIMAL_POOL_SIZE = 10 # Adjust based on concurrent users
HEALTH_CHECK_INTERVAL = 30 # Health check interval
CONNECTION_TIMEOUT = 10 # Connection timeout
Troubleshooting
1. Common Issues
Issue: Proxy connection failure
# Solution
# 1. Check proxy server status
curl -x http://proxy:port http://httpbin.org/ip
# 2. Check firewall settings
sudo ufw status
sudo iptables -L
Issue: Web UI inaccessible
# Solution
# 1. Check port status
netstat -tulpn | grep :8080
# 2. Restart service
docker-compose restart
2. Log Analysis
# Check detailed logs
grep -E "(ERROR|WARNING|CRITICAL)" logs/proxycat.log
# Diagnose performance issues
grep "slow" logs/proxycat.log
grep "timeout" logs/proxycat.log
Security Considerations
1. Network Security
# Firewall configuration
sudo ufw enable
sudo ufw allow 22/tcp # SSH
sudo ufw allow 8080/tcp # ProxyCat web UI
sudo ufw deny 8080/tcp from 0.0.0.0/0 # Block external access
2. Authentication Hardening
[auth]
enable_auth = true
username = secure_admin
password = complex_password_123!
session_timeout = 3600
max_login_attempts = 3
Monitoring and Alerting
1. Prometheus Metrics Collection
# prometheus.yml configuration example
scrape_configs:
- job_name: 'proxycat'
static_configs:
- targets: ['localhost:8080']
metrics_path: '/metrics'
scrape_interval: 30s
2. Grafana Dashboard
{
"dashboard": {
"title": "ProxyCat Monitoring",
"panels": [
{
"title": "Active Proxies",
"type": "stat",
"targets": [
{
"expr": "proxycat_active_proxies"
}
]
}
]
}
}
Best Practices
1. Proxy Selection Strategy
# Intelligent proxy selection
def select_proxy(proxy_pool, request_type):
if request_type == "high_bandwidth":
return select_fastest_proxy(proxy_pool)
elif request_type == "stealth":
return select_least_used_proxy(proxy_pool)
else:
return select_random_proxy(proxy_pool)
2. Load Balancing
[load_balancing]
# Load balancing configuration
strategy = round_robin # round_robin, weighted, least_connections
health_check_interval = 30
failover_threshold = 3
3. Rate Limiting
[rate_limiting]
# Rate limiting configuration
requests_per_minute = 1000
burst_limit = 200
per_ip_limit = 100
Conclusion
ProxyCat provides a cost-effective and flexible proxy pool solution. This guide has covered everything from basic installation to advanced operations.
Key Points
- Cost Efficiency: Use short-term proxies as fixed IPs
- Flexibility: Multiple protocols and configuration options
- Scalability: Easy scaling with Docker
- Monitoring: Real-time status checking and management
Next Steps
- Refer to ProxyCat official documentation
- Share advanced use cases in community forums
- Implement performance monitoring tools
- Establish and apply security policies
Build a stable and efficient proxy infrastructure using ProxyCat!
References: