This project provides a transparent proxy service that routes HTTP and SOCKS5 traffic through a 4G LTE modem (Huawei E3372). It exposes:
- An HTTP API (Axum) to list and reboot network interfaces backed by the modem.
- A SOCKS5 proxy server that binds outgoing connections to specific network interfaces via
SO_BINDTODEVICE. - Prometheus metrics for monitoring.
-
HTTP API (Axum) for device management:
GET /api/v1/devices— list available interfacesPOST /api/v1/devices/{id}/reboot— trigger modem reboot
-
SOCKS5 Proxy with username/password auth:
- Username:
modem - Password: interface ID (UUID)
- Tunnels traffic over the chosen cellular interface
- Username:
-
Interface discovery using
get_if_addrsand custom filter (enx*) -
Huawei E3372 integration via
modem_huaweie337module -
Graceful shutdown on Ctrl+C
-
Prometheus metrics via
jemallocmetrics loop
- Linux with Rust toolchain (>= 1.70)
- Root or CAP_NET_RAW capability for
SO_BINDTODEVICE - A Huawei E3372 LTE modem reachable at
http://<modem_ip>/api libcsupport forSO_BINDTODEVICE
| Flag | Env Var | Default | Description |
|---|---|---|---|
--ip |
IP |
127.0.0.1 |
Public IP label for logging |
--ip-modem-api |
IP_MODEM_API |
192.168.8.1 |
Modem API base URL |
--port-api |
PORT_API |
4444 |
HTTP API listening port |
--port-socks5 |
PORT_SOCKS5 |
7777 |
SOCKS5 proxy listening port |
--port-prometheus |
PORT_PROMETHEUS |
8888 |
Prometheus metrics port |
--prometheus-username |
PROMETHEUS_USERNAME |
"" |
Basic auth username for metrics |
--prometheus-password |
PROMETHEUS_PASSWORD |
"" |
Basic auth password for metrics |
--cluster |
CLUSTER |
ua-1 |
Cluster label for logs and metrics |
git clone https://github.com/your-org/proxymodem.git
cd proxymodem
cargo build --releaseNote: Root privileges are required to bind sockets to network interfaces.
sudo target/release/proxymodem \
--ip 0.0.0.0 \
--ip-modem-api 192.168.8.1 \
--port-api 4444 \
--port-socks5 7777 \
--port-prometheus 8888 \
--prometheus-username user \
--prometheus-password pass \
--cluster my-clusterYou should see logs indicating that API, SOCKS5, and metrics servers have started.
-
List devices:
curl http://localhost:4444/api/v1/devices
Response:
[ {"id": "<uuid>", "name": "enx0123456789ab", "ip": "10.3.47.231"}, ... ] -
Reboot device (modem):
curl -X POST http://localhost:4444/api/v1/devices/<uuid>/reboot
Response:
{"status": "success", "message": "Interface enx... restarted successfully"}
# Start the client using the built-in CLI:
curl --socks5-hostname localhost:7777 http://example.com-
Auth:
- Username:
modem - Password:
<uuid>(interface ID returned by HTTP API)
- Username:
Requests will be routed over the corresponding enx* interface.
Metrics are available at:
GET http://localhost:8888/metrics
Includes jemalloc allocator stats and internal proxy metrics.
-
Permission denied binding to interface:
- Ensure you run as root or grant
CAP_NET_RAW.
- Ensure you run as root or grant
-
No default route found:
- Check
/proc/net/routefor a line with00000000in the Destination column.
- Check
-
Modem API unreachable:
- Verify
--ip-modem-apiaddress and network connectivity to the modem.
- Verify
- Fork the repo
- Create a new feature branch
- Implement your changes
- Open a Pull Request
Generated by CellularProxy.com 4G LTE Modem Proxy
