All Projects → ihciah → Go Shadowsocks Magic

ihciah / Go Shadowsocks Magic

Licence: apache-2.0
A shadowsocks implementation in golang with Multi-connection Acceleration

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Go Shadowsocks Magic

Moproxy
A transparent TCP to SOCKSv5/HTTP proxy on Linux written in Rust.
Stars: ✭ 126 (-20.25%)
Mutual labels:  shadowsocks
Shadowsocks Cloak Installer
A one-key script to setup Cloak plugin with Shadowsocks on your server
Stars: ✭ 138 (-12.66%)
Mutual labels:  shadowsocks
Pichi
Flexible Rule-Based Proxy
Stars: ✭ 149 (-5.7%)
Mutual labels:  shadowsocks
Fanqiang Book
2021科学上网指南,小白图文攻略 | 翻墙/梯子/自由上网/SSR/V2Ray/
Stars: ✭ 127 (-19.62%)
Mutual labels:  shadowsocks
Unblockchn
Unblock CHN - Shadowsocks 回国解锁代理分流配置工具 (路由器 & Surge) - Unblock Youku 衍生工具
Stars: ✭ 134 (-15.19%)
Mutual labels:  shadowsocks
Shadowproxy
A proxy server that implements Socks5/Shadowsocks/Redirect/HTTP (tcp) and Shadowsocks/TProxy/Tunnel (udp) protocols.
Stars: ✭ 142 (-10.13%)
Mutual labels:  shadowsocks
Tun2socks
tun2socks - powered by gVisor TCP/IP stack
Stars: ✭ 123 (-22.15%)
Mutual labels:  shadowsocks
Agentx
Shadowsocks升级版,支持协议伪装和流量压缩,易于扩展,可统计流量
Stars: ✭ 154 (-2.53%)
Mutual labels:  shadowsocks
Shadowrocket Adblock Rules
提供多款 Shadowrocket 规则,带广告过滤功能。用于 iOS 未越狱设备选择性地自动翻墙。
Stars: ✭ 12,447 (+7777.85%)
Mutual labels:  shadowsocks
Cproxy
Easy per application transparent proxy built on cgroup.
Stars: ✭ 145 (-8.23%)
Mutual labels:  shadowsocks
Fwlite
A anti-censorship HTTP proxy with builtin shadowsocks support.
Stars: ✭ 129 (-18.35%)
Mutual labels:  shadowsocks
Ssr Manyuser glzjin shell
sspanel v3 魔改版 后端一键安装配置管理脚本
Stars: ✭ 133 (-15.82%)
Mutual labels:  shadowsocks
Soksaccounts
🔥 Shadowsocks 账号爬虫
Stars: ✭ 145 (-8.23%)
Mutual labels:  shadowsocks
Ubnt Mips Shadowsocks Libev
Cross complie shadowsocks for UBNT devices based on mipsel or mips64
Stars: ✭ 127 (-19.62%)
Mutual labels:  shadowsocks
Qladder
QLadder is a project for iOS client. It uses shadowsocks as server-side.
Stars: ✭ 152 (-3.8%)
Mutual labels:  shadowsocks
Aioshadowsocks
用 asyncio 重写 shadowsocks ~
Stars: ✭ 126 (-20.25%)
Mutual labels:  shadowsocks
Ladder
梯子,科学上网,翻墙 , 代理, 外网, 加速器, 路由, V2Ray,SS,shadowsocks, SSR
Stars: ✭ 141 (-10.76%)
Mutual labels:  shadowsocks
Shadowtunnel
secure tunnel which help you protecting your tcp traffic between your machine and your service on remote.
Stars: ✭ 156 (-1.27%)
Mutual labels:  shadowsocks
Surge Rules
🦄 🎃 👻 Surge 规则集(DOMAIN-SET 和 RULE-SET),兼容 Surge for iOS 和 Surge for Mac 客户端。
Stars: ✭ 151 (-4.43%)
Mutual labels:  shadowsocks
Shadowsocks Asuswrt Merlin
Shadowsock for Asuswrt-Merlin New Gen
Stars: ✭ 148 (-6.33%)
Mutual labels:  shadowsocks

go-shadowsocks-magic

A shadowsocks implementation in golang with Multi-connection Acceleration.

The code is based on https://github.com/shadowsocks/go-shadowsocks2

==================================================

UPDATE 2019-10: Deprecated. Rabbit TCP is recommended.

2019-10 更新: 不建议使用。请使用Rabbit TCP

==================================================

中文版戳这!

Features

  • [x] SOCKS5 proxy with UDP Associate
  • [x] Support for Netfilter TCP redirect (IPv6 should work but not tested)
  • [x] UDP tunneling (e.g. relay DNS packets)
  • [x] TCP tunneling (e.g. benchmark with iperf3)
  • [x] Multi-connection Acceleration

Multi-connection Acceleration Protocol

In the original shadowsocks protocal, the data is transmitted in the following way:

client <---> ss-local <--[encrypted]--> ss-remote <---> target

The shadowsocks is used to access blocked servers. In most common applications, the bottleneck of the bandwidth is the way outside their countries: ss-local<--->ss-remote. Is it the best way to communicate in one connection?

With a proper protocol, the ss-local and ss-remote can communicate in multi TCP connections, which will be faster when transferring a large amount of data, especially for those slow VPS.

The following protocol by ihciah is one of them. The implementation in other language is welcome.

  1. Establish the connection to shadowsocks server first.

  2. Send address. Here I add 2 bits for "Magic": magic-main(0b01000) and magic-child(0b10000).

    After sending the address with magic-main, the server will reply a 16-byte dataKey.

  3. Up till now we have 1 connection. Through the connection, data will be sent back in format [BlockID(uint32)][BlockSize(uint32)][Data([BlckSize]byte)].

  4. Of course, it's not acceleration with only 1 connection. With the dataKey we can construct an "address" in format [Type([1]byte)][dataKey([16]byte)], the type must be marked as magic-child.

    Now create a new connection and send the 17-byte "address", then the data will be transmitted to the client.

  5. Once the main connection(the first one) is disconnected, all the other connections will die. However, it's not a problem if the magic-child connections interrupted.

Install

Pre-built binaries for common platforms are available at https://github.com/ihciah/go-shadowsocks-magic/releases

Install from source

go get -u -v github.com/ihciah/go-shadowsocks-magic

Basic Usage

Server

Start a server listening on port 8488 using RC4-MD5 cipher with password your-password.

shadowsocks-magic -s 'ss://RC4-MD5:[email protected]:8488' -verbose

When deploy, you can close verbose.

Client

Start a client connecting to the above server. The client listens on port 1080 for incoming SOCKS5 connections, and tunnels both UDP and TCP on port 8053 and port 8054 to 8.8.8.8:53 and 8.8.4.4:53 respectively.

shadowsocks-magic -c 'ss://RC4-MD5:[email protected][server_address]:8488' \
    -verbose -socks :1080 -u -udptun :8053=8.8.8.8:53,:8054=8.8.4.4:53 \
                             -tcptun :8053=8.8.8.8:53,:8054=8.8.4.4:53

Replace [server_address] with the server's public address.

Advanced Usage

Netfilter TCP redirect (Linux only)

The client offers -redir and -redir6 (for IPv6) options to handle TCP connections redirected by Netfilter on Linux. The feature works similar to ss-redir from shadowsocks-libev.

Start a client listening on port 1082 for redirected TCP connections and port 1083 for redirected TCP IPv6 connections.

shadowsocks-magic -c 'ss://RC4-MD5:[email protected][server_address]:8488' -redir :1082 -redir6 :1083

TCP tunneling

The client offers -tcptun [local_addr]:[local_port]=[remote_addr]:[remote_port] option to tunnel TCP. For example it can be used to proxy iperf3 for benchmarking.

Start iperf3 on the same machine with the server.

iperf3 -s

By default iperf3 listens on port 5201.

Start a client on the same machine with the server. The client listens on port 1090 for incoming connections and tunnels to localhost:5201 where iperf3 is listening.

shadowsocks-magic -c 'ss://RC4-MD5:[email protected][server_address]:8488' -tcptun :1090=localhost:5201

Start iperf3 client to connect to the tunneld port instead

iperf3 -c localhost -p 1090

Design Principles

The code base strives to

  • be idiomatic Go and well organized;
  • use fewer external dependences as reasonably possible;
  • only include proven modern ciphers;

Known Issues

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].