180 lines
3.7 KiB
Markdown
180 lines
3.7 KiB
Markdown
# rproxy
|
|
|
|
A lightweight, configurable HTTP and SOCKS5 proxy server with ACL support, custom DNS resolution, and flexible routing capabilities.
|
|
|
|
## Features
|
|
|
|
- **Dual Protocol Support**: HTTP (CONNECT & standard) and SOCKS5 proxy
|
|
- **ACL-based Access Control**: Allow or deny requests based on domain patterns
|
|
- **Custom Outgoing IPs**: Route traffic through specific IPv4/IPv6 addresses
|
|
- **ACL-based Routing**: Route specific domains through different outgoing IPs
|
|
- **Custom DNS Resolution**: Use custom DNS servers instead of system defaults
|
|
- **Hosts File Support**: Override DNS with system hosts file entries
|
|
- **Flexible Logging**: Multiple log levels for debugging and monitoring
|
|
|
|
## Installation
|
|
|
|
### Docker (Recommended)
|
|
|
|
Using Docker Compose:
|
|
|
|
```bash
|
|
# Clone the repository
|
|
git clone https://git.rznet.fr/tchivert/rproxy.git
|
|
cd rproxy
|
|
|
|
# Edit rproxy.conf to suit your needs
|
|
vim rproxy.conf
|
|
|
|
# Start the proxy
|
|
docker compose up -d
|
|
```
|
|
|
|
### Binary
|
|
|
|
Download the latest binary for your platform from [releases](https://git.rznet.fr/tchivert/rproxy/releases):
|
|
|
|
```bash
|
|
# Download binary (example for Linux amd64)
|
|
wget https://git.rznet.fr/tchivert/rproxy/releases/download/latest/rproxy-linux-amd64
|
|
chmod +x rproxy-linux-amd64
|
|
mv rproxy-linux-amd64 /usr/local/bin/rproxy
|
|
|
|
# Create config directory
|
|
sudo mkdir -p /etc/rproxy
|
|
|
|
# Download example config
|
|
sudo wget -O /etc/rproxy/rproxy.conf https://git.rznet.fr/tchivert/rproxy/raw/branch/main/rproxy.conf
|
|
|
|
# Run the proxy
|
|
rproxy /etc/rproxy/rproxy.conf
|
|
```
|
|
|
|
## Configuration
|
|
|
|
The proxy is configured via a simple text file (default: `/etc/rproxy/rproxy.conf`).
|
|
|
|
### Basic Configuration
|
|
|
|
```conf
|
|
# Bind address (default: all interfaces)
|
|
# addr 0.0.0.0 # IPv4
|
|
# addr :: # IPv6
|
|
|
|
# Ports
|
|
http_port 3128
|
|
socks_port 1080
|
|
|
|
# Enable protocols (default: http only)
|
|
proto http socks # Enable both HTTP and SOCKS5
|
|
|
|
# Log level: 0=silent, 1=system, 2=warnings, 3=full
|
|
log_level 1
|
|
|
|
# Allow all requests
|
|
req_allow all
|
|
```
|
|
|
|
### Access Control Lists (ACLs)
|
|
|
|
Block or allow specific domains:
|
|
|
|
```conf
|
|
# Define ACL patterns (supports wildcards)
|
|
acl blocked badsite.com
|
|
acl blocked *.malware.com
|
|
|
|
# Deny requests matching ACL
|
|
req_deny blocked
|
|
|
|
# Allow everything else
|
|
req_allow all
|
|
```
|
|
|
|
### Custom Outgoing IP
|
|
|
|
Route traffic through specific network interfaces:
|
|
|
|
```conf
|
|
# Default outgoing IP for all traffic
|
|
net_out 192.168.1.100
|
|
|
|
# Or specify IPv6
|
|
net_out 2001:db8::1
|
|
```
|
|
|
|
### ACL-based Routing
|
|
|
|
Route specific domains through different IPs (useful for VPNs):
|
|
|
|
```conf
|
|
# Define ACL for VPN traffic
|
|
acl vpn iplk.fr
|
|
acl vpn *.streaming-service.com
|
|
|
|
# Route VPN ACL through specific IP
|
|
net_out 10.8.0.2 vpn
|
|
|
|
# IPv6 example
|
|
net_out 2001:db8::100 vpn
|
|
```
|
|
|
|
### Custom DNS
|
|
|
|
Use custom DNS servers instead of system defaults:
|
|
|
|
```conf
|
|
# Single or multiple DNS servers
|
|
dns_servers 1.1.1.1 9.9.9.9
|
|
|
|
# With custom ports
|
|
dns_servers 9.9.9.9:53 1.1.1.1:53
|
|
```
|
|
|
|
### System Hosts File
|
|
|
|
Use system `/etc/hosts` for DNS resolution:
|
|
|
|
```conf
|
|
system_hosts true
|
|
```
|
|
|
|
## Usage
|
|
|
|
### HTTP Proxy
|
|
|
|
Configure your application to use HTTP proxy:
|
|
|
|
```bash
|
|
# Test with curl
|
|
curl -x http://localhost:3128 https://iplk.fr
|
|
```
|
|
|
|
### SOCKS5 Proxy
|
|
|
|
Configure your application to use SOCKS5 proxy:
|
|
|
|
```bash
|
|
# Test with curl
|
|
curl --socks5 localhost:1080 https://iplk.fr
|
|
```
|
|
|
|
### Configuration File Location
|
|
|
|
By default, rproxy looks for `/etc/rproxy/rproxy.conf`. You can specify a different location:
|
|
|
|
```bash
|
|
rproxy /path/to/custom/config.conf
|
|
```
|
|
|
|
## Log Levels
|
|
|
|
- `0` - Silent (no logs)
|
|
- `1` - System (startup and errors only)
|
|
- `2` - Warnings (system + warnings)
|
|
- `3` - Full (all requests and connections)
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License. See the [LICENSE](https://git.rznet.fr/razian/rproxy/src/branch/main/LICENSE) file for more information.
|