{"id":13601181,"url":"https://github.com/ihciah/go-shadowsocks-magic","last_synced_at":"2025-10-23T02:31:04.213Z","repository":{"id":57497869,"uuid":"164727670","full_name":"ihciah/go-shadowsocks-magic","owner":"ihciah","description":"A shadowsocks implementation in golang with Multi-connection Acceleration","archived":false,"fork":false,"pushed_at":"2019-10-16T08:55:52.000Z","size":30,"stargazers_count":152,"open_issues_count":0,"forks_count":16,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-09-26T21:23:21.343Z","etag":null,"topics":["multi-connection","multi-thread","shadowsocks"],"latest_commit_sha":null,"homepage":"https://www.ihcblog.com/How-to-Speed-Up-Shadowsocks/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ihciah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-08T20:30:29.000Z","updated_at":"2024-09-10T03:53:54.000Z","dependencies_parsed_at":"2022-08-28T15:10:36.826Z","dependency_job_id":null,"html_url":"https://github.com/ihciah/go-shadowsocks-magic","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihciah%2Fgo-shadowsocks-magic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihciah%2Fgo-shadowsocks-magic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihciah%2Fgo-shadowsocks-magic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihciah%2Fgo-shadowsocks-magic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ihciah","download_url":"https://codeload.github.com/ihciah/go-shadowsocks-magic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219868420,"owners_count":16555750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["multi-connection","multi-thread","shadowsocks"],"created_at":"2024-08-01T18:00:57.508Z","updated_at":"2025-10-23T02:31:03.878Z","avatar_url":"https://github.com/ihciah.png","language":"Go","funding_links":[],"categories":["Go","\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"cb16466a31a167bb61f39e2a4a85f449\"\u003e\u003c/a\u003eShadowsocks"],"readme":"# go-shadowsocks-magic\n\nA shadowsocks implementation in golang with Multi-connection Acceleration.\n\nThe code is based on https://github.com/shadowsocks/go-shadowsocks2\n\n==================================================\n\n## UPDATE 2019-10: Deprecated. [Rabbit TCP]( https://github.com/ihciah/rabbit-tcp ) is recommended.\n\n## 2019-10 更新: 不建议使用。请使用[Rabbit TCP]( https://github.com/ihciah/rabbit-tcp ) 。\n\n==================================================\n\n[中文版戳这！](https://www.ihcblog.com/How-to-Speed-Up-Shadowsocks/)\n\n\n\n## Features\n\n- [x] SOCKS5 proxy with UDP Associate\n- [x] Support for Netfilter TCP redirect (IPv6 should work but not tested)\n- [x] UDP tunneling (e.g. relay DNS packets)\n- [x] TCP tunneling (e.g. benchmark with iperf3)\n- [x] Multi-connection Acceleration\n\n\n## Multi-connection Acceleration Protocol\nIn the original shadowsocks protocal, the data is transmitted in the following way:\n\n`client \u003c---\u003e ss-local \u003c--[encrypted]--\u003e ss-remote \u003c---\u003e target`\n\nThe shadowsocks is used to access blocked servers.\nIn most common applications, the bottleneck of the bandwidth is the way outside their countries: `ss-local\u003c---\u003ess-remote`.\nIs it the best way to communicate in one connection? \n\nWith a proper protocol, the `ss-local` and `ss-remote` can communicate in multi TCP connections, \nwhich will be faster when transferring a large amount of data, especially for those slow VPS.\n\nThe following protocol by ihciah is one of them. The implementation in other language is welcome.\n\n1. Establish the connection to shadowsocks server first.\n2. Send [address](https://shadowsocks.org/en/spec/Protocol.html). \nHere I add 2 bits for \"Magic\": `magic-main`(`0b01000`) and `magic-child`(`0b10000`).\n\n    After sending the address with `magic-main`, the server will reply a 16-byte `dataKey`.\n3. Up till now we have 1 connection. \nThrough the connection, data will be sent back in format `[BlockID(uint32)][BlockSize(uint32)][Data([BlckSize]byte)]`.\n4. Of course, it's not acceleration with only 1 connection. \nWith the `dataKey` we can construct an \"address\" in format `[Type([1]byte)][dataKey([16]byte)]`, \nthe type must be marked as `magic-child`.\n\n    Now create a new connection and send the 17-byte \"address\", \n    then the data will be transmitted to the client.\n5. Once the main connection(the first one) is disconnected, \nall the other connections will die. \nHowever, it's not a problem if the `magic-child` connections interrupted.\n   \n\n\n## Install\n\nPre-built binaries for common platforms are available at https://github.com/ihciah/go-shadowsocks-magic/releases\n\nInstall from source\n\n```sh\ngo get -u -v github.com/ihciah/go-shadowsocks-magic\n```\n\n\n## Basic Usage\n\n### Server\n\nStart a server listening on port 8488 using `RC4-MD5` cipher with password `your-password`.\n\n```sh\nshadowsocks-magic -s 'ss://RC4-MD5:your-password@:8488' -verbose\n```\n\nWhen deploy, you can close verbose.\n\n### Client\n\nStart a client connecting to the above server. The client listens on port 1080 for incoming SOCKS5 \nconnections, and tunnels both UDP and TCP on port 8053 and port 8054 to 8.8.8.8:53 and 8.8.4.4:53 \nrespectively. \n\n```sh\nshadowsocks-magic -c 'ss://RC4-MD5:your-password@[server_address]:8488' \\\n    -verbose -socks :1080 -u -udptun :8053=8.8.8.8:53,:8054=8.8.4.4:53 \\\n                             -tcptun :8053=8.8.8.8:53,:8054=8.8.4.4:53\n```\n\nReplace `[server_address]` with the server's public address.\n\n\n## Advanced Usage\n\n\n### Netfilter TCP redirect (Linux only)\n\nThe client offers `-redir` and `-redir6` (for IPv6) options to handle TCP connections \nredirected by Netfilter on Linux. The feature works similar to `ss-redir` from `shadowsocks-libev`.\n\n\nStart a client listening on port 1082 for redirected TCP connections and port 1083 for redirected\nTCP IPv6 connections.\n\n```sh\nshadowsocks-magic -c 'ss://RC4-MD5:your-password@[server_address]:8488' -redir :1082 -redir6 :1083\n```\n\n\n### TCP tunneling\n\nThe client offers `-tcptun [local_addr]:[local_port]=[remote_addr]:[remote_port]` option to tunnel TCP.\nFor example it can be used to proxy iperf3 for benchmarking.\n\nStart iperf3 on the same machine with the server.\n\n```sh\niperf3 -s\n```\n\nBy default iperf3 listens on port 5201.\n\nStart a client on the same machine with the server. The client listens on port 1090 for incoming connections\nand tunnels to localhost:5201 where iperf3 is listening.\n\n```sh\nshadowsocks-magic -c 'ss://RC4-MD5:your-password@[server_address]:8488' -tcptun :1090=localhost:5201\n```\n\nStart iperf3 client to connect to the tunneld port instead\n\n```sh\niperf3 -c localhost -p 1090\n```\n\n\n## Design Principles\n\nThe code base strives to\n\n- be idiomatic Go and well organized;\n- use fewer external dependences as reasonably possible;\n- only include proven modern ciphers;\n\n## Known Issues\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihciah%2Fgo-shadowsocks-magic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fihciah%2Fgo-shadowsocks-magic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihciah%2Fgo-shadowsocks-magic/lists"}