{"id":13507935,"url":"https://github.com/shadowsocks/shadowsocks-libev","last_synced_at":"2026-01-09T22:38:56.153Z","repository":{"id":5956164,"uuid":"7177269","full_name":"shadowsocks/shadowsocks-libev","owner":"shadowsocks","description":"Bug-fix-only libev port of shadowsocks. Future development moved to shadowsocks-rust","archived":false,"fork":false,"pushed_at":"2025-01-20T03:11:47.000Z","size":10618,"stargazers_count":16032,"open_issues_count":125,"forks_count":6305,"subscribers_count":751,"default_branch":"master","last_synced_at":"2025-09-19T21:51:15.611Z","etag":null,"topics":["c","shadowsocks"],"latest_commit_sha":null,"homepage":"https://github.com/shadowsocks/shadowsocks-rust","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"clowwindy/shadowsocks-libev","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shadowsocks.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":".github/FUNDING.yml","license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://crowdfunding.lfx.linuxfoundation.org/projects/shadowsocks"]}},"created_at":"2012-12-15T08:11:07.000Z","updated_at":"2025-09-19T12:48:18.000Z","dependencies_parsed_at":"2023-02-10T01:30:37.807Z","dependency_job_id":null,"html_url":"https://github.com/shadowsocks/shadowsocks-libev","commit_stats":null,"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"purl":"pkg:github/shadowsocks/shadowsocks-libev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2Fshadowsocks-libev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2Fshadowsocks-libev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2Fshadowsocks-libev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2Fshadowsocks-libev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shadowsocks","download_url":"https://codeload.github.com/shadowsocks/shadowsocks-libev/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2Fshadowsocks-libev/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278487174,"owners_count":25995124,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c","shadowsocks"],"created_at":"2024-08-01T02:00:43.734Z","updated_at":"2025-10-05T17:31:28.415Z","avatar_url":"https://github.com/shadowsocks.png","language":"C","readme":"# shadowsocks-libev\n\n[![Build Status](https://travis-ci.com/shadowsocks/shadowsocks-libev.svg?branch=master)](https://travis-ci.com/shadowsocks/shadowsocks-libev) [![Snap Status](https://snapcraft.io/shadowsocks-libev/badge.svg)](https://snapcraft.io/shadowsocks-libev)\n\n## Intro\n\n[Shadowsocks-libev](https://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), and maintained by\n[@madeye](https://github.com/madeye) and [@linusyang](https://github.com/linusyang).\n\nCurrent version: 3.3.5 | [Changelog](debian/changelog)\n\n## Features\n\nShadowsocks-libev is written in pure C and depends on [libev](http://software.schmorp.de/pkg/libev.html). It's designed\nto be a lightweight implementation of shadowsocks protocol, in order to keep the resource usage as low as possible.\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## Quick Start\n\nSnap is the recommended way to install the latest binaries.\n\n### Install snap core\n\nhttps://snapcraft.io/core\n\n### Install from snapcraft.io\n\nStable channel:\n\n```bash\nsudo snap install shadowsocks-libev\n```\n\nEdge channel:\n\n```bash\nsudo snap install shadowsocks-libev --edge\n```\n\n## Installation\n\n### Distribution-specific guide\n\n- [Debian \u0026 Ubuntu](#debian--ubuntu)\n    + [Install from repository](#install-from-repository-not-recommended)\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    + [Build from source with centos](#build-from-source-with-centos)\n- [Archlinux \u0026 Manjaro](#archlinux--manjaro)\n- [NixOS](#nixos)\n- [Nix](#nix)\n- [Directly build and install on UNIX-like system](#linux)\n- [FreeBSD](#freebsd)\n    + [Install](#install)\n    + [Configuration](#configuration)\n    + [Run](#run)\n    + [Run as client](#run-as-client)\n- [OpenWRT](#openwrt)\n- [OS X](#os-x)\n- [Windows (MinGW)](#windows-mingw)\n- [Docker](#docker)\n\n* * *\n\n### Initialise the build environment\n\nThis repository uses submodules, so you should pull them before you start, using:\n\n```bash\ngit submodule update --init --recursive\n```\n\n### Pre-build configure guide\n\nFor a complete list of available configure-time option,\ntry `configure --help`.\n\n### Debian \u0026 Ubuntu\n\n#### Install from repository (not recommended)\n\nShadowsocks-libev is available in the official repository for following distributions:\n\n* Debian 8 or higher, including oldoldstable (jessie), old stable (stretch), stable (buster), testing (bullseye) and unstable (sid)\n* Ubuntu 16.10 or higher\n\n```bash\nsudo apt update\nsudo apt install shadowsocks-libev\n```\n\n#### Build deb package from source\n\nSupported distributions:\n\n* Debian 8, 9 or higher\n* Ubuntu 14.04 LTS, 16.04 LTS, 16.10 or higher\n\nYou can build shadowsocks-libev and all its dependencies by script:\n\n```bash\nmkdir -p ~/build-area/\ncp ./scripts/build_deb.sh ~/build-area/\ncd ~/build-area\n./build_deb.sh\n```\n\nFor older systems, building `.deb` packages is not supported.\nPlease try to build and install directly from source. See the [Linux](#linux) section below.\n\n**Note for Debian 8 (Jessie) users to build their own deb packages**:\n\nWe strongly encourage you to install shadowsocks-libev from `jessie-backports-sloppy`. If you insist on building from source, you will need to manually install libsodium from `jessie-backports-sloppy`, **NOT** libsodium in main repository.\n\nFor more info about backports, you can refer [Debian Backports](https://backports.debian.org).\n\n``` bash\ncd shadowsocks-libev\nsudo sh -c 'printf \"deb http://deb.debian.org/debian jessie-backports main\" \u003e /etc/apt/sources.list.d/jessie-backports.list'\nsudo sh -c 'printf \"deb http://deb.debian.org/debian jessie-backports-sloppy main\" \u003e\u003e /etc/apt/sources.list.d/jessie-backports.list'\nsudo apt-get install --no-install-recommends devscripts equivs\nmk-build-deps --root-cmd sudo --install --tool \"apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y\"\n./autogen.sh \u0026\u0026 dpkg-buildpackage -b -us -uc\ncd ..\nsudo dpkg -i shadowsocks-libev*.deb\n```\n\n**Note for Debian 9 (Stretch) users to build their own deb packages**:\n\nWe strongly encourage you to install shadowsocks-libev from `stretch-backports`. If you insist on building from source, you will need to manually install libsodium from `stretch-backports`, **NOT** libsodium in main repository.\n\nFor more info about backports, you can refer [Debian Backports](https://backports.debian.org).\n\n``` bash\ncd shadowsocks-libev\nsudo sh -c 'printf \"deb http://deb.debian.org/debian stretch-backports main\" \u003e /etc/apt/sources.list.d/stretch-backports.list'\nsudo apt-get install --no-install-recommends devscripts equivs\nmk-build-deps --root-cmd sudo --install --tool \"apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y\"\n./autogen.sh \u0026\u0026 dpkg-buildpackage -b -us -uc\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:\n\n* Recent Fedora versions (until EOL)\n* RHEL 6, 7 and derivatives (including CentOS, Scientific Linux)\n\n#### Build from source with centos\n\nIf you are using CentOS 7, you need to install these prerequirements to build from source code:\n\n```bash\nyum install epel-release -y\nyum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto c-ares-devel libev-devel libsodium-devel mbedtls-devel -y\n```\n\n### Archlinux \u0026 Manjaro\n\n```bash\nsudo pacman -S shadowsocks-libev\n```\n\nPlease refer to downstream [PKGBUILD](https://github.com/archlinux/svntogit-community/blob/packages/shadowsocks-libev/trunk/PKGBUILD)\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\nIn general, you need the following build dependencies:\n\n* autotools (autoconf, automake, libtool)\n* gettext\n* pkg-config\n* libmbedtls\n* libsodium\n* libpcre3 (old pcre library)\n* libev\n* libc-ares\n* asciidoc (for documentation only)\n* xmlto (for documentation only)\n\nNotes: Fedora 26  libsodium version \u003e= 1.0.12, so you can install via dnf install libsodium instead build from source.\n\nIf your system is too old to provide libmbedtls and libsodium (later than **v1.0.8**), you will need to either install those libraries manually or upgrade your system.\n\nIf your system provides with those libraries, you **should not** install them from source.You should jump to this section and install them from the distribution repository instead.\n\nFor some of the distributions, you might install build dependencies like this:\n\n```bash\n# Installation of basic build dependencies\n## Debian / Ubuntu\nsudo apt-get install --no-install-recommends gettext build-essential autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev automake libmbedtls-dev libsodium-dev pkg-config\n## CentOS / Fedora / RHEL\nsudo yum install gettext gcc autoconf libtool automake make asciidoc xmlto c-ares-devel libev-devel\n## Arch\nsudo pacman -S gettext gcc autoconf libtool automake make asciidoc xmlto c-ares libev\n\n# Installation of libsodium\nexport LIBSODIUM_VER=1.0.16\nwget https://download.libsodium.org/libsodium/releases/old/libsodium-$LIBSODIUM_VER.tar.gz\ntar xvf libsodium-$LIBSODIUM_VER.tar.gz\npushd libsodium-$LIBSODIUM_VER\n./configure --prefix=/usr \u0026\u0026 make\nsudo make install\npopd\nsudo ldconfig\n\n# Installation of MbedTLS\nexport MBEDTLS_VER=2.6.0\nwget https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-$MBEDTLS_VER.tar.gz\ntar xvf mbedtls-$MBEDTLS_VER.tar.gz\npushd mbedtls-$MBEDTLS_VER\nmake SHARED=1 CFLAGS=\"-O2 -fPIC\"\nsudo make DESTDIR=/usr install\npopd\nsudo ldconfig\n\n# Start building\n./autogen.sh \u0026\u0026 ./configure \u0026\u0026 make\nsudo make install\n```\n\nYou may need to manually install missing softwares.\n\n### FreeBSD\n#### Install\nShadowsocks-libev is available in FreeBSD Ports Collection. You can install it in either way, `pkg` or `ports`.\n\n**pkg (recommended)**\n\n```bash\npkg install shadowsocks-libev\n```\n\n**ports**\n\n```bash\ncd /usr/ports/net/shadowsocks-libev\nmake install\n```\n\n#### Configuration\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\n#### Run\n\nStart the Shadowsocks server:\n\n```bash\nservice shadowsocks_libev start\n```\n\n#### Run as client\nBy default, shadowsocks-libev is running as a server in FreeBSD. If you would like to start shadowsocks-libev in client mode, you can modify the rc script (`/usr/local/etc/rc.d/shadowsocks_libev`) manually.\n\n```\n# modify the following line from \"ss-server\" to \"ss-local\"\ncommand=\"/usr/local/bin/ss-local\"\n```\n\nNote that is simply a workaround, each time you upgrade the port your changes will be overwritten by the new version.\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 (MinGW)\nTo build Windows native binaries, the recommended method is to use Docker:\n\n* On Windows: double-click `make.bat` in `docker\\mingw`\n* On Unix-like system:\n\n        cd shadowsocks-libev/docker/mingw\n        make\n\nA tarball with 32-bit and 64-bit binaries will be generated in the same directory.\n\nYou could also manually use MinGW-w64 compilers to build in Unix-like shell (MSYS2/Cygwin), or cross-compile on Unix-like systems (Linux/MacOS). Please refer to build scripts in `docker/mingw`.\n\nCurrently you need to use a patched libev library for MinGW:\n\n* https://github.com/shadowsocks/libev/archive/mingw.zip\n\nNotice that TCP Fast Open (TFO) is only available on **Windows 10**, **1607** or later version (precisely, build \u003e= 14393). If you are using **1709** (build 16299) or later version, you also need to run the following command in PowerShell/Command Prompt **as Administrator** and **reboot** to use TFO properly:\n\n        netsh int tcp set global fastopenfallback=disabled\n\n### Docker\n\nAs you expect, simply pull the image and run.\n```\ndocker pull shadowsocks/shadowsocks-libev\ndocker run -e PASSWORD=\u003cpassword\u003e -p\u003cserver-port\u003e:8388 -p\u003cserver-port\u003e:8388/udp -d shadowsocks/shadowsocks-libev\n```\n\nMore information about the image can be found [here](docker/alpine/README.md).\n\n## Usage\n\nFor a detailed and complete list of all supported arguments,\nyou may refer to the man pages of the applications, respectively.\n\n    ss-[local|redir|server|tunnel|manager]\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: rc4-md5,\n                                  aes-128-gcm, aes-192-gcm, aes-256-gcm,\n                                  aes-128-cfb, aes-192-cfb, aes-256-cfb,\n                                  aes-128-ctr, aes-192-ctr, aes-256-ctr,\n                                  camellia-128-cfb, camellia-192-cfb,\n                                  camellia-256-cfb, bf-cfb,\n                                  chacha20-ietf-poly1305,\n                                  xchacha20-ietf-poly1305,\n                                  salsa20, chacha20 and chacha20-ietf.\n                                  The default cipher is chacha20-ietf-poly1305.\n\n       [-a \u003cuser\u003e]                Run as another user.\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       [-n \u003cnumber\u003e]              Max number of open files.\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                                  For servers: Specify the local address to use \n                                  while this server is making outbound \n                                  connections to remote servers on behalf of the\n                                  clients.\n                                  For clients: Specify the local address to use \n                                  while this client is making outbound \n                                  connections to the server.\n\n       [-u]                       Enable UDP relay.\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       [-T]                       Use tproxy instead of redirect. (for tcp)\n                                  (only available in redir mode)\n\n       [-L \u003caddr\u003e:\u003cport\u003e]         Destination server address and port\n                                  for local port forwarding.\n                                  (only available in tunnel mode)\n\n       [-6]                       Resolve hostname to IPv6 address first.\n\n       [-d \u003caddr\u003e]                Name servers for internal DNS resolver.\n                                  (only available in server mode)\n\n       [--reuse-port]             Enable port reuse.\n\n       [--fast-open]              Enable TCP fast open.\n                                  with Linux kernel \u003e 3.7.0.\n                                  (only available in local and server mode)\n\n       [--acl \u003cacl_file\u003e]         Path to 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       [--mtu \u003cMTU\u003e]              MTU of your network interface.\n\n       [--mptcp]                  Enable Multipath TCP on MPTCP Kernel.\n\n       [--no-delay]               Enable TCP_NODELAY.\n\n       [--executable \u003cpath\u003e]      Path to the executable of ss-server.\n                                  (only available in manager mode)\n\n       [-D \u003cpath\u003e]                Path to the working directory of ss-manager.\n                                  (only available in manager mode)\n\n       [--key \u003ckey_in_base64\u003e]    Key of your remote server.\n\n       [--plugin \u003cname\u003e]          Enable SIP003 plugin. (Experimental)\n\n       [--plugin-opts \u003coptions\u003e]  Set SIP003 plugin options. (Experimental)\n\n       [-v]                       Verbose mode.\n\n## Transparent proxy\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, which is handy if you use an OpenWRT-powered router.\n\n    # Create new chain\n    iptables -t nat -N SHADOWSOCKS\n    iptables -t mangle -N SHADOWSOCKS\n\n    # Ignore your shadowsocks server's addresses\n    # It's very IMPORTANT, just be careful.\n    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    iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN\n    iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN\n    iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN\n    iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN\n    iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN\n    iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN\n    iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN\n    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    iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345\n\n    # Add any UDP rules\n    ip route add local default dev lo table 100\n    ip rule add fwmark 1 lookup 100\n    iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01\n\n    # Apply the rules\n    iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS\n    iptables -t mangle -A PREROUTING -j SHADOWSOCKS\n\n    # Start the shadowsocks-redir\n    ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid\n\n## Transparent proxy (pure tproxy)\n\nExecuting this script on the linux host can proxy all outgoing traffic of this machine (except the traffic sent to the reserved address). Other hosts under the same LAN can also change their default gateway to the ip of this linux host (at the same time change the dns server to 1.1.1.1 or 8.8.8.8, etc.) to proxy their outgoing traffic.\n\n\u003e Of course, the ipv6 proxy is similar, just change `iptables` to `ip6tables`, `ip` to `ip -6`, `127.0.0.1` to `::1`, and other details.\n\n```shell\n#!/bin/bash\n\nstart_ssredir() {\n    # please modify MyIP, MyPort, etc.\n    (ss-redir -s MyIP -p MyPort -m MyMethod -k MyPasswd -b 127.0.0.1 -l 60080 --no-delay -u -T -v \u003c/dev/null \u0026\u003e\u003e/var/log/ss-redir.log \u0026)\n}\n\nstop_ssredir() {\n    kill -9 $(pidof ss-redir) \u0026\u003e/dev/null\n}\n\nstart_iptables() {\n    ##################### SSREDIR #####################\n    iptables -t mangle -N SSREDIR\n\n    # connection-mark -\u003e packet-mark\n    iptables -t mangle -A SSREDIR -j CONNMARK --restore-mark\n    iptables -t mangle -A SSREDIR -m mark --mark 0x2333 -j RETURN\n\n    # please modify MyIP, MyPort, etc.\n    # ignore traffic sent to ss-server\n    iptables -t mangle -A SSREDIR -p tcp -d MyIP --dport MyPort -j RETURN\n    iptables -t mangle -A SSREDIR -p udp -d MyIP --dport MyPort -j RETURN\n\n    # ignore traffic sent to reserved addresses\n    iptables -t mangle -A SSREDIR -d 0.0.0.0/8          -j RETURN\n    iptables -t mangle -A SSREDIR -d 10.0.0.0/8         -j RETURN\n    iptables -t mangle -A SSREDIR -d 100.64.0.0/10      -j RETURN\n    iptables -t mangle -A SSREDIR -d 127.0.0.0/8        -j RETURN\n    iptables -t mangle -A SSREDIR -d 169.254.0.0/16     -j RETURN\n    iptables -t mangle -A SSREDIR -d 172.16.0.0/12      -j RETURN\n    iptables -t mangle -A SSREDIR -d 192.0.0.0/24       -j RETURN\n    iptables -t mangle -A SSREDIR -d 192.0.2.0/24       -j RETURN\n    iptables -t mangle -A SSREDIR -d 192.88.99.0/24     -j RETURN\n    iptables -t mangle -A SSREDIR -d 192.168.0.0/16     -j RETURN\n    iptables -t mangle -A SSREDIR -d 198.18.0.0/15      -j RETURN\n    iptables -t mangle -A SSREDIR -d 198.51.100.0/24    -j RETURN\n    iptables -t mangle -A SSREDIR -d 203.0.113.0/24     -j RETURN\n    iptables -t mangle -A SSREDIR -d 224.0.0.0/4        -j RETURN\n    iptables -t mangle -A SSREDIR -d 240.0.0.0/4        -j RETURN\n    iptables -t mangle -A SSREDIR -d 255.255.255.255/32 -j RETURN\n\n    # mark the first packet of the connection\n    iptables -t mangle -A SSREDIR -p tcp --syn                      -j MARK --set-mark 0x2333\n    iptables -t mangle -A SSREDIR -p udp -m conntrack --ctstate NEW -j MARK --set-mark 0x2333\n\n    # packet-mark -\u003e connection-mark\n    iptables -t mangle -A SSREDIR -j CONNMARK --save-mark\n\n    ##################### OUTPUT #####################\n    # proxy the outgoing traffic from this machine\n    iptables -t mangle -A OUTPUT -p tcp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR\n    iptables -t mangle -A OUTPUT -p udp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR\n\n    ##################### PREROUTING #####################\n    # proxy traffic passing through this machine (other-\u003eother)\n    iptables -t mangle -A PREROUTING -p tcp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR\n    iptables -t mangle -A PREROUTING -p udp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR\n\n    # hand over the marked package to TPROXY for processing\n    iptables -t mangle -A PREROUTING -p tcp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080\n    iptables -t mangle -A PREROUTING -p udp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080\n}\n\nstop_iptables() {\n    ##################### PREROUTING #####################\n    iptables -t mangle -D PREROUTING -p tcp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080 \u0026\u003e/dev/null\n    iptables -t mangle -D PREROUTING -p udp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080 \u0026\u003e/dev/null\n\n    iptables -t mangle -D PREROUTING -p tcp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR \u0026\u003e/dev/null\n    iptables -t mangle -D PREROUTING -p udp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR \u0026\u003e/dev/null\n\n    ##################### OUTPUT #####################\n    iptables -t mangle -D OUTPUT -p tcp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR \u0026\u003e/dev/null\n    iptables -t mangle -D OUTPUT -p udp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR \u0026\u003e/dev/null\n\n    ##################### SSREDIR #####################\n    iptables -t mangle -F SSREDIR \u0026\u003e/dev/null\n    iptables -t mangle -X SSREDIR \u0026\u003e/dev/null\n}\n\nstart_iproute2() {\n    ip route add local default dev lo table 100\n    ip rule  add fwmark 0x2333        table 100\n}\n\nstop_iproute2() {\n    ip rule  del   table 100 \u0026\u003e/dev/null\n    ip route flush table 100 \u0026\u003e/dev/null\n}\n\nstart_resolvconf() {\n    # or nameserver 8.8.8.8, etc.\n    echo \"nameserver 1.1.1.1\" \u003e/etc/resolv.conf\n}\n\nstop_resolvconf() {\n    echo \"nameserver 114.114.114.114\" \u003e/etc/resolv.conf\n}\n\nstart() {\n    echo \"start ...\"\n    start_ssredir\n    start_iptables\n    start_iproute2\n    start_resolvconf\n    echo \"start end\"\n}\n\nstop() {\n    echo \"stop ...\"\n    stop_resolvconf\n    stop_iproute2\n    stop_iptables\n    stop_ssredir\n    echo \"stop end\"\n}\n\nrestart() {\n    stop\n    sleep 1\n    start\n}\n\nmain() {\n    if [ $# -eq 0 ]; then\n        echo \"usage: $0 start|stop|restart ...\"\n        return 1\n    fi\n\n    for funcname in \"$@\"; do\n        if [ \"$(type -t $funcname)\" != 'function' ]; then\n            echo \"'$funcname' not a shell function\"\n            return 1\n        fi\n    done\n\n    for funcname in \"$@\"; do\n        $funcname\n    done\n    return 0\n}\nmain \"$@\"\n```\n\n## Security Tips\n\nFor any public server, to avoid users accessing localhost of your server, please add `--acl acl/server_block_local.acl` to the command line.\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\n```\nCopyright: 2013-2015, Clow Windy \u003cclowwindy42@gmail.com\u003e\n           2013-2018, Max Lv \u003cmax.c.lv@gmail.com\u003e\n           2014, Linus Yang \u003clinusyang@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```\n","funding_links":["https://crowdfunding.lfx.linuxfoundation.org/projects/shadowsocks"],"categories":["C","Uncategorized","\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具","HarmonyOS","\u003ca id=\"1a9934198e37d6d06b881705b863afc8\"\u003e\u003c/a\u003e通信\u0026\u0026代理\u0026\u0026反向代理\u0026\u0026隧道"],"sub_categories":["Uncategorized","\u003ca id=\"cb16466a31a167bb61f39e2a4a85f449\"\u003e\u003c/a\u003eShadowsocks","Windows Manager","\u003ca id=\"f932418b594acb6facfc35c1ec414188\"\u003e\u003c/a\u003eSocks\u0026\u0026ShadowSocksXx"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowsocks%2Fshadowsocks-libev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowsocks%2Fshadowsocks-libev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowsocks%2Fshadowsocks-libev/lists"}