mirror of
https://github.com/tcsenpai/oproxy.git
synced 2025-06-04 10:20:04 +00:00
OProxy
High-performance, transparent proxy that supports both TCP and UDP protocols.
A high-performance, transparent proxy that supports both TCP and UDP protocols.
NOTE: This proxy has been designed with local API proxy in mind. Specifically, I used it to forward Ollama API requests to the remote Ollama server for applications that try to connect to the local Ollama server on localhost.
Features
- Transparent TCP proxying
- HTTP/HTTPS proxying without decrypting the traffic
- Optional UDP support
- Detailed logging capabilities
- Configurable through environment variables
- Support for both file and stdout logging
- Data content logging (optional)
Requirements
- Python 3.7+
- python-dotenv
- socket
- threading
Installation
- Clone the repository:
git clone https://github.com/tcsenpai/oproxy.git
cd oproxy
- Install dependencies:
pip install -r requirements.txt
- Copy the example environment file:
cp .env.example .env
- Edit the .env file with your configuration:
PROXY_PORT=11434
TARGET_HOST=127.0.0.1
TARGET_PORT=80
Usage
Basic TCP proxy:
python src/main.py
Enable logging to file:
python src/main.py --log-file=proxy.log
Enable data logging with debug level:
python src/main.py --log-file proxy.log --log-data --log-level DEBUG
Enable UDP support:
python src/main.py --enable-udp
Command Line Arguments
--log-file
: Path to the log file--log-data
: Enable logging of data content--log-level
: Set logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)--enable-udp
: Enable UDP proxy alongside TCP
Notes
- TCP proxy runs on the port specified in .env
- UDP proxy (if enabled) runs on PROXY_PORT + 1
- Data logging should be used carefully as it may contain sensitive information
- UDP support is experimental and runs as a daemon thread
License
MIT License
Description
Languages
Python
100%