All Projects → sorz → Moproxy

sorz / Moproxy

Licence: mit
A transparent TCP to SOCKSv5/HTTP proxy on Linux written in Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Moproxy

Clash Rules
🦄️ 🎃 👻 Clash Premium 规则集(RULE-SET),兼容 ClashX Pro、Clash for Windows 客户端。
Stars: ✭ 706 (+460.32%)
Mutual labels:  proxy, shadowsocks
Shadowsocks Php
A php port of shadowsocks based on workerman. A socks5 proxy written in PHP.
Stars: ✭ 869 (+589.68%)
Mutual labels:  proxy, shadowsocks
Clashy
A GUI proxy client for Windows / Mac / Ubuntu Desktop based on Clash and Electron. Windows / Mac / Ubuntu 适用的Clash客户端.
Stars: ✭ 775 (+515.08%)
Mutual labels:  proxy, shadowsocks
Awesome Network Stuff
Resources about network security, including: Proxy/GFW/ReverseProxy/Tunnel/VPN/Tor/I2P, and MiTM/PortKnocking/NetworkSniff/NetworkAnalysis/etc。More than 1700 open source tools for now. Post incoming.
Stars: ✭ 578 (+358.73%)
Mutual labels:  proxy, shadowsocks
Shadowsocksx Ng R8
ShadowsocksX-NG-R for MacOS, ShadowsocksR
Stars: ✭ 1,066 (+746.03%)
Mutual labels:  proxy, shadowsocks
Blinksocks
A framework for building composable proxy protocol stack.
Stars: ✭ 587 (+365.87%)
Mutual labels:  proxy, shadowsocks
Cloak
A censorship circumvention tool to evade detection against state adversaries
Stars: ✭ 942 (+647.62%)
Mutual labels:  proxy, shadowsocks
Avege
Yet Another Redsocks Golang Fork
Stars: ✭ 486 (+285.71%)
Mutual labels:  proxy, shadowsocks
Shadowsocks Qt5
A cross-platform shadowsocks GUI client
Stars: ✭ 7,893 (+6164.29%)
Mutual labels:  proxy, shadowsocks
V2ray Core
A platform for building proxies to bypass network restrictions.
Stars: ✭ 13,438 (+10565.08%)
Mutual labels:  proxy, shadowsocks
Leaf
A lightweight and fast proxy utility tries to include any useful features.
Stars: ✭ 530 (+320.63%)
Mutual labels:  proxy, shadowsocks
Libqtshadowsocks
A lightweight and ultra-fast shadowsocks library written in C++14 with Qt framework
Stars: ✭ 1,455 (+1054.76%)
Mutual labels:  proxy, shadowsocks
Go Shadowsocks2
Experimental Shadowsocks in Go. Stable fork at https://github.com/shadowsocks/go-shadowsocks2
Stars: ✭ 530 (+320.63%)
Mutual labels:  proxy, shadowsocks
Python Proxy
HTTP/HTTP2/HTTP3/Socks4/Socks5/Shadowsocks/ShadowsocksR/SSH/Redirect/Pf TCP/UDP asynchronous tunnel proxy implemented in Python 3 asyncio.
Stars: ✭ 692 (+449.21%)
Mutual labels:  proxy, shadowsocks
Proxy admin free
Proxy是高性能全功能的http代理、https代理、socks5代理、内网穿透、内网穿透p2p、内网穿透代理、内网穿透反向代理、内网穿透服务器、Websocket代理、TCP代理、UDP代理、DNS代理、DNS加密代理,代理API认证,全能跨平台代理服务器。
Stars: ✭ 487 (+286.51%)
Mutual labels:  proxy, shadowsocks
Freess
免费ss账号 免费shadowsocks账号 免费v2ray账号 (长期更新)
Stars: ✭ 6,544 (+5093.65%)
Mutual labels:  proxy, shadowsocks
Fanqiang
翻墙-科学上网
Stars: ✭ 23,428 (+18493.65%)
Mutual labels:  proxy, shadowsocks
Dosvpn
🚀 极速、简单、开源的 VPN 访问外网学习先进科学技术的必备工具
Stars: ✭ 485 (+284.92%)
Mutual labels:  proxy, shadowsocks
New Pac
翻墙-科学上网、免费翻墙、免费科学上网、免费自由上网、fanqiang、翻墙梯子、免费软件/方法,一键翻墙浏览器,免费shadowsocks/ss/ssr/v2ray/goflyway账号/节点分享,vps一键搭建翻墙服务器脚本/教程,电脑、手机、iOS、安卓、windows、Mac、Linux、路由器翻墙
Stars: ✭ 31,869 (+25192.86%)
Mutual labels:  proxy, shadowsocks
Free proxy ss
分享来自互联网上免费的shadowsocks(SS)/ShadowsocksR(SSR)/V2ray(vmess)代理 每15分钟更新一次,每次各分享4个临时可用代理。 及时订阅、及时更新。
Stars: ✭ 72 (-42.86%)
Mutual labels:  proxy, shadowsocks

moproxy

A transparent TCP to SOCKSv5/HTTP proxy on Linux written in Rust.

Features:

  • Transparent TCP proxy with iptables -j REDIRECT or nft redirect to
  • Support multiple SOCKSv5/HTTP upstream proxy servers
  • SOCKS/HTTP-layer alive & latency probe
  • Prioritize upstream proxy servers according to latency
  • Full IPv6 support
  • Multiple listen ports, each for a subset of proxy servers
  • Remote DNS resolving for TLS with SNI (extract domain name from TLS handshaking)
  • Optional try-in-parallel for TLS (try multiple proxies and choose the one first response)
  • Optional status web page (latency, traffic, etc. w/ curl-friendly output)
  • Optional Graphite and Prometheus support (to build fancy dashboard with Grafana for example)
  • Customizable proxy selection algorithm with Lua script (see conf/simple_scroe.lua).
+-----+  TCP  +-----------+       SOCKSv5   +---------+
| App |------>| iptables  |    +----------->| Proxy 1 |--->
+-----+       +-----------+    |            +---------+
            redirect |         |
+-----+           to v         |      HTTP  +---------+
| App |       //=========\\    |   +------->| Proxy 2 |--->
+-----+       ||         ||----+   |        +---------+
   |          || MOPROXY ||--------+             :
   +--------->||         ||-----------···        :
   SOCKSv5    \\=========// choose one  |   +---------+
                                        +-->| Proxy N |--->
                                            +---------+

Usage

Print usage

moproxy --help

Examples

Assume there are three SOCKSv5 servers on localhost:2001, localhost:2002, and localhost:2003, and two HTTP proxy servers listen on localhost:3128 and 192.0.2.0:3128. Following commands forward all TCP connections that connect to 80 and 443 to these proxy servers.

moproxy --port 2080 --socks5 2001 2002 2003 --http 3128 192.0.2.0:3128

# redirect local-initiated connections
iptables -t nat -A OUTPUT -p tcp -m multiport --dports 80,443 -j REDIRECT --to-port 2080
# redirect connections initiated by other hosts (if you are router)
iptables -t nat -A PREROUTING -p tcp -m multiport --dports 80,443 -j REDIRECT --to-port 2080

# or the nft equivalent
nft add rule nat output tcp dport {80, 443} redirect to 2080
nft add rule nat prerouting tcp dport {80, 443} redirect to 2080

SOCKSv5 server is also launched alongs with transparent proxy on the same port:

http_proxy=socks5h://localhost:2080 curl ifconfig.co

Server list file

You may list all proxy servers in a text file to avoid messy CLI arguments.

[server-1]
address=127.0.0.1:2001 ;required
protocol=socks5 ;required

[server-2]
address=127.0.0.1:2002
protocol=http
test dns=127.0.0.53:53 ;use remote's local dns server to caculate delay
listen ports=8001

[server-3]
address=127.0.0.1:2003
protocol=http
; server-3 serves for port 8001 & 8002, while server-2 is only for
; port 8001. server-1 accepts connections coming from any ports specified
; by CLI argument --port.
listen ports=8001,8002

[backup]
address=127.0.0.1:2002
protocol=socks5
score base=5000 ;add 5k to pull away from preferred server.

Pass the file path to moproxy via --list argument.

Signal SIGHUP will trigger the program to reload the list.

Custom proxy selection

Proxy servers are sorted by their score, which is re-calculated after each round of alive/latency probing. Server with lower score is prioritized.

The current scoring algorithm is a kind of weighted moving average of latency with penalty for recent connection errors. This can be replaced with your own algorithm written in Lua. See conf/simple_score.lua for details.

Source/destination address–based proxy selection is not directly supported. One workaround is let moproxy bind multiple ports, delegates each port to different proxy servers with listen ports in your config, then doing address-based selection on your firewall.

Monitoring

Metrics (latency, traffic, number of connections, etc.) are useful for diagnosis and customing your own proxy selection. You can access these metrics with various methods, from a simple web page, curl, to specialized tools like Graphite or Prometheus.

--stats-bind [::1]:8080 turns on the internal stats page, via HTTP, on the given IP address and port number. It returns a HTML page for web browser, or a ASCII table for curl.

The stats page only provides current metrics and a few aggregations. Graphite (via --graphite) or Prometheus (via --stats-bind then \metrics) should be used if you want a full history.

Some examples of Prometheus query (Grafana variant):

Inbound bandwith:
rate(moproxy_proxy_server_bytes_rx_total[$__range])

Total outbound traffic:
sum(increase(moproxy_proxy_server_bytes_tx_total[$__range]))

No. of connection errors per minute:
sum(increase(moproxy_proxy_server_connections_error[1m]))

Average delay for each proxy server:
avg_over_time(moproxy_proxy_server_dns_delay_seconds[$__interval])

Install

You may download the binary executable file on releases page.

Arch Linux user can install it from AUR/moproxy.

Or compile it manually:

# Install Rust
curl https://sh.rustup.rs -sSf | sh

# Clone source code
git clone https://github.com/sorz/moproxy
cd moproxy

# Build
cargo build --release
target/release/moproxy --help

# If you are in Debian
cargo install cargo-deb
cargo deb
sudo dpkg -i target/debian/*.deb
moproxy --help

Refer to conf/ for config & systemd service files.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].