{"id":15107327,"url":"https://github.com/zhenkyle/shadowsocks_ruby","last_synced_at":"2025-09-06T00:37:23.764Z","repository":{"id":56895231,"uuid":"75038129","full_name":"zhenkyle/shadowsocks_ruby","owner":"zhenkyle","description":"Develop your own tunnel protocol made easy!","archived":false,"fork":false,"pushed_at":"2021-10-20T09:02:40.000Z","size":100,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T16:52:54.920Z","etag":null,"topics":["einhorn","eventmachine","libsodium","openssl","shadowsocks"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhenkyle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-29T03:13:24.000Z","updated_at":"2024-12-17T08:07:58.000Z","dependencies_parsed_at":"2022-08-21T01:20:57.725Z","dependency_job_id":null,"html_url":"https://github.com/zhenkyle/shadowsocks_ruby","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhenkyle%2Fshadowsocks_ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhenkyle%2Fshadowsocks_ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhenkyle%2Fshadowsocks_ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhenkyle%2Fshadowsocks_ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhenkyle","download_url":"https://codeload.github.com/zhenkyle/shadowsocks_ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237763855,"owners_count":19362310,"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":["einhorn","eventmachine","libsodium","openssl","shadowsocks"],"created_at":"2024-09-25T21:23:27.962Z","updated_at":"2025-02-08T05:31:38.785Z","avatar_url":"https://github.com/zhenkyle.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ShadowsocksRuby\n\n[![Gem Version](https://badge.fury.io/rb/shadowsocks_ruby.svg)](http://badge.fury.io/rb/shadowsocks_ruby)\n[![Build Status](https://travis-ci.org/zhenkyle/shadowsocks_ruby.svg?branch=master)](https://travis-ci.org/zhenkyle/shadowsocks_ruby)\n[![Dependency Status](https://gemnasium.com/zhenkyle/shadowsocks_ruby.svg)](https://gemnasium.com/zhenkyle/shadowsocks_ruby)\n[![Code Climate](https://codeclimate.com/github/zhenkyle/shadowsocks_ruby.svg)](https://codeclimate.com/github/zhenkyle/shadowsocks_ruby)\n[![Coverage Status](https://coveralls.io/repos/zhenkyle/shadowsocks_ruby/badge.svg?branch=master)](https://coveralls.io/r/zhenkyle/shadowsocks_ruby?branch=master)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/zhenkyle/shadowsocks_ruby/blob/master/LICENSE.txt)\n[![Join the chat at https://gitter.im/shadowsocks_ruby/Lobby](https://badges.gitter.im/shadowsocks_ruby/Lobby.svg)](https://gitter.im/shadowsocks_ruby/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nShadowsocksRuby is a SOCKS (layer 4) like tunnel proxy to help you bypass firewalls, and also a flexible platform for writing your own tunnel protocols. With layered protocol strategy, TCP/UDP/(even TLS) connection object and powerful DSL backended by ruby, it make your life easy to develop new tunnel (layer 4) protocols.\n\nMain features include:\n\n* **Popular event-driven I/O model:** utilize very little resource but provding extremely high scalability, performance and stability\n* **Vanilla shadowsocks protocol support:** comes with [shadowsocks](https://github.com/shadowsocks/shadowsocks) 's original version and OTA version protocol support and [shadowsocksr](https://github.com/shadowsocksr/shadowsocksr) 's \"http_simple\" and \"tls_ticket\" obfuscation protocol support\n* **Cipher method support:** all known shadowsocks cipher method, including `table` and `chacha20`\n* **Parallel execution support:** support multi workers by using [Einhorn](https://github.com/stripe/einhorn) socket manager to enable parallelism on multi-core CPU, and extra drb server to exchange data within workers\n* **Easy develop your own protocol:** see \"Example SOCKS4 Client Proxy in 35 lines\"\n\n## Installation\n\n    $ gem install shadowsocks_ruby\n\n## Usage\n\n### Running\n\nAfter Installation, ShadowsockRuby install 2 executable files for you:\n\n```\n$ ssserver-ruby -h\nA SOCKS like tunnel proxy that helps you bypass firewalls.\n\nUsage: ssserver-ruby [options]\n\nProxy options:\n    -c, --config [CONFIG]            path to config file (lazy default: config.json)\n    -s, --server SERVER_ADDR         server address (default: 0.0.0.0)\n    -p, --port SERVER_PORT           server port (default: 8388)\n    -k, --password PASSWORD          password\n    -O, --packet-protocol NAME       packet protocol (default: origin)\n    -G, --packet-param PARAM         packet protocol parameters\n    -m, --cipher-protocol NAME       cipher protocol (default: aes-256-cfb)\n    -o, --obfs-protocol [NAME]       obfuscate protocol (lazy default: http_simple)\n    -g, --obfs-param PARAM           obfuscate protocol parameters\n    -t, --timeout TIMEOUT            timeout in seconds, default: 300\n        --fast-open                  use TCP_FASTOPEN, requires Linux 3.7+\n    -E, --einhorn                    Use Einhorn socket manager\n\nCommon options:\n    -h, --help                       display help message\n    -v, --vv                         verbose mode\n    -q, --qq                         quiet mode, only show warnings/errors\n        --version                    show version information\n```\n\nand\n\n```\n$ sslocal-ruby -h\nA SOCKS like tunnel proxy that helps you bypass firewalls.\n\nUsage: sslocal-ruby [options]\n\nProxy options:\n    -c, --config [CONFIG]            path to config file (lazy default: config.json)\n    -s, --server SERVER_ADDR         server address\n    -p, --port SERVER_PORT           server port (default: 8388)\n    -b, --bind_addr LOCAL_ADDR       local binding address (default: 0.0.0.0)\n    -l, --local_port LOCAL_PORT      local port  (default: default: 1080)\n    -k, --password PASSWORD          password\n    -O, --packet-protocol NAME       packet protocol (default: origin)\n    -G, --packet-param PARAM         packet protocol parameters\n    -m, --cipher-protocol NAME       cipher protocol (default: aes-256-cfb)\n    -o, --obfs-protocol [NAME]       obfuscate protocol (lazy default: http_simple)\n    -g, --obfs-param PARAM           obfuscate protocol parameters\n    -t, --timeout TIMEOUT            timeout in seconds, default: 300\n        --fast-open                  use TCP_FASTOPEN, requires Linux 3.7+\n    -E, --einhorn                    Use Einhorn socket manager\n\nCommon options:\n    -h, --help                       display help message\n    -v, --vv                         verbose mode\n    -q, --qq                         quiet mode, only show warnings/errors\n        --version                    show version information\n```\n\n### Signals\n\n    QUIT - Graceful shutdown. Stop accepting connections immediately and\n           wait as long as necessary for all connections to close.\n\n    TERM - Fast shutdown. Stop accepting connections immediately and wait\n           up to 10 seconds for connections to close before forcing\n           termination.\n\n    INT  - Same as TERM\n\n\n### Example to establish a basic tunnel proxy\n\n    # On remote machine (eg IP: 1.2.3.4)\n    ssserver-ruby -k secret\n\n    # Then on local machine\n    sslocal-ruby -k secret -s 1.2.3.4\n\n    # Then using `127.0.0.1:1080` as your local SOCKS5 proxy.\n\n\n## Development\nTo get started, check out [documentation](http://www.rubydoc.info/github/zhenkyle/shadowsocks_ruby) then check out [spec](https://github.com/zhenkyle/shadowsocks_ruby/tree/master/spec) and [features](https://github.com/zhenkyle/shadowsocks_ruby/tree/master/features).\n\n### Example SOCKS4 Client Protocol in 35 lines\n\nHere's a fully-functional protocol to make ShadowsocksRuby support SOCKS4 client:\n\n```ruby\nmodule ShadowsocksRuby\n  module Protocols\n    class Socks4Protocol\n      attr_accessor :next_protocol\n      def initialize params = {}; end\n\n      def tcp_receive_from_client_first_packet n\n        data = async_recv(8)\n        v, c, port, o1, o2, o3, o4 = data.unpack(\"CCnC4\")\n        user \u003c\u003c async_recv_until(\"\\0\")\n        if v != 4 or c != 1\n          send_data \"\\0\\x5b\\0\\0\\0\\0\\0\\0\" \n          raise PharseError, \"SOCKS version or command not supported: #{v}, #{c}\"\n        end\n        send_data \"\\0\\x5a\\0\\0\\0\\0\\0\\0\"\n        class \u003c\u003c self\n          alias tcp_receive_from_client tcp_receive_from_client_other_packet\n        end\n        \"\\x01\" + [o1, o2, o3, o4, port].pack(\"C4n\") # return address_bin\n      end\n\n      alias tcp_receive_from_client tcp_receive_from_client_first_packet\n\n      def tcp_receive_from_client_other_packet n\n        async_recv(n)\n      end\n\n      def tcp_send_to_client data\n        send_data data\n      end\n\n      def async_recv_until(str) @next_protocol.async_recv_until(str); end\n    end\n  end\nend\n```\n\n\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/zhenkyle/shadowsocks_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\nIf you send pull request to add a new protocol, please include a RSpec spec (for unit and integration test) or a Cucumber feature (for acceptance test). \n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhenkyle%2Fshadowsocks_ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhenkyle%2Fshadowsocks_ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhenkyle%2Fshadowsocks_ruby/lists"}