sthp creates an HTTP proxy that tunnels traffic through a SOCKS5 backend (Tor, Shadowsocks, OpenSSH dynamic forwarding, or any custom SOCKS5). No more struggling with torsocks or LD_PRELOAD hacks — just point your apps to http://127.0.0.1:8080 and everything works.
git clone https://github.com/journalehsan/socks-to-http-proxy.git
cd socks-to-http-proxy
# User install (no sudo)
./scripts/install.sh
# System-wide install
sudo ./scripts/install.sh
The installer auto-detects your environment, builds the binary if needed, installs a systemd service, and adds handy set-proxy/unset-proxy helpers to your shell.
sthp -p 8080 -s 127.0.0.1:1080
This starts an HTTP proxy on 127.0.0.1:8080 forwarding to SOCKS5 at 127.0.0.1:1080 (Tor's default). Change IP/port as needed.
sthp --help
| Option | Description |
|---|---|
-p, --port | HTTP proxy listen port (default: 8080) |
--listen-ip | Bind address (default: 127.0.0.1) |
-s, --socks-address | SOCKS5 address (default: 127.0.0.1:1080) |
-u, --username | SOCKS5 auth username |
-P, --password | SOCKS5 auth password |
--allowed-domains | Comma-separated list of allowed domains (whitelist) |
--http-basic | HTTP Basic Auth "user:passwd" |
-d, --detached | Daemon mode (Unix only) |
127.0.0.1 (local only). Use --listen-ip 0.0.0.0 to expose to network (be careful).
# User service
systemctl --user start sthp
systemctl --user enable sthp
# System service
sudo systemctl start sthp
sudo systemctl enable sthp
Configuration file: /etc/sthprc (system) or ~/.config/sthprc (user) — edit HTTP_PORT and SOCKS_PORT.
set-proxy # exports http_proxy, https_proxy -> http://127.0.0.1:8080
unset-proxy # removes all proxy env vars
--socks-address flag uses SOCKS5h (remote DNS). No schema needed. Example: -s 192.168.1.10:9050
cargo build --release
./target/release/sthp -p 8080 -s 127.0.0.1:1080
sthp -s 127.0.0.1:9050 → set system HTTP proxy to localhost:8080.sthp -s 127.0.0.1:1080.ssh -D 1080 user@vps → sthp -s 127.0.0.1:1080 → HTTP proxy for all tools.sthp یک پروکسی HTTP میسازد که ترافیک را از طریق پروکسی SOCKS5 هدایت میکند (Tor، Shadowsocks، OpenSSH، و غیره). دیگر خبری از torsocks یا تداخل LD_PRELOAD نیست — کافی است برنامهها را به http://127.0.0.1:8080指向 کنید.
git clone https://github.com/journalehsan/socks-to-http-proxy.git
cd socks-to-http-proxy
# نصب برای کاربر (بدون sudo)
./scripts/install.sh
# نصب سیستمی (همه کاربران)
sudo ./scripts/install.sh
اسکریپت نصب بهطور خودکار محیط شما را تشخیص میدهد، باینری را میسازد، سرویس systemd نصب میکند و دستورات set-proxy/unset-proxy را به شل شما اضافه میکند.
sthp -p 8080 -s 127.0.0.1:1080
یک پروکسی HTTP روی 127.0.0.1:8080 ایجاد میکند که به SOCKS5 روی 127.0.0.1:1080 (پیشفرض Tor) متصل میشود.
sthp --help
| گزینه | توضیح |
|---|---|
-p, --port | پورت شنود HTTP (پیشفرض: 8080) |
--listen-ip | آدرس Bind (پیشفرض: 127.0.0.1) |
-s, --socks-address | آدرس SOCKS5 (پیشفرض: 127.0.0.1:1080) |
-u, --username | نام کاربری احراز هویت SOCKS5 |
-P, --password | رمز عبور SOCKS5 |
--allowed-domains | لیست دامنههای مجاز (جداشده با کاما) |
--http-basic | احراز هویت HTTP Basic به فرم "user:passwd" |
-d, --detached | اجرا در پسزمینه (فقط یونیکس) |
127.0.0.1 است (فقط لوکال). برای دسترسی از شبکه از --listen-ip 0.0.0.0 استفاده کنید.
# سرویس کاربر
systemctl --user start sthp
systemctl --user enable sthp
# سرویس سیستمی
sudo systemctl start sthp
sudo systemctl enable sthp
فایل تنظیمات: /etc/sthprc (سیستمی) یا ~/.config/sthprc (کاربر). متغیرهای HTTP_PORT و SOCKS_PORT را ویرایش کنید.
set-proxy # تنظیم http_proxy و https_proxy روی 127.0.0.1:8080
unset-proxy # پاک کردن تمام متغیرهای پروکسی
--socks-address از SOCKS5h استفاده میکند (DNS در سمت سرور). نیازی به http:// یا socks5:// نیست. مثال: -s 192.168.1.10:9050
cargo build --release
./target/release/sthp -p 8080 -s 127.0.0.1:1080
sthp -s 127.0.0.1:9050 → پروکسی HTTP سیستم را روی localhost:8080 تنظیم کنید.sthp -s 127.0.0.1:1080.ssh -D 1080 user@vps → sthp -s 127.0.0.1:1080 → تبدیل به پروکسی HTTP.