{"id":13775955,"url":"https://github.com/shadowsocksr-backup/shadowsocksr-libev","last_synced_at":"2025-04-08T09:08:32.062Z","repository":{"id":52480174,"uuid":"98548577","full_name":"shadowsocksr-backup/shadowsocksr-libev","owner":"shadowsocksr-backup","description":"libev port of ShadowsocksR","archived":false,"fork":false,"pushed_at":"2021-04-27T18:22:53.000Z","size":8840,"stargazers_count":773,"open_issues_count":17,"forks_count":805,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-04-01T07:52:16.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shadowsocksr-backup.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-27T14:53:59.000Z","updated_at":"2025-03-19T13:05:51.000Z","dependencies_parsed_at":"2022-09-13T23:10:58.928Z","dependency_job_id":null,"html_url":"https://github.com/shadowsocksr-backup/shadowsocksr-libev","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocksr-backup%2Fshadowsocksr-libev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocksr-backup%2Fshadowsocksr-libev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocksr-backup%2Fshadowsocksr-libev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocksr-backup%2Fshadowsocksr-libev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shadowsocksr-backup","download_url":"https://codeload.github.com/shadowsocksr-backup/shadowsocksr-libev/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809962,"owners_count":20999816,"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":[],"created_at":"2024-08-03T17:01:55.753Z","updated_at":"2025-04-08T09:08:32.027Z","avatar_url":"https://github.com/shadowsocksr-backup.png","language":"C","funding_links":[],"categories":["\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"cb16466a31a167bb61f39e2a4a85f449\"\u003e\u003c/a\u003eShadowsocks"],"readme":"# shadowsocks-libev\n\n## Intro\n\n[Shadowsocks-libev](http://shadowsocks.org) is a lightweight secured SOCKS5\nproxy for embedded devices and low-end boxes.\n\nIt is a port of [Shadowsocks](https://github.com/shadowsocks/shadowsocks)\ncreated by [@clowwindy](https://github.com/clowwindy), which is maintained by\n[@madeye](https://github.com/madeye) and [@linusyang](https://github.com/linusyang).\n\nCurrent version: 2.5.6 | [Changelog](debian/changelog)\n\nTravis CI: [![Travis CI](https://travis-ci.org/shadowsocks/shadowsocks-libev.svg?branch=master)](https://travis-ci.org/shadowsocks/shadowsocks-libev)\n\n## Features\n\nShadowsocks-libev is written in pure C and only depends on\n[libev](http://software.schmorp.de/pkg/libev.html) and\n[OpenSSL](http://www.openssl.org/) or [mbedTLS](https://tls.mbed.org/) or [PolarSSL](https://polarssl.org/).\n\nIn normal usage, the memory footprint is about 600KB and the CPU utilization is\nno more than 5% on a low-end router (Buffalo WHR-G300N V2 with a 400MHz MIPS CPU,\n32MB memory and 4MB flash).\n\nFor a full list of feature comparison between different versions of shadowsocks,\nrefer to the [Wiki page](https://github.com/shadowsocks/shadowsocks/wiki/Feature-Comparison-across-Different-Versions).\n\n## Installation\n\n### Distribution-specific guide\n\n- [Debian \u0026 Ubuntu](#debian--ubuntu)\n    + [Install from repository](#install-from-repository)\n    + [Build deb package from source](#build-deb-package-from-source)\n    + [Configure and start the service](#configure-and-start-the-service)\n- [Fedora \u0026 RHEL](#fedora--rhel)\n    + [Install from repository](#install-from-repository-1)\n- [OpenSUSE](#opensuse)\n    + [Install from repository](#install-from-repository-2)\n    + [Build from source](#build-from-source)\n- [Archlinux](#archlinux)\n- [NixOS](#nixos)\n- [Nix](#nix)\n- [Directly build and install on UNIX-like system](#linux)\n- [FreeBSD](#freebsd)\n- [OpenWRT](#openwrt)\n- [OS X](#os-x)\n- [Windows](#windows)\n\n* * *\n\n### Pre-build configure guide\n\nFor a complete list of avaliable configure-time option,\ntry `configure --help`.\n\n#### Using alternative crypto library\n\nThere are three crypto libraries available:\n\n- OpenSSL (**default**)\n- mbedTLS\n- PolarSSL (Deprecated)\n\n##### mbedTLS\nTo build against mbedTLS, specify `--with-crypto-library=mbedtls`\nand `--with-mbedtls=/path/to/mbedtls` when running `./configure`.\n\nWindows users will need extra work when compiling mbedTLS library,\nsee [this issue](https://github.com/shadowsocks/shadowsocks-libev/issues/422) for detail info.\n\n##### PolarSSL (Deprecated)\n\nTo build against PolarSSL, specify `--with-crypto-library=polarssl`\nand `--with-polarssl=/path/to/polarssl` when running `./configure`.\n\n* PolarSSL __1.2.5 or newer__ is required. Currently, PolarSSL does __NOT__ support\nCAST5-CFB, DES-CFB, IDEA-CFB, RC2-CFB and SEED-CFB.\n* RC4 is only support by PolarSSL __1.3.0 or above__.\n\n#### Using shared library from system\n\nPlease specify `--enable-system-shared-lib`. This will replace the bundled\n`libev`, `libsodium` and `libudns` with the corresponding libraries installed\nin the system during compilation and linking.\n\n### Debian \u0026 Ubuntu\n\n#### Install from repository\n\n**Note: The repositories doesn't always contain the latest version. Please build from source if you want the latest version (see below)**\n\nShadowsocks-libev is available in the official repository for Debian 9(\"Stretch\"), unstable, Ubuntu 16.10 and later derivatives:\n\n```bash\nsudo apt update\nsudo apt install shadowsocks-libev\n```\n\nFor Debian Jessie users, please install it from `jessie-backports`:\n\n```bash\nsudo sh -c 'printf \"deb http://ftp.debian.org/debian jessie-backports main\" \u003e /etc/apt/sources.list.d/jessie-backports.list'\nsudo apt update\nsudo apt -t jessie-backports install shadowsocks-libev\n```\n\n#### Build deb package from source\n\nSupported Platforms:\n\n* Debian 7 (see below), 8, 9, unstable\n* Ubuntu 14.04 (see below), Ubuntu 14.10, 15.04, 15.10 or higher\n\n**Note for Ubuntu 14.04 users**:\nPackages built on Ubuntu 14.04 may be used in later Ubuntu versions. However,\npackages built on Debian 7/8/9 or Ubuntu 14.10+ **cannot** be installed on\nUbuntu 14.04.\n\n**Note for Debian 7.x users**:\nTo build packages on Debian 7 (Wheezy), you need to enable `debian-backports`\nto install systemd-compatibility packages like `dh-systemd` or `init-system-helpers`.\nPlease follow the instructions on [Debian Backports](http://backports.debian.org).\n\nThis also means that you can only install those built packages on systems that have\n`init-system-helpers` installed.\n\nOtherwise, try to build and install directly from source. See the [Linux](#linux)\nsection below.\n\n``` bash\ncd shadowsocks-libev\nsudo apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev \\\n    gawk debhelper dh-systemd init-system-helpers pkg-config asciidoc xmlto apg libpcre3-dev\ndpkg-buildpackage -b -us -uc -i\ncd ..\nsudo dpkg -i shadowsocks-libev*.deb\n```\n\n#### Configure and start the service\n\n```\n# Edit the configuration file\nsudo vim /etc/shadowsocks-libev/config.json\n\n# Edit the default configuration for debian\nsudo vim /etc/default/shadowsocks-libev\n\n# Start the service\nsudo /etc/init.d/shadowsocks-libev start    # for sysvinit, or\nsudo systemctl start shadowsocks-libev      # for systemd\n```\n\n### Fedora \u0026 RHEL\n\nSupported distributions include\n- Fedora 22, 23, 24\n- RHEL 6, 7 and derivatives (including CentOS, Scientific Linux)\n\n#### Install from repository\n\nEnable repo via `dnf`:\n\n```\nsu -c 'dnf copr enable librehat/shadowsocks'\n```\n\nOr download yum repo on [Fedora Copr](https://copr.fedoraproject.org/coprs/librehat/shadowsocks/) and put it inside `/etc/yum.repos.d/`. The release `Epel` is for RHEL and its derivatives.\n\nThen, install `shadowsocks-libev` via `dnf`:\n\n```bash\nsu -c 'dnf update'\nsu -c 'dnf install shadowsocks-libev'\n```\n\nor `yum`:\n\n```bash\nsu -c 'yum update'\nsu -c 'yum install shadowsocks-libev'\n```\n### OpenSUSE\n\n#### Install from repository\nUse the following command to install from repository.\n\n```bash\nsudo zypper install shadowsocks-libev\n```\n\n#### Build from source\nYou should install `zlib-devel` and `libopenssl-devel` first.\n\n```bash\nsudo zypper update\nsudo zypper install zlib-devel libopenssl-devel\n```\n\nThen download the source package and compile.\n\n```bash\ngit clone https://github.com/shadowsocks/shadowsocks-libev.git\ncd shadowsocks-libev\n./configure \u0026\u0026 make\nsudo make install\n```\n\n### Archlinux\n\n```bash\nsudo pacman -S shadowsocks-libev\n```\n\nPlease refer to downstream [PKGBUILD](https://projects.archlinux.org/svntogit/community.git/tree/trunk?h=packages/shadowsocks-libev)\nscript for extra modifications and distribution-specific bugs.\n\n### NixOS\n\n```bash\nnix-env -iA nixos.shadowsocks-libev\n```\n\n### Nix\n\n```bash\nnix-env -iA nixpkgs.shadowsocks-libev\n```\n\n### Linux\n\nFor Unix-like systems, especially Debian-based systems,\ne.g. Ubuntu, Debian or Linux Mint, you can build the binary like this:\n\n```bash\n# Debian / Ubuntu\nsudo apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev libpcre3-dev asciidoc xmlto\n# CentOS / Fedora / RHEL\nsudo yum install gcc autoconf libtool automake make zlib-devel openssl-devel asciidoc xmlto\n./configure \u0026\u0026 make\nsudo make install\n```\n\n### FreeBSD\n\n```bash\nsu\ncd /usr/ports/net/shadowsocks-libev\nmake install\n```\n\nEdit your config.json file. By default, it's located in /usr/local/etc/shadowsocks-libev.\n\nTo enable shadowsocks-libev, add the following rc variable to your /etc/rc.conf file:\n\n```\nshadowsocks_libev_enable=\"YES\"\n```\n\nStart the Shadowsocks server:\n\n```bash\nservice shadowsocks_libev start\n```\n\n### OpenWRT\n\nThe OpenWRT project is maintained here:\n[openwrt-shadowsocks](https://github.com/shadowsocks/openwrt-shadowsocks).\n\n### OS X\nFor OS X, use [Homebrew](http://brew.sh) to install or build.\n\nInstall Homebrew:\n\n```bash\nruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"\n```\nInstall shadowsocks-libev:\n\n```bash\nbrew install shadowsocks-libev\n```\n\n### Windows\n\nFor Windows, use either MinGW (msys) or Cygwin to build.\nAt the moment, only `ss-local` is supported to build against MinGW (msys).\n\nIf you are using MinGW (msys), please download OpenSSL or PolarSSL source tarball\nto the home directory of msys, and build it like this (may take a few minutes):\n\n#### OpenSSL\n\n```bash\ntar zxf openssl-1.0.1e.tar.gz\ncd openssl-1.0.1e\n./config --prefix=\"$HOME/prebuilt\" --openssldir=\"$HOME/prebuilt/openssl\"\nmake \u0026\u0026 make install\n```\n\n#### PolarSSL\n\n```bash\ntar zxf polarssl-1.3.2-gpl.tgz\ncd polarssl-1.3.2\nmake lib WINDOWS=1\nmake install DESTDIR=\"$HOME/prebuilt\"\n```\n\nThen, build the binary using the commands below, and all `.exe` files\nwill be built at `$HOME/ss/bin`:\n\n#### OpenSSL\n\n```bash\n./configure --prefix=\"$HOME/ss\" --with-openssl=\"$HOME/prebuilt\"\nmake \u0026\u0026 make install\n```\n\n#### PolarSSL\n\n```bash\n./configure --prefix=\"$HOME/ss\" --with-crypto-library=polarssl --with-polarssl=$HOME/prebuilt\nmake \u0026\u0026 make install\n```\n\n## Usage\n\nFor a detailed and complete list of all supported arguments, you may refer to the\nman pages of the applications, respectively.\n\n```\n    ss-[local|redir|server|tunnel]\n\n       -s \u003cserver_host\u003e           host name or ip address of your remote server\n\n       -p \u003cserver_port\u003e           port number of your remote server\n\n       -l \u003clocal_port\u003e            port number of your local server\n\n       -k \u003cpassword\u003e              password of your remote server\n\n       [-m \u003cencrypt_method\u003e]      encrypt method: table, rc4, rc4-md5,\n                                  aes-128-cfb, aes-192-cfb, aes-256-cfb,\n                                  bf-cfb, camellia-128-cfb, camellia-192-cfb,\n                                  camellia-256-cfb, cast5-cfb, des-cfb, idea-cfb,\n                                  rc2-cfb, seed-cfb, salsa20 ,chacha20 and\n                                  chacha20-ietf\n\n       [-f \u003cpid_file\u003e]            the file path to store pid\n\n       [-t \u003ctimeout\u003e]             socket timeout in seconds\n\n       [-c \u003cconfig_file\u003e]         the path to config file\n\n       [-i \u003cinterface\u003e]           network interface to bind,\n                                  not available in redir mode\n\n       [-b \u003clocal_address\u003e]       local address to bind,\n                                  not available in server mode\n\n       [-u]                       enable udprelay mode,\n                                  TPROXY is required in redir mode\n\n       [-U]                       enable UDP relay and disable TCP relay,\n                                  not available in local mode\n\n       [-A]                       enable onetime authentication\n\n       [-L \u003caddr\u003e:\u003cport\u003e]         specify destination server address and port\n                                  for local port forwarding,\n                                  only available in tunnel mode\n\n       [-d \u003caddr\u003e]                setup name servers for internal DNS resolver,\n                                  only available in server mode\n\n       [--fast-open]              enable TCP fast open,\n                                  only available in local and server mode,\n                                  with Linux kernel \u003e 3.7.0\n\n       [--acl \u003cacl_file\u003e]         config file of ACL (Access Control List)\n                                  only available in local and server mode\n\n       [--manager-address \u003caddr\u003e] UNIX domain socket address\n                                  only available in server and manager mode\n\n       [--executable \u003cpath\u003e]      path to the executable of ss-server\n                                  only available in manager mode\n\n       [-v]                       verbose mode\n\nnotes:\n\n    ss-redir provides a transparent proxy function and only works on the\n    Linux platform with iptables.\n\n```\n\n## Advanced usage\n\nThe latest shadowsocks-libev has provided a *redir* mode. You can configure your Linux-based box or router to proxy all TCP traffic transparently.\n\n    # Create new chain\n    root@Wrt:~# iptables -t nat -N SHADOWSOCKS\n    root@Wrt:~# iptables -t mangle -N SHADOWSOCKS\n\n    # Ignore your shadowsocks server's addresses\n    # It's very IMPORTANT, just be careful.\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN\n\n    # Ignore LANs and any other addresses you'd like to bypass the proxy\n    # See Wikipedia and RFC5735 for full list of reserved networks.\n    # See ashi009/bestroutetb for a highly optimized CHN route list.\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN\n\n    # Anything else should be redirected to shadowsocks's local port\n    root@Wrt:~# iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345\n\n    # Add any UDP rules\n    root@Wrt:~# ip route add local default dev lo table 100\n    root@Wrt:~# ip rule add fwmark 1 lookup 100\n    root@Wrt:~# iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01\n    root@Wrt:~# iptables -t mangle -A SHADOWSOCKS_MARK -p udp --dport 53 -j MARK --set-mark 1\n\n    # Apply the rules\n    root@Wrt:~# iptables -t nat -A OUTPUT -p tcp -j SHADOWSOCKS\n    root@Wrt:~# iptables -t mangle -A PREROUTING -j SHADOWSOCKS\n    root@Wrt:~# iptables -t mangle -A OUTPUT -j SHADOWSOCKS_MARK\n\n    # Start the shadowsocks-redir\n    root@Wrt:~# ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid\n\n## Shadowsocks over KCP\n\nIt's quite easy to use shadowsocks and [KCP](https://github.com/skywind3000/kcp) together with [kcptun](https://github.com/xtaci/kcptun).\n\nThe goal of shadowsocks over KCP is to provide a fully configurable, UDP based protocol to improve poor connections, e.g. a high packet loss 3G network.\n\n### Setup your server\n\n```bash\nserver_linux_amd64 -l :21 -t 127.0.0.1:443 --crypt none --mtu 1200 --nocomp --mode normal --dscp 46 \u0026\nss-server -s 0.0.0.0 -p 443 -k passwd -m chacha20 -u\n```\n\n### Setup your client\n\n```bash\nclient_linux_amd64 -l 127.0.0.1:1090 -r \u003cserver_ip\u003e:21 --crypt none --mtu 1200 --nocomp --mode normal --dscp 46 \u0026\nss-local -s 127.0.0.1 -p 1090 -k passwd -m chacha20 -l 1080 -b 0.0.0.0 \u0026\nss-local -s \u003cserver_ip\u003e -p 443 -k passwd -m chacha20 -l 1080 -U -b 0.0.0.0\n```\n\n## Security Tips\n\nAlthough shadowsocks-libev can handle thousands of concurrent connections nicely, we still recommend\nsetting up your server's firewall rules to limit connections from each user:\n\n    # Up to 32 connections are enough for normal usage\n    iptables -A INPUT -p tcp --syn --dport ${SHADOWSOCKS_PORT} -m connlimit --connlimit-above 32 -j REJECT --reject-with tcp-reset\n\n## License\n\nCopyright (C) 2016 Max Lv \u003cmax.c.lv@gmail.com\u003e\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowsocksr-backup%2Fshadowsocksr-libev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowsocksr-backup%2Fshadowsocksr-libev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowsocksr-backup%2Fshadowsocksr-libev/lists"}