master 8ad3036f29c7 cached
187 files
1.4 MB
472.4k tokens
553 symbols
1 requests
Download .txt
Showing preview only (1,486K chars total). Download the full file or copy to clipboard to get everything.
Repository: shadowsocks/shadowsocks-libev
Branch: master
Commit: 8ad3036f29c7
Files: 187
Total size: 1.4 MB

Directory structure:
gitextract_w3iy52_5/

├── .copr/
│   └── Makefile
├── .dockerignore
├── .github/
│   ├── FUNDING.yml
│   ├── dependabot.yml
│   ├── issue_template.md
│   └── workflows/
│       └── build.yml
├── .gitignore
├── .gitmodules
├── .travis.yml
├── .uncrustify.cfg
├── AUTHORS
├── CLAUDE.md
├── CMakeLists.txt
├── COPYING
├── Changes
├── LICENSE
├── README.md
├── README_pt_BR.md
├── acl/
│   ├── chn.acl
│   ├── gfwlist.acl
│   ├── local.acl
│   ├── server_block_chn.acl
│   └── server_block_local.acl
├── cmake/
│   ├── FindCares.cmake
│   ├── FindMbedTLS.cmake
│   ├── FindPCRE2.cmake
│   ├── FindSodium.cmake
│   ├── config.h.cmake
│   ├── configure.cmake
│   └── shadowsocks-libev.pc.cmake
├── completions/
│   ├── bash/
│   │   ├── ss-local
│   │   ├── ss-manager
│   │   ├── ss-redir
│   │   ├── ss-server
│   │   └── ss-tunnel
│   └── zsh/
│       ├── _ss-local
│       ├── _ss-manager
│       ├── _ss-redir
│       ├── _ss-server
│       └── _ss-tunnel
├── debian/
│   ├── .gitignore
│   ├── README.Debian
│   ├── changelog
│   ├── compat
│   ├── config.json
│   ├── control
│   ├── copyright
│   ├── copyright.original
│   ├── libshadowsocks-libev-dev.install
│   ├── libshadowsocks-libev2.install
│   ├── rules
│   ├── shadowsocks-libev-local@.service
│   ├── shadowsocks-libev-redir@.service
│   ├── shadowsocks-libev-server@.service
│   ├── shadowsocks-libev-tunnel@.service
│   ├── shadowsocks-libev.NEWS
│   ├── shadowsocks-libev.default
│   ├── shadowsocks-libev.doc-base
│   ├── shadowsocks-libev.docs
│   ├── shadowsocks-libev.init
│   ├── shadowsocks-libev.install
│   ├── shadowsocks-libev.lintian-overrides
│   ├── shadowsocks-libev.postinst
│   ├── shadowsocks-libev.postrm
│   ├── shadowsocks-libev.service
│   ├── source/
│   │   └── format
│   ├── tests/
│   │   └── control
│   ├── upstream/
│   │   └── metadata
│   └── watch
├── doc/
│   ├── CMakeLists.txt
│   ├── asciidoc.conf
│   ├── manpage-base.xsl
│   ├── manpage-bold-literal.xsl
│   ├── manpage-normal.xsl
│   ├── shadowsocks-libev.asciidoc
│   ├── ss-local.asciidoc
│   ├── ss-manager.asciidoc
│   ├── ss-nat.asciidoc
│   ├── ss-redir.asciidoc
│   ├── ss-server.asciidoc
│   └── ss-tunnel.asciidoc
├── docker/
│   ├── alpine/
│   │   ├── Dockerfile
│   │   ├── README.md
│   │   ├── docker-compose.yml
│   │   └── entrypoint.sh
│   └── mingw/
│       ├── Dockerfile
│       ├── Makefile
│       ├── apt.sh
│       ├── build.sh
│       ├── deps.sh
│       ├── make.bat
│       └── prepare.sh
├── rpm/
│   ├── SOURCES/
│   │   ├── etc/
│   │   │   └── init.d/
│   │   │       └── shadowsocks-libev
│   │   └── systemd/
│   │       ├── shadowsocks-libev-local.service
│   │       ├── shadowsocks-libev-local@.service
│   │       ├── shadowsocks-libev-redir@.service
│   │       ├── shadowsocks-libev-server@.service
│   │       ├── shadowsocks-libev-tunnel@.service
│   │       ├── shadowsocks-libev.default
│   │       └── shadowsocks-libev.service
│   ├── SPECS/
│   │   └── shadowsocks-libev.spec.in
│   └── genrpm.sh
├── scripts/
│   ├── build_deb.sh
│   ├── chroot_build.sh
│   ├── code-format.bat
│   ├── code-format.sh
│   ├── git_archive.sh
│   ├── git_version.sh
│   ├── iperf.sh
│   └── ss-setup.sh
├── snap/
│   └── snapcraft.yaml
├── src/
│   ├── CMakeLists.txt
│   ├── acl.c
│   ├── acl.h
│   ├── aead.c
│   ├── aead.h
│   ├── android.c
│   ├── base64.c
│   ├── base64.h
│   ├── cache.c
│   ├── cache.h
│   ├── common.h
│   ├── crypto.c
│   ├── crypto.h
│   ├── jconf.c
│   ├── jconf.h
│   ├── json.c
│   ├── json.h
│   ├── local.c
│   ├── local.h
│   ├── manager.c
│   ├── manager.h
│   ├── netutils.c
│   ├── netutils.h
│   ├── plugin.c
│   ├── plugin.h
│   ├── ppbloom.c
│   ├── ppbloom.h
│   ├── redir.c
│   ├── redir.h
│   ├── resolv.c
│   ├── resolv.h
│   ├── rule.c
│   ├── rule.h
│   ├── server.c
│   ├── server.h
│   ├── shadowsocks.h
│   ├── socks5.h
│   ├── ss-nat
│   ├── stream.c
│   ├── stream.h
│   ├── tunnel.c
│   ├── tunnel.h
│   ├── udprelay.c
│   ├── udprelay.h
│   ├── uthash.h
│   ├── utils.c
│   ├── utils.h
│   ├── winsock.c
│   └── winsock.h
└── tests/
    ├── CMakeLists.txt
    ├── aes-ctr.json
    ├── aes-gcm.json
    ├── aes.json
    ├── chacha20-ietf-poly1305.json
    ├── chacha20-ietf.json
    ├── chacha20.json
    ├── qemu/
    │   └── guest-init.sh
    ├── rc4-md5.json
    ├── redir.json
    ├── salsa20.json
    ├── stress_test.py
    ├── test.py
    ├── test.sh
    ├── test_base64.c
    ├── test_buffer.c
    ├── test_cache.c
    ├── test_crypto.c
    ├── test_deb_build.sh
    ├── test_jconf.c
    ├── test_json.c
    ├── test_netutils.c
    ├── test_ppbloom.c
    ├── test_redir_qemu.sh
    ├── test_rule.c
    ├── test_ss_setup.sh
    └── test_utils.c

================================================
FILE CONTENTS
================================================

================================================
FILE: .copr/Makefile
================================================
.PHONY: deps srpm
.DEFAULT_GOAL := srpm

DOT_COPR := $(dir $(firstword $(MAKEFILE_LIST)))
TOP_DIR := $(realpath $(DOT_COPR)/../)

RPM_DIR := $(TOP_DIR)/rpm
outdir ?= $(RPM_DIR)/SRPMS

HAS_GIT := $(shell command -v git 2> /dev/null)
ifndef HAS_GIT
deps:
	dnf -y install git
else
deps:
endif

srpm: deps
	git config --global --add safe.directory $(TOP_DIR)
	git config --global --add safe.directory $(TOP_DIR)/libbloom
	git config --global --add safe.directory $(TOP_DIR)/libcork
	git config --global --add safe.directory $(TOP_DIR)/libipset
	$(RPM_DIR)/genrpm.sh -o $(outdir)


================================================
FILE: .dockerignore
================================================
# General
.dockerignore
.git
.gitmodules
.gitignore
.github
AUTHORS
Changes
COPYING
INSTALL
LICENSE
README.md

# Code formatting
.uncrustify.cfg
code-format.bat
code-format.sh

# CI & CD
.travis.yml
tests

# OS-specific packaging, etc.
debian
scripts/build_deb.sh
rpm
completions


================================================
FILE: .github/FUNDING.yml
================================================
custom: ['https://crowdfunding.lfx.linuxfoundation.org/projects/shadowsocks']


================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "daily"

================================================
FILE: .github/issue_template.md
================================================
Please answer these questions before submitting your issue. Thanks!

(Please mention that if the issue you filed is solved, you may wish to close it by yourself. Thanks again.)

(PS, you can remove 3 lines above, including this one, before post your issue.)

### What version of shadowsocks-libev are you using?


### What operating system are you using?


### What did you do?


### What did you expect to see?


### What did you see instead?


### What is your config in detail (with all sensitive info masked)?


================================================
FILE: .github/workflows/build.yml
================================================
name: build

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive

      - name: Install dependencies (Linux)
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update
          sudo apt-get install -y libpcre2-dev libmbedtls-dev libsodium-dev libev-dev libc-ares-dev

      - name: Install dependencies (macOS)
        if: runner.os == 'macOS'
        run: brew install mbedtls@3 libsodium libev c-ares pcre2

      - name: Build
        run: |
          mkdir -p build && cd build
          cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_STATIC=OFF
          make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)

      - name: Unit tests
        run: |
          cd build
          ctest --output-on-failure

      - name: ss-setup TUI tests
        run: bash tests/test_ss_setup.sh

      - name: Stress test
        run: |
          python3 tests/stress_test.py --bin build/shared/bin/ --size 10

      - name: ss-redir transparent proxy test (QEMU)
        if: runner.os == 'Linux'
        run: |
          sudo apt-get install -y qemu-system-x86
          bash tests/test_redir_qemu.sh build/shared/bin/
        timeout-minutes: 8

      - name: Debian package build test
        if: runner.os == 'Linux'
        run: |
          sudo apt-get install -y --no-install-recommends \
            build-essential debhelper dpkg-dev fakeroot asciidoc-base xmlto pkg-config
          bash tests/test_deb_build.sh
        timeout-minutes: 10


================================================
FILE: .gitignore
================================================
# Ignore files generated by autoconf
/Makefile.in
/aclocal.m4
/auto/
/config.h.in
/configure
/doc/Makefile.in
/m4/libtool.m4
/m4/ltoptions.m4
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
/src/Makefile.in
/src/config.h

# Ignore files generated by configure
build/
.deps/
/Makefile
src/Makefile
libev/Makefile
libudns/Makefile
libcork/Makefile
libipset/Makefile
doc/Makefile
autom4te.cache/
/config.h
config.log
config.status
libtool
pid
src/ss-*
!src/ss-nat
stamp-h1
.libs
.pc
debian/shadowsocks-libev/
debian/patches/
debian/files
debian/shadowsocks-libev.substvars
debian/*.debhelper*
.dirstamp
shadowsocks-libev.pc
debian/libshadowsocks-libev*.symbols
libsodium/src/libsodium/include/sodium/version.h
rpm/SPECS/shadowsocks-libev.spec
rpm/SRPMS/
rpm/RPMS/
rpm/BUILD/
rpm/BUILDROOT/
*.rpm
*.deb

# Ignore per-project vim config
.vimrc

# Ignore garbage of OS X
*.DS_Store

# Ignore vim cache
*.swp

# Documentation files
doc/*.1
doc/*.8
doc/*.gz
doc/*.xml
doc/*.html

#	Do not edit the following section
# 	Edit Compile Debug Document Distribute
*~
*.bak
*.bin
*.dll
*.exe
*-ISO*.bdf
*-JIS*.bdf
*-KOI8*.bdf
*.kld
*.ko
*.ko.cmd
*.lai
*.l[oa]
*.[oa]
*.obj
*.patch
*.so
*.pcf.gz
*.pdb
*.tar
*.tar.bz2
*.tar.gz
*.tgz
*.snap
#

# Visual Studio Code
.vscode/*
.devcontainer/*

# CMake objection
obj-*


================================================
FILE: .gitmodules
================================================
[submodule "libcork"]
	path = libcork
	url = https://github.com/shadowsocks/libcork.git
    ignore = dirty
[submodule "libipset"]
	path = libipset
	url = https://github.com/shadowsocks/ipset.git
    ignore = dirty
[submodule "libbloom"]
	path = libbloom
	url = https://github.com/shadowsocks/libbloom.git
    ignore = dirty


================================================
FILE: .travis.yml
================================================
sudo: required
language: c
dist : trusty
compiler:
    - clang
    - gcc
os:
    - linux
    - osx
env:
    global:
        - LIBSODIUM_VER=1.0.12
        - MBEDTLS_VER=2.4.0
before_install:
    - |
      if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
          # All dependencies for macOS build. Some packages has been installed by travis so use reinstall.
          brew reinstall cmake xmlto c-ares libev mbedtls libsodium asciidoc >> /dev/null 2>&1;
      else
          wget  https://github.com/jedisct1/libsodium/releases/download/$LIBSODIUM_VER/libsodium-$LIBSODIUM_VER.tar.gz;
          tar xvf libsodium-$LIBSODIUM_VER.tar.gz;
          pushd libsodium-$LIBSODIUM_VER;
          ./configure --prefix=/usr && make;
          sudo make install;
          popd;
          wget https://tls.mbed.org/download/mbedtls-$MBEDTLS_VER-gpl.tgz;
          tar xvf mbedtls-$MBEDTLS_VER-gpl.tgz;
          pushd mbedtls-$MBEDTLS_VER;
          make SHARED=1;
          sudo make install;
          popd;
          # Load cached docker images
          if [[ -d $HOME/docker ]]; then
              ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load";
          fi
      fi
addons:
    apt:
        sources:
            - george-edison55-precise-backports # cmake 3.2.3 / doxygen 1.8.3
        packages:
            - cmake
            - libc-ares-dev
            - libev-dev
            - asciidoc
            - xmlto
script:
    - git submodule update --init --recursive
    - mkdir -p build && cd build
    - cmake ..
    - make
    - ctest --output-on-failure
branches:
    only:
        - master
notifications:
    recipients:
        - max.c.lv@gmail.com
    email:
        on_success: change
        on_failure: always


================================================
FILE: .uncrustify.cfg
================================================
#
# General options
#

# The type of line endings
newlines                                 = lf       # auto/lf/crlf/cr

# The original size of tabs in the input
input_tab_size                           = 8        # number

# The size of tabs in the output (only used if align_with_tabs=true)
output_tab_size                          = 8        # number

# The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn)
string_escape_char                       = 92       # number

# Alternate string escape char for Pawn. Only works right before the quote char.
string_escape_char2                      = 0        # number

#
# Indenting
#

# The number of columns to indent per level.
# Usually 2, 3, 4, or 8.
indent_columns                           = 4        # number

# The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents.
# For FreeBSD, this is set to 4.
indent_continue                          = 0        # number

# How to use tabs when indenting code
# 0=spaces only
# 1=indent with tabs to brace level, align with spaces
# 2=indent and align with tabs, using spaces when not on a tabstop
indent_with_tabs                         = 0        # number

# Comments that are not a brace level are indented with tabs on a tabstop.
# Requires indent_with_tabs=2. If false, will use spaces.
indent_cmt_with_tabs                     = false    # false/true

# Whether to indent strings broken by '\' so that they line up
indent_align_string                      = true     # false/true

# The number of spaces to indent multi-line XML strings.
# Requires indent_align_string=True
indent_xml_string                        = 0        # number

# Spaces to indent '{' from level
indent_brace                             = 0        # number

# Whether braces are indented to the body level
indent_braces                            = false    # false/true

# Disabled indenting function braces if indent_braces is true
indent_braces_no_func                    = false    # false/true

# Disabled indenting class braces if indent_braces is true
indent_braces_no_class                   = false    # false/true

# Disabled indenting struct braces if indent_braces is true
indent_braces_no_struct                  = false    # false/true

# Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc.
indent_brace_parent                      = false    # false/true

# Whether the 'namespace' body is indented
indent_namespace                         = false    # false/true

# The number of spaces to indent a namespace block
indent_namespace_level                   = 0        # number

# If the body of the namespace is longer than this number, it won't be indented.
# Requires indent_namespace=true. Default=0 (no limit)
indent_namespace_limit                   = 0        # number

# Whether the 'extern "C"' body is indented
indent_extern                            = false    # false/true

# Whether the 'class' body is indented
indent_class                             = false    # false/true

# Whether to indent the stuff after a leading class colon
indent_class_colon                       = false    # false/true

# False=treat 'else\nif' as 'else if' for indenting purposes
# True=indent the 'if' one level
indent_else_if                           = false    # false/true

# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute
indent_var_def_blk                       = 0        # number

# Indent continued variable declarations instead of aligning.
indent_var_def_cont                      = false    # false/true

# True:  indent continued function call parameters one indent level
# False: align parameters under the open paren
indent_func_call_param                   = false    # false/true

# Same as indent_func_call_param, but for function defs
indent_func_def_param                    = false    # false/true

# Same as indent_func_call_param, but for function protos
indent_func_proto_param                  = false    # false/true

# Same as indent_func_call_param, but for class declarations
indent_func_class_param                  = false    # false/true

# Same as indent_func_call_param, but for class variable constructors
indent_func_ctor_var_param               = false    # false/true

# Same as indent_func_call_param, but for templates
indent_template_param                    = false    # false/true

# Double the indent for indent_func_xxx_param options
indent_func_param_double                 = false    # false/true

# Indentation column for standalone 'const' function decl/proto qualifier
indent_func_const                        = 0        # number

# Indentation column for standalone 'throw' function decl/proto qualifier
indent_func_throw                        = 0        # number

# The number of spaces to indent a continued '->' or '.'
# Usually set to 0, 1, or indent_columns.
indent_member                            = 0        # number

# Spaces to indent single line ('//') comments on lines before code
indent_sing_line_comments                = 0        # number

# If set, will indent trailing single line ('//') comments relative
# to the code instead of trying to keep the same absolute column
indent_relative_single_line_comments     = false    # false/true

# Spaces to indent 'case' from 'switch'
# Usually 0 or indent_columns.
indent_switch_case                       = 0        # number

# Spaces to shift the 'case' line, without affecting any other lines
# Usually 0.
indent_case_shift                        = 0        # number

# Spaces to indent '{' from 'case'.
# By default, the brace will appear under the 'c' in case.
# Usually set to 0 or indent_columns.
indent_case_brace                        = 0        # number

# Whether to indent comments found in first column
indent_col1_comment                      = false    # false/true

# How to indent goto labels
#  >0 : absolute column where 1 is the leftmost column
#  <=0 : subtract from brace indent
indent_label                             = 1        # number

# Same as indent_label, but for access specifiers that are followed by a colon
indent_access_spec                       = 1        # number

# Indent the code after an access specifier by one level.
# If set, this option forces 'indent_access_spec=0'
indent_access_spec_body                  = false    # false/true

# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended)
indent_paren_nl                          = false    # false/true

# Controls the indent of a close paren after a newline.
# 0: Indent to body level
# 1: Align under the open paren
# 2: Indent to the brace level
indent_paren_close                       = 0        # number

# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren
indent_comma_paren                       = false    # false/true

# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren
indent_bool_paren                        = false    # false/true

# If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones
indent_first_bool_expr                   = false    # false/true

# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended)
indent_square_nl                         = false    # false/true

# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies
indent_preserve_sql                      = false    # false/true

# Align continued statements at the '='. Default=True
# If FALSE or the '=' is followed by a newline, the next line is indent one tab.
indent_align_assign                      = true     # false/true

#
# Spacing options
#

# Add or remove space around arithmetic operator '+', '-', '/', '*', etc
sp_arith                                 = force    # ignore/add/remove/force

# Add or remove space around assignment operator '=', '+=', etc
sp_assign                                = force    # ignore/add/remove/force

# Add or remove space around assignment operator '=' in a prototype
sp_assign_default                        = ignore   # ignore/add/remove/force

# Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign.
sp_before_assign                         = ignore   # ignore/add/remove/force

# Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign.
sp_after_assign                          = ignore   # ignore/add/remove/force

# Add or remove space around assignment '=' in enum
sp_enum_assign                           = force    # ignore/add/remove/force

# Add or remove space before assignment '=' in enum. Overrides sp_enum_assign.
sp_enum_before_assign                    = ignore   # ignore/add/remove/force

# Add or remove space after assignment '=' in enum. Overrides sp_enum_assign.
sp_enum_after_assign                     = ignore   # ignore/add/remove/force

# Add or remove space around preprocessor '##' concatenation operator. Default=Add
sp_pp_concat                             = add      # ignore/add/remove/force

# Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add
sp_pp_stringify                          = add      # ignore/add/remove/force

# Add or remove space around boolean operators '&&' and '||'
sp_bool                                  = force    # ignore/add/remove/force

# Add or remove space around compare operator '<', '>', '==', etc
sp_compare                               = force    # ignore/add/remove/force

# Add or remove space inside '(' and ')'
sp_inside_paren                          = remove   # ignore/add/remove/force

# Add or remove space between nested parens
sp_paren_paren                           = remove   # ignore/add/remove/force

# Whether to balance spaces inside nested parens
sp_balance_nested_parens                 = false    # false/true

# Add or remove space between ')' and '{'
sp_paren_brace                           = force    # ignore/add/remove/force

# Add or remove space before pointer star '*'
sp_before_ptr_star                       = add      # ignore/add/remove/force

# Add or remove space before pointer star '*' that isn't followed by a variable name
# If set to 'ignore', sp_before_ptr_star is used instead.
sp_before_unnamed_ptr_star               = add      # ignore/add/remove/force

# Add or remove space between pointer stars '*'
sp_between_ptr_star                      = remove   # ignore/add/remove/force

# Add or remove space after pointer star '*', if followed by a word.
sp_after_ptr_star                        = remove   # ignore/add/remove/force

# Add or remove space after a pointer star '*', if followed by a func proto/def.
sp_after_ptr_star_func                   = remove   # ignore/add/remove/force

# Add or remove space before a pointer star '*', if followed by a func proto/def.
sp_before_ptr_star_func                  = ignore   # ignore/add/remove/force

# Add or remove space before a reference sign '&'
sp_before_byref                          = force    # ignore/add/remove/force

# Add or remove space before a reference sign '&' that isn't followed by a variable name
# If set to 'ignore', sp_before_byref is used instead.
sp_before_unnamed_byref                  = force    # ignore/add/remove/force

# Add or remove space after reference sign '&', if followed by a word.
sp_after_byref                           = ignore   # ignore/add/remove/force

# Add or remove space after a reference sign '&', if followed by a func proto/def.
sp_after_byref_func                      = ignore   # ignore/add/remove/force

# Add or remove space before a reference sign '&', if followed by a func proto/def.
sp_before_byref_func                     = ignore   # ignore/add/remove/force

# Add or remove space between type and word. Default=Force
sp_after_type                            = force    # ignore/add/remove/force

# Add or remove space in 'template <' vs 'template<'.
# If set to ignore, sp_before_angle is used.
sp_template_angle                        = ignore   # ignore/add/remove/force

# Add or remove space before '<>'
sp_before_angle                          = ignore   # ignore/add/remove/force

# Add or remove space inside '<' and '>'
sp_inside_angle                          = ignore   # ignore/add/remove/force

# Add or remove space after '<>'
sp_after_angle                           = ignore   # ignore/add/remove/force

# Add or remove space between '<>' and '(' as found in 'new List<byte>();'
sp_angle_paren                           = ignore   # ignore/add/remove/force

# Add or remove space between '<>' and a word as in 'List<byte> m;'
sp_angle_word                            = ignore   # ignore/add/remove/force

# Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add
sp_angle_shift                           = add      # ignore/add/remove/force

# Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
sp_before_sparen                         = force    # ignore/add/remove/force

# Add or remove space inside if-condition '(' and ')'
sp_inside_sparen                         = remove   # ignore/add/remove/force

# Add or remove space before if-condition ')'. Overrides sp_inside_sparen.
sp_inside_sparen_close                   = ignore   # ignore/add/remove/force

# Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
sp_after_sparen                          = ignore   # ignore/add/remove/force

# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while'
sp_sparen_brace                          = force    # ignore/add/remove/force

# Add or remove space between 'invariant' and '(' in the D language.
sp_invariant_paren                       = ignore   # ignore/add/remove/force

# Add or remove space after the ')' in 'invariant (C) c' in the D language.
sp_after_invariant_paren                 = ignore   # ignore/add/remove/force

# Add or remove space before empty statement ';' on 'if', 'for' and 'while'
sp_special_semi                          = ignore   # ignore/add/remove/force

# Add or remove space before ';'. Default=Remove
sp_before_semi                           = remove   # ignore/add/remove/force

# Add or remove space before ';' in non-empty 'for' statements
sp_before_semi_for                       = ignore   # ignore/add/remove/force

# Add or remove space before a semicolon of an empty part of a for statement.
sp_before_semi_for_empty                 = ignore   # ignore/add/remove/force

# Add or remove space after ';', except when followed by a comment. Default=Add
sp_after_semi                            = force    # ignore/add/remove/force

# Add or remove space after ';' in non-empty 'for' statements. Default=Force
sp_after_semi_for                        = force    # ignore/add/remove/force

# Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; <here> ).
sp_after_semi_for_empty                  = remove   # ignore/add/remove/force

# Add or remove space before '[' (except '[]')
sp_before_square                         = remove   # ignore/add/remove/force

# Add or remove space before '[]'
sp_before_squares                        = ignore   # ignore/add/remove/force

# Add or remove space inside '[' and ']'
sp_inside_square                         = remove   # ignore/add/remove/force

# Add or remove space after ','
sp_after_comma                           = force    # ignore/add/remove/force

# Add or remove space before ','
sp_before_comma                          = remove   # ignore/add/remove/force

# Add or remove space between an open paren and comma: '(,' vs '( ,'
sp_paren_comma                           = force    # ignore/add/remove/force

# Add or remove space before the variadic '...' when preceded by a non-punctuator
sp_before_ellipsis                       = ignore   # ignore/add/remove/force

# Add or remove space after class ':'
sp_after_class_colon                     = ignore   # ignore/add/remove/force

# Add or remove space before class ':'
sp_before_class_colon                    = ignore   # ignore/add/remove/force

# Add or remove space before case ':'. Default=Remove
sp_before_case_colon                     = remove   # ignore/add/remove/force

# Add or remove space between 'operator' and operator sign
sp_after_operator                        = ignore   # ignore/add/remove/force

# Add or remove space between the operator symbol and the open paren, as in 'operator ++('
sp_after_operator_sym                    = ignore   # ignore/add/remove/force

# Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'
sp_after_cast                            = remove      # ignore/add/remove/force

# Add or remove spaces inside cast parens
sp_inside_paren_cast                     = remove   # ignore/add/remove/force

# Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)'
sp_cpp_cast_paren                        = ignore   # ignore/add/remove/force

# Add or remove space between 'sizeof' and '('
sp_sizeof_paren                          = remove   # ignore/add/remove/force

# Add or remove space after the tag keyword (Pawn)
sp_after_tag                             = ignore   # ignore/add/remove/force

# Add or remove space inside enum '{' and '}'
sp_inside_braces_enum                    = remove   # ignore/add/remove/force

# Add or remove space inside struct/union '{' and '}'
sp_inside_braces_struct                  = force    # ignore/add/remove/force

# Add or remove space inside '{' and '}'
sp_inside_braces                         = force    # ignore/add/remove/force

# Add or remove space inside '{}'
sp_inside_braces_empty                   = remove   # ignore/add/remove/force

# Add or remove space between return type and function name
# A minimum of 1 is forced except for pointer return types.
sp_type_func                             = remove   # ignore/add/remove/force

# Add or remove space between function name and '(' on function declaration
sp_func_proto_paren                      = remove   # ignore/add/remove/force

# Add or remove space between function name and '(' on function definition
sp_func_def_paren                        = remove   # ignore/add/remove/force

# Add or remove space inside empty function '()'
sp_inside_fparens                        = remove   # ignore/add/remove/force

# Add or remove space inside function '(' and ')'
sp_inside_fparen                         = remove   # ignore/add/remove/force

# Add or remove space between ']' and '(' when part of a function call.
sp_square_fparen                         = ignore   # ignore/add/remove/force

# Add or remove space between ')' and '{' of function
sp_fparen_brace                          = ignore   # ignore/add/remove/force

# Add or remove space between function name and '(' on function calls
sp_func_call_paren                       = remove   # ignore/add/remove/force

# Add or remove space between function name and '()' on function calls without parameters.
# If set to 'ignore' (the default), sp_func_call_paren is used.
sp_func_call_paren_empty                 = ignore   # ignore/add/remove/force

# Add or remove space between the user function name and '(' on function calls
# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file.
sp_func_call_user_paren                  = ignore   # ignore/add/remove/force

# Add or remove space between a constructor/destructor and the open paren
sp_func_class_paren                      = ignore   # ignore/add/remove/force

# Add or remove space between 'return' and '('
sp_return_paren                          = ignore   # ignore/add/remove/force

# Add or remove space between '__attribute__' and '('
sp_attribute_paren                       = remove   # ignore/add/remove/force

# Add or remove space between 'defined' and '(' in '#if defined (FOO)'
sp_defined_paren                         = ignore   # ignore/add/remove/force

# Add or remove space between 'throw' and '(' in 'throw (something)'
sp_throw_paren                           = ignore   # ignore/add/remove/force

# Add or remove space between macro and value
sp_macro                                 = ignore   # ignore/add/remove/force

# Add or remove space between macro function ')' and value
sp_macro_func                            = ignore   # ignore/add/remove/force

# Add or remove space between 'else' and '{' if on the same line
sp_else_brace                            = force    # ignore/add/remove/force

# Add or remove space between '}' and 'else' if on the same line
sp_brace_else                            = force    # ignore/add/remove/force

# Add or remove space between '}' and the name of a typedef on the same line
sp_brace_typedef                         = force    # ignore/add/remove/force

# Add or remove space between 'catch' and '{' if on the same line
sp_catch_brace                           = ignore   # ignore/add/remove/force

# Add or remove space between '}' and 'catch' if on the same line
sp_brace_catch                           = ignore   # ignore/add/remove/force

# Add or remove space between 'finally' and '{' if on the same line
sp_finally_brace                         = ignore   # ignore/add/remove/force

# Add or remove space between '}' and 'finally' if on the same line
sp_brace_finally                         = ignore   # ignore/add/remove/force

# Add or remove space between 'try' and '{' if on the same line
sp_try_brace                             = ignore   # ignore/add/remove/force

# Add or remove space between get/set and '{' if on the same line
sp_getset_brace                          = ignore   # ignore/add/remove/force

# Add or remove space before the '::' operator
sp_before_dc                             = ignore   # ignore/add/remove/force

# Add or remove space after the '::' operator
sp_after_dc                              = ignore   # ignore/add/remove/force

# Add or remove around the D named array initializer ':' operator
sp_d_array_colon                         = ignore   # ignore/add/remove/force

# Add or remove space after the '!' (not) operator. Default=Remove
sp_not                                   = remove   # ignore/add/remove/force

# Add or remove space after the '~' (invert) operator. Default=Remove
sp_inv                                   = remove   # ignore/add/remove/force

# Add or remove space after the '&' (address-of) operator. Default=Remove
# This does not affect the spacing after a '&' that is part of a type.
sp_addr                                  = remove   # ignore/add/remove/force

# Add or remove space around the '.' or '->' operators. Default=Remove
sp_member                                = remove   # ignore/add/remove/force

# Add or remove space after the '*' (dereference) operator. Default=Remove
# This does not affect the spacing after a '*' that is part of a type.
sp_deref                                 = remove   # ignore/add/remove/force

# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove
sp_sign                                  = remove   # ignore/add/remove/force

# Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove
sp_incdec                                = remove   # ignore/add/remove/force

# Add or remove space before a backslash-newline at the end of a line. Default=Add
sp_before_nl_cont                        = add      # ignore/add/remove/force

# Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;'
sp_after_oc_scope                        = ignore   # ignore/add/remove/force

# Add or remove space after the colon in message specs
# '-(int) f:(int) x;' vs '-(int) f: (int) x;'
sp_after_oc_colon                        = ignore   # ignore/add/remove/force

# Add or remove space before the colon in message specs
# '-(int) f: (int) x;' vs '-(int) f : (int) x;'
sp_before_oc_colon                       = ignore   # ignore/add/remove/force

# Add or remove space after the colon in message specs
# '[object setValue:1];' vs '[object setValue: 1];'
sp_after_send_oc_colon                   = ignore   # ignore/add/remove/force

# Add or remove space before the colon in message specs
# '[object setValue:1];' vs '[object setValue :1];'
sp_before_send_oc_colon                  = ignore   # ignore/add/remove/force

# Add or remove space after the (type) in message specs
# '-(int)f: (int) x;' vs '-(int)f: (int)x;'
sp_after_oc_type                         = ignore   # ignore/add/remove/force

# Add or remove space after the first (type) in message specs
# '-(int) f:(int)x;' vs '-(int)f:(int)x;'
sp_after_oc_return_type                  = ignore   # ignore/add/remove/force

# Add or remove space between '@selector' and '('
# '@selector(msgName)' vs '@selector (msgName)'
# Also applies to @protocol() constructs
sp_after_oc_at_sel                       = ignore   # ignore/add/remove/force

# Add or remove space between '@selector(x)' and the following word
# '@selector(foo) a:' vs '@selector(foo)a:'
sp_after_oc_at_sel_parens                = ignore   # ignore/add/remove/force

# Add or remove space inside '@selector' parens
# '@selector(foo)' vs '@selector( foo )'
# Also applies to @protocol() constructs
sp_inside_oc_at_sel_parens               = ignore   # ignore/add/remove/force

# Add or remove space before a block pointer caret
# '^int (int arg){...}' vs. ' ^int (int arg){...}'
sp_before_oc_block_caret                 = ignore   # ignore/add/remove/force

# Add or remove space after a block pointer caret
# '^int (int arg){...}' vs. '^ int (int arg){...}'
sp_after_oc_block_caret                  = ignore   # ignore/add/remove/force

# Add or remove space around the ':' in 'b ? t : f'
sp_cond_colon                            = force    # ignore/add/remove/force

# Add or remove space around the '?' in 'b ? t : f'
sp_cond_question                         = force    # ignore/add/remove/force

# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here.
sp_case_label                            = ignore   # ignore/add/remove/force

# Control the space around the D '..' operator.
sp_range                                 = ignore   # ignore/add/remove/force

# Control the space after the opening of a C++ comment '// A' vs '//A'
# MPlayer devs note: we ignore the following setting because it breaks Doxygen comments
#sp_cmt_cpp_start                         = ignore   # ignore/add/remove/force
sp_cmt_cpp_start                         = add   # ignore/add/remove/force

# Controls the spaces between #else or #endif and a trailing comment
sp_endif_cmt                             = ignore   # ignore/add/remove/force

#
# Code alignment (not left column spaces/tabs)
#

# Whether to keep non-indenting tabs
align_keep_tabs                          = false    # false/true

# Whether to use tabs for aligning
align_with_tabs                          = false    # false/true

# Whether to bump out to the next tab when aligning
align_on_tabstop                         = false    # false/true

# Whether to left-align numbers
align_number_left                        = true     # false/true

# Align variable definitions in prototypes and functions
align_func_params                        = false    # false/true

# Align parameters in single-line functions that have the same name.
# The function names must already be aligned with each other.
align_same_func_call_params              = false    # false/true

# The span for aligning variable definitions (0=don't align)
align_var_def_span                       = 0        # number

# How to align the star in variable definitions.
#  0=Part of the type     'void *   foo;'
#  1=Part of the variable 'void     *foo;'
#  2=Dangling             'void    *foo;'
align_var_def_star_style                 = 2        # number

# How to align the '&' in variable definitions.
#  0=Part of the type
#  1=Part of the variable
#  2=Dangling
align_var_def_amp_style                  = 0        # number

# The threshold for aligning variable definitions (0=no limit)
align_var_def_thresh                     = 0        # number

# The gap for aligning variable definitions
align_var_def_gap                        = 0        # number

# Whether to align the colon in struct bit fields
align_var_def_colon                      = false    # false/true

# Whether to align any attribute after the variable name
align_var_def_attribute                  = false    # false/true

# Whether to align inline struct/enum/union variable definitions
align_var_def_inline                     = false    # false/true

# The span for aligning on '=' in assignments (0=don't align)
align_assign_span                        = 1        # number

# The threshold for aligning on '=' in assignments (0=no limit)
align_assign_thresh                      = 0        # number

# The span for aligning on '=' in enums (0=don't align)
align_enum_equ_span                      = 1        # number

# The threshold for aligning on '=' in enums (0=no limit)
align_enum_equ_thresh                    = 0        # number

# The span for aligning struct/union (0=don't align)
align_var_struct_span                    = 0        # number

# The threshold for aligning struct/union member definitions (0=no limit)
align_var_struct_thresh                  = 0        # number

# The gap for aligning struct/union member definitions
align_var_struct_gap                     = 0        # number

# The span for aligning struct initializer values (0=don't align)
align_struct_init_span                   = 1        # number

# The minimum space between the type and the synonym of a typedef
align_typedef_gap                        = 0        # number

# The span for aligning single-line typedefs (0=don't align)
align_typedef_span                       = 0        # number

# How to align typedef'd functions with other typedefs
# 0: Don't mix them at all
# 1: align the open paren with the types
# 2: align the function type name with the other type names
align_typedef_func                       = 0        # number

# Controls the positioning of the '*' in typedefs. Just try it.
# 0: Align on typedef type, ignore '*'
# 1: The '*' is part of type name: typedef int  *pint;
# 2: The '*' is part of the type, but dangling: typedef int *pint;
align_typedef_star_style                 = 0        # number

# Controls the positioning of the '&' in typedefs. Just try it.
# 0: Align on typedef type, ignore '&'
# 1: The '&' is part of type name: typedef int  &pint;
# 2: The '&' is part of the type, but dangling: typedef int &pint;
align_typedef_amp_style                  = 0        # number

# The span for aligning comments that end lines (0=don't align)
align_right_cmt_span                     = 0        # number

# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment
align_right_cmt_mix                      = false    # false/true

# If a trailing comment is more than this number of columns away from the text it follows,
# it will qualify for being aligned. This has to be > 0 to do anything.
align_right_cmt_gap                      = 0        # number

# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore)
align_right_cmt_at_col                   = 0        # number

# The span for aligning function prototypes (0=don't align)
align_func_proto_span                    = 0        # number

# Minimum gap between the return type and the function name.
align_func_proto_gap                     = 0        # number

# Align function protos on the 'operator' keyword instead of what follows
align_on_operator                        = false    # false/true

# Whether to mix aligning prototype and variable declarations.
# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options.
align_mix_var_proto                      = false    # false/true

# Align single-line functions with function prototypes, uses align_func_proto_span
align_single_line_func                   = false    # false/true

# Aligning the open brace of single-line functions.
# Requires align_single_line_func=true, uses align_func_proto_span
align_single_line_brace                  = false    # false/true

# Gap for align_single_line_brace.
align_single_line_brace_gap              = 0        # number

# The span for aligning ObjC msg spec (0=don't align)
align_oc_msg_spec_span                   = 0        # number

# Whether to align macros wrapped with a backslash and a newline.
# This will not work right if the macro contains a multi-line comment.
align_nl_cont                            = false    # false/true

# The minimum space between label and value of a preprocessor define
align_pp_define_gap                      = 0        # number

# The span for aligning on '#define' bodies (0=don't align)
align_pp_define_span                     = 0        # number

# Align lines that start with '<<' with previous '<<'. Default=true
align_left_shift                         = true     # false/true

# Span for aligning parameters in an Obj-C message call on the ':' (0=don't align)
align_oc_msg_colon_span                  = 0        # number

# Aligning parameters in an Obj-C '+' or '-' declaration on the ':'
align_oc_decl_colon                      = false    # false/true

#
# Newline adding and removing options
#

# Whether to collapse empty blocks between '{' and '}'
nl_collapse_empty_body                   = false    # false/true

# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };'
nl_assign_leave_one_liners               = false    # false/true

# Don't split one-line braced statements inside a class xx { } body
nl_class_leave_one_liners                = false    # false/true

# Don't split one-line enums: 'enum foo { BAR = 15 };'
nl_enum_leave_one_liners                 = false    # false/true

# Don't split one-line get or set functions
nl_getset_leave_one_liners               = false    # false/true

# Don't split one-line function definitions - 'int foo() { return 0; }'
nl_func_leave_one_liners                 = false    # false/true

# Don't split one-line if/else statements - 'if(a) b++;'
nl_if_leave_one_liners                   = false    # false/true

# Add or remove newlines at the start of the file
nl_start_of_file                         = remove   # ignore/add/remove/force

# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force'
nl_start_of_file_min                     = 0        # number

# Add or remove newline at the end of the file
nl_end_of_file                           = force    # ignore/add/remove/force

# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force')
nl_end_of_file_min                       = 1        # number

# Add or remove newline between '=' and '{'
nl_assign_brace                          = remove   # ignore/add/remove/force

# Add or remove newline between '=' and '[' (D only)
nl_assign_square                         = ignore   # ignore/add/remove/force

# Add or remove newline after '= [' (D only). Will also affect the newline before the ']'
nl_after_square_assign                   = ignore   # ignore/add/remove/force

# The number of blank lines after a block of variable definitions
nl_func_var_def_blk                      = 0        # number

# Add or remove newline between a function call's ')' and '{', as in:
# list_for_each(item, &list) { }
nl_fcall_brace                           = ignore   # ignore/add/remove/force

# Add or remove newline between 'enum' and '{'
nl_enum_brace                            = remove   # ignore/add/remove/force

# Add or remove newline between 'struct and '{'
nl_struct_brace                          = remove   # ignore/add/remove/force

# Add or remove newline between 'union' and '{'
nl_union_brace                           = remove   # ignore/add/remove/force

# Add or remove newline between 'if' and '{'
nl_if_brace                              = remove   # ignore/add/remove/force

# Add or remove newline between '}' and 'else'
nl_brace_else                            = remove   # ignore/add/remove/force

# Add or remove newline between 'else if' and '{'
# If set to ignore, nl_if_brace is used instead
nl_elseif_brace                          = ignore   # ignore/add/remove/force

# Add or remove newline between 'else' and '{'
nl_else_brace                            = remove   # ignore/add/remove/force

# Add or remove newline between 'else' and 'if'
nl_else_if                               = remove   # ignore/add/remove/force

# Add or remove newline between '}' and 'finally'
nl_brace_finally                         = ignore   # ignore/add/remove/force

# Add or remove newline between 'finally' and '{'
nl_finally_brace                         = ignore   # ignore/add/remove/force

# Add or remove newline between 'try' and '{'
nl_try_brace                             = ignore   # ignore/add/remove/force

# Add or remove newline between get/set and '{'
nl_getset_brace                          = ignore   # ignore/add/remove/force

# Add or remove newline between 'for' and '{'
nl_for_brace                             = remove   # ignore/add/remove/force

# Add or remove newline between 'catch' and '{'
nl_catch_brace                           = ignore   # ignore/add/remove/force

# Add or remove newline between '}' and 'catch'
nl_brace_catch                           = ignore   # ignore/add/remove/force

# Add or remove newline between 'while' and '{'
nl_while_brace                           = remove   # ignore/add/remove/force

# Add or remove newline between 'using' and '{'
nl_using_brace                           = ignore   # ignore/add/remove/force

# Add or remove newline between two open or close braces.
# Due to general newline/brace handling, REMOVE may not work.
nl_brace_brace                           = ignore   # ignore/add/remove/force

# Add or remove newline between 'do' and '{'
nl_do_brace                              = remove   # ignore/add/remove/force

# Add or remove newline between '}' and 'while' of 'do' statement
nl_brace_while                           = remove   # ignore/add/remove/force

# Add or remove newline between 'switch' and '{'
nl_switch_brace                          = remove   # ignore/add/remove/force

# Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc.
# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace.
nl_multi_line_cond                       = false    # false/true

# Force a newline in a define after the macro name for multi-line defines.
nl_multi_line_define                     = false    # false/true

# Whether to put a newline before 'case' statement
nl_before_case                           = false    # false/true

# Add or remove newline between ')' and 'throw'
nl_before_throw                          = ignore   # ignore/add/remove/force

# Whether to put a newline after 'case' statement
nl_after_case                            = true     # false/true

# Newline between namespace and {
nl_namespace_brace                       = ignore   # ignore/add/remove/force

# Add or remove newline between 'template<>' and whatever follows.
nl_template_class                        = ignore   # ignore/add/remove/force

# Add or remove newline between 'class' and '{'
nl_class_brace                           = ignore   # ignore/add/remove/force

# Add or remove newline after each ',' in the constructor member initialization
nl_class_init_args                       = ignore   # ignore/add/remove/force

# Add or remove newline between return type and function name in a function definition
nl_func_type_name                        = force    # ignore/add/remove/force

# Add or remove newline between return type and function name inside a class {}
# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore.
nl_func_type_name_class                  = ignore   # ignore/add/remove/force

# Add or remove newline between function scope and name in a definition
# Controls the newline after '::' in 'void A::f() { }'
nl_func_scope_name                       = ignore   # ignore/add/remove/force

# Add or remove newline between return type and function name in a prototype
nl_func_proto_type_name                  = remove   # ignore/add/remove/force

# Add or remove newline between a function name and the opening '('
nl_func_paren                            = remove   # ignore/add/remove/force

# Add or remove newline between a function name and the opening '(' in the definition
nl_func_def_paren                        = remove   # ignore/add/remove/force

# Add or remove newline after '(' in a function declaration
nl_func_decl_start                       = remove   # ignore/add/remove/force

# Add or remove newline after '(' in a function definition
nl_func_def_start                        = ignore   # ignore/add/remove/force

# Overrides nl_func_decl_start when there is only one parameter.
nl_func_decl_start_single                = ignore   # ignore/add/remove/force

# Overrides nl_func_def_start when there is only one parameter.
nl_func_def_start_single                 = ignore   # ignore/add/remove/force

# Add or remove newline after each ',' in a function declaration
nl_func_decl_args                        = ignore   # ignore/add/remove/force

# Add or remove newline after each ',' in a function definition
nl_func_def_args                         = ignore   # ignore/add/remove/force

# Add or remove newline before the ')' in a function declaration
nl_func_decl_end                         = remove   # ignore/add/remove/force

# Add or remove newline before the ')' in a function definition
nl_func_def_end                          = ignore   # ignore/add/remove/force

# Overrides nl_func_decl_end when there is only one parameter.
nl_func_decl_end_single                  = ignore   # ignore/add/remove/force

# Overrides nl_func_def_end when there is only one parameter.
nl_func_def_end_single                   = ignore   # ignore/add/remove/force

# Add or remove newline between '()' in a function declaration.
nl_func_decl_empty                       = ignore   # ignore/add/remove/force

# Add or remove newline between '()' in a function definition.
nl_func_def_empty                        = ignore   # ignore/add/remove/force

# Add or remove newline between function signature and '{'
nl_fdef_brace                            = force    # ignore/add/remove/force

# Whether to put a newline after 'return' statement
nl_after_return                          = false    # false/true

# Add or remove a newline between the return keyword and return expression.
nl_return_expr                           = ignore   # ignore/add/remove/force

# Whether to put a newline after semicolons, except in 'for' statements
nl_after_semicolon                       = true     # false/true

# Whether to put a newline after brace open.
# This also adds a newline before the matching brace close.
nl_after_brace_open                      = false    # false/true

# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is
# placed between the open brace and a trailing single-line comment.
nl_after_brace_open_cmt                  = false    # false/true

# Whether to put a newline after a virtual brace open with a non-empty body.
# These occur in un-braced if/while/do/for statement bodies.
nl_after_vbrace_open                     = true     # false/true

# Whether to put a newline after a virtual brace open with an empty body.
# These occur in un-braced if/while/do/for statement bodies.
nl_after_vbrace_open_empty               = false    # false/true

# Whether to put a newline after a brace close.
# Does not apply if followed by a necessary ';'.
nl_after_brace_close                     = false    # false/true

# Whether to put a newline after a virtual brace close.
# Would add a newline before return in: 'if (foo) a++; return;'
nl_after_vbrace_close                    = false    # false/true

# Whether to alter newlines in '#define' macros
nl_define_macro                          = false    # false/true

# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'
nl_squeeze_ifdef                         = false    # false/true

# Add or remove blank line before 'if'
nl_before_if                             = ignore   # ignore/add/remove/force

# Add or remove blank line after 'if' statement
nl_after_if                              = ignore   # ignore/add/remove/force

# Add or remove blank line before 'for'
nl_before_for                            = ignore   # ignore/add/remove/force

# Add or remove blank line after 'for' statement
nl_after_for                             = ignore   # ignore/add/remove/force

# Add or remove blank line before 'while'
nl_before_while                          = ignore   # ignore/add/remove/force

# Add or remove blank line after 'while' statement
nl_after_while                           = ignore   # ignore/add/remove/force

# Add or remove blank line before 'switch'
nl_before_switch                         = ignore   # ignore/add/remove/force

# Add or remove blank line after 'switch' statement
nl_after_switch                          = ignore   # ignore/add/remove/force

# Add or remove blank line before 'do'
nl_before_do                             = ignore   # ignore/add/remove/force

# Add or remove blank line after 'do/while' statement
nl_after_do                              = ignore   # ignore/add/remove/force

# Whether to double-space commented-entries in struct/enum
nl_ds_struct_enum_cmt                    = false    # false/true

# Whether to double-space before the close brace of a struct/union/enum
# (lower priority than 'eat_blanks_before_close_brace')
nl_ds_struct_enum_close_brace            = false    # false/true

# Add or remove a newline around a class colon.
# Related to pos_class_colon, nl_class_init_args, and pos_comma.
nl_class_colon                           = ignore   # ignore/add/remove/force

# Change simple unbraced if statements into a one-liner
# 'if(b)\n i++;' => 'if(b) i++;'
nl_create_if_one_liner                   = false    # false/true

# Change simple unbraced for statements into a one-liner
# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);'
nl_create_for_one_liner                  = false    # false/true

# Change simple unbraced while statements into a one-liner
# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);'
nl_create_while_one_liner                = false    # false/true

#
# Positioning options
#

# The position of arithmetic operators in wrapped expressions
pos_arith                                = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force

# The position of assignment in wrapped expressions.
# Do not affect '=' followed by '{'
pos_assign                               = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force

# The position of boolean operators in wrapped expressions
pos_bool                                 = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force

# The position of comparison operators in wrapped expressions
pos_compare                              = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force

# The position of conditional (b ? t : f) operators in wrapped expressions
pos_conditional                          = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force

# The position of the comma in wrapped expressions
pos_comma                                = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force

# The position of the comma in the constructor initialization list
pos_class_comma                          = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force

# The position of colons between constructor and member initialization
pos_class_colon                          = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force

#
# Line Splitting options
#

# Try to limit code width to N number of columns
code_width                               = 120      # number

# Whether to fully split long 'for' statements at semi-colons
ls_for_split_full                        = false    # false/true

# Whether to fully split long function protos/calls at commas
ls_func_split_full                       = false    # false/true

#
# Blank line options
#

# The maximum consecutive newlines
nl_max                                   = 2        # number

# The number of newlines after a function prototype, if followed by another function prototype
nl_after_func_proto                      = 0        # number

# The number of newlines after a function prototype, if not followed by another function prototype
nl_after_func_proto_group                = 0        # number

# The number of newlines after '}' of a multi-line function body
nl_after_func_body                       = 2        # number

# The number of newlines after '}' of a single line function body
nl_after_func_body_one_liner             = 2        # number

# The minimum number of newlines before a multi-line comment.
# Doesn't apply if after a brace open or another multi-line comment.
nl_before_block_comment                  = 0        # number

# The minimum number of newlines before a single-line C comment.
# Doesn't apply if after a brace open or other single-line C comments.
nl_before_c_comment                      = 0        # number

# The minimum number of newlines before a CPP comment.
# Doesn't apply if after a brace open or other CPP comments.
nl_before_cpp_comment                    = 0        # number

# Whether to force a newline after a multi-line comment.
nl_after_multiline_comment               = false    # false/true

# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.
# Will not change the newline count if after a brace open.
# 0 = No change.
nl_before_access_spec                    = 0        # number

# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.
# 0 = No change.
nl_after_access_spec                     = 0        # number

# The number of newlines between a function def and the function comment.
# 0 = No change.
nl_comment_func_def                      = 0        # number

# The number of newlines after a try-catch-finally block that isn't followed by a brace close.
# 0 = No change.
nl_after_try_catch_finally               = 0        # number

# The number of newlines before and after a property, indexer or event decl.
# 0 = No change.
nl_around_cs_property                    = 0        # number

# The number of newlines between the get/set/add/remove handlers in C#.
# 0 = No change.
nl_between_get_set                       = 0        # number

# Whether to remove blank lines after '{'
eat_blanks_after_open_brace              = true     # false/true

# Whether to remove blank lines before '}'
eat_blanks_before_close_brace            = true     # false/true

#
# Code modifying options (non-whitespace)
#

# Add or remove braces on single-line 'do' statement
mod_full_brace_do                        = remove   # ignore/add/remove/force

# Add or remove braces on single-line 'for' statement
mod_full_brace_for                       = remove   # ignore/add/remove/force

# Add or remove braces on single-line function definitions. (Pawn)
mod_full_brace_function                  = ignore   # ignore/add/remove/force

# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
mod_full_brace_if                        = ignore   # ignore/add/remove/force

# Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if.
# If any must be braced, they are all braced.  If all can be unbraced, then the braces are removed.
mod_full_brace_if_chain                  = false    # false/true

# Don't remove braces around statements that span N newlines
mod_full_brace_nl                        = 0        # number

# Add or remove braces on single-line 'while' statement
mod_full_brace_while                     = remove   # ignore/add/remove/force

# Add or remove braces on single-line 'using ()' statement
mod_full_brace_using                     = remove   # ignore/add/remove/force

# Add or remove unnecessary paren on 'return' statement
mod_paren_on_return                      = remove   # ignore/add/remove/force

# Whether to change optional semicolons to real semicolons
mod_pawn_semicolon                       = false    # false/true

# Add parens on 'while' and 'if' statement around bools
mod_full_paren_if_bool                   = false    # false/true

# Whether to remove superfluous semicolons
mod_remove_extra_semicolon               = true     # false/true

# If a function body exceeds the specified number of newlines and doesn't have a comment after
# the close brace, a comment will be added.
mod_add_long_function_closebrace_comment = 0        # number

# If a switch body exceeds the specified number of newlines and doesn't have a comment after
# the close brace, a comment will be added.
mod_add_long_switch_closebrace_comment   = 0        # number

# If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after
# the #else, a comment will be added.
mod_add_long_ifdef_endif_comment         = 0        # number

# If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after
# the #endif, a comment will be added.
mod_add_long_ifdef_else_comment          = 0        # number

# If TRUE, will sort consecutive single-line 'import' statements [Java, D]
mod_sort_import                          = false    # false/true

# If TRUE, will sort consecutive single-line 'using' statements [C#]
mod_sort_using                           = false    # false/true

# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C]
# This is generally a bad idea, as it may break your code.
mod_sort_include                         = false    # false/true

# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace.
mod_move_case_break                      = false    # false/true

# Will add or remove the braces around a fully braced case statement.
# Will only remove the braces if there are no variable declarations in the block.
mod_case_brace                           = ignore   # ignore/add/remove/force

# If TRUE, it will remove a void 'return;' that appears as the last statement in a function.
mod_remove_empty_return                  = false    # false/true

#
# Comment modifications
#

# Try to wrap comments at cmt_width columns
cmt_width                                = 0        # number

# Set the comment reflow mode (default: 0)
# 0: no reflowing (apart from the line wrapping due to cmt_width)
# 1: no touching at all
# 2: full reflow
cmt_reflow_mode                          = 0        # number

# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars.
# Default is true.
cmt_indent_multi                         = true     # false/true

# Whether to group c-comments that look like they are in a block
cmt_c_group                              = false    # false/true

# Whether to put an empty '/*' on the first line of the combined c-comment
cmt_c_nl_start                           = false    # false/true

# Whether to put a newline before the closing '*/' of the combined c-comment
cmt_c_nl_end                             = false    # false/true

# Whether to group cpp-comments that look like they are in a block
cmt_cpp_group                            = false    # false/true

# Whether to put an empty '/*' on the first line of the combined cpp-comment
cmt_cpp_nl_start                         = false    # false/true

# Whether to put a newline before the closing '*/' of the combined cpp-comment
cmt_cpp_nl_end                           = false    # false/true

# Whether to change cpp-comments into c-comments
cmt_cpp_to_c                             = false    # false/true

# Whether to put a star on subsequent comment lines
cmt_star_cont                            = true     # false/true

# The number of spaces to insert at the start of subsequent comment lines
cmt_sp_before_star_cont                  = 0        # number

# The number of spaces to insert after the star on subsequent comment lines
cmt_sp_after_star_cont                   = 0        # number

# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of
# the comment are the same length. Default=True
cmt_multi_check_last                     = false    # false/true

# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment.
# Will substitute $(filename) with the current file's name.
cmt_insert_file_header                   = ""         # string

# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment.
# Will substitute $(filename) with the current file's name.
cmt_insert_file_footer                   = ""         # string

# The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment.
# Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff.
# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... }
cmt_insert_func_header                   = ""         # string

# The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment.
# Will substitute $(class) with the class name.
cmt_insert_class_header                  = ""         # string

# If a preprocessor is encountered when stepping backwards from a function name, then
# this option decides whether the comment should be inserted.
# Affects cmt_insert_func_header and cmt_insert_class_header.
cmt_insert_before_preproc                = false    # false/true

#
# Preprocessor options
#

# Control indent of preprocessors inside #if blocks at brace level 0
pp_indent                                = remove   # ignore/add/remove/force

# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false)
pp_indent_at_level                       = false    # false/true

# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1.
pp_indent_count                          = 1        # number

# Add or remove space after # based on pp_level of #if blocks
pp_space                                 = remove   # ignore/add/remove/force

# Sets the number of spaces added with pp_space
pp_space_count                           = 0        # number

# The indent for #region and #endregion in C# and '#pragma region' in C/C++
pp_indent_region                         = 0        # number

# Whether to indent the code between #region and #endregion
pp_region_indent_code                    = false    # false/true

# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level
pp_indent_if                             = 0        # number

# Control whether to indent the code between #if, #else and #endif when not at file-level
pp_if_indent_code                        = false    # false/true

# Whether to indent '#define' at the brace level (true) or from column 1 (false)
pp_define_at_level                       = false    # false/true

# You can force a token to be a type with the 'type' option.
# Example:
# type myfoo1 myfoo2
#
# You can create custom macro-based indentation using macro-open,
# macro-else and macro-close.
# Example:
# macro-open  BEGIN_TEMPLATE_MESSAGE_MAP
# macro-open  BEGIN_MESSAGE_MAP
# macro-close END_MESSAGE_MAP
#
# You can assign any keyword to any type with the set option.
# set func_call_user _ N_
#
# The full syntax description of all custom definition config entries
# is shown below:
#
# define custom tokens as:
# - embed whitespace in token using '' escape character, or
#   put token in quotes
# - these: ' " and ` are recognized as quote delimiters
#
# type token1 token2 token3 ...
#             ^ optionally specify multiple tokens on a single line
# define def_token output_token
#                  ^ output_token is optional, then NULL is assumed
# macro-open token
# macro-close token
# macro-else token
# set id token1 token2 ...
#               ^ optionally specify multiple tokens on a single line
#     ^ id is one of the names in token_enum.h sans the CT_ prefix,
#       e.g. PP_PRAGMA
#
# all tokens are separated by any mix of ',' commas, '=' equal signs
# and whitespace (space, tab)
#


================================================
FILE: AUTHORS
================================================
Shadowsocks-libev was originally created in late 2013, by
Clowwindy <clowwindy@gmail.com>, then rewritten and maintained by
Max Lv <max.c.lv@gmail.com>.

Here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS --
people who have submitted patches, fixed bugs, added translations, and
generally made shadowsocks-libev that much better:

https://github.com/shadowsocks/shadowsocks-libev/graphs/contributors


================================================
FILE: CLAUDE.md
================================================
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

shadowsocks-libev is a lightweight SOCKS5 proxy written in pure C. Version 3.3.6, licensed under GPLv3.

## Build Commands

### CMake (sole build system)

```bash
git submodule update --init --recursive
mkdir -p build && cd build
cmake ..
make
sudo make install
```

On macOS, CMake should auto-detect library paths. If needed, specify paths:
```bash
cmake .. -DCMAKE_PREFIX_PATH="/usr/local/opt/mbedtls;/usr/local/opt/libsodium"
```

CMake outputs binaries to `build/bin/` (static) and `build/shared/bin/` (shared).

### Build Dependencies

- cmake (>= 3.2), a C compiler (gcc or clang), pkg-config
- libmbedtls, libsodium (>= 1.0.4), libpcre3, libev, libc-ares
- asciidoc + xmlto (documentation only)

### CMake Options

- `-DWITH_EMBEDDED_SRC=OFF`: use system libcork/libipset/libbloom instead of bundled submodules
- `-DWITH_DOC_MAN=OFF`: skip man page generation
- `-DENABLE_CONNMARKTOS=ON`: Linux netfilter conntrack QoS support
- `-DENABLE_NFTABLES=ON`: nftables firewall integration
- `-DDISABLE_SSP=ON`: disable stack protector
- `-DBUILD_TESTING=OFF`: disable unit tests

## Testing

### Unit Tests (CTest)

```bash
cd build
ctest --output-on-failure
```

10 unit test modules cover: base64, buffer, crypto, json, jconf, cache, ppbloom, rule, netutils, utils.

### Integration Tests

Integration tests use Python and require `curl` and `dig` to be available:
```bash
bash tests/test.sh
```

The test harness (`tests/test.py`) starts ss-server, ss-local, and ss-tunnel locally, then runs curl through the SOCKS5 proxy and dig through the tunnel. Each test config in `tests/*.json` exercises a different cipher.

Run a single cipher test:
```bash
python tests/test.py --bin build/bin/ -c tests/aes-gcm.json
```

## Code Formatting

Uses **uncrustify** with the config at `.uncrustify.cfg`. Key settings: 4-space indent, no tabs, 120-column width, K&R brace style (braces on same line).

## Architecture

### Binaries (all in `src/`)

Each binary is compiled with a module define that controls conditional compilation:

| Binary | Define | Purpose |
|---|---|---|
| `ss-local` | `MODULE_LOCAL` | SOCKS5 client proxy |
| `ss-server` | `MODULE_REMOTE` | Server-side proxy |
| `ss-tunnel` | `MODULE_TUNNEL` | Port forwarding tunnel (implies `MODULE_LOCAL`) |
| `ss-redir` | `MODULE_REDIR` | Transparent proxy via iptables (Linux only, implies `MODULE_LOCAL`) |
| `ss-manager` | `MODULE_MANAGER` | Multi-server manager daemon |

A shared library `libshadowsocks-libev` is also built from the ss-local sources with `-DLIB_ONLY`. Its public API is in `src/shadowsocks.h`.

### Source Organization (`src/`)

**Shared by all binaries:**
- `utils.c` - logging, system utilities
- `jconf.c` / `json.c` - JSON config file parsing
- `netutils.c` - network address utilities
- `cache.c` - hash-based LRU connection cache
- `udprelay.c` - UDP relay implementation (shared, but uses `#ifdef MODULE_*` for per-binary behavior)

**Crypto layer** (two parallel implementations behind a common `crypto_t` interface):
- `crypto.c` / `crypto.h` - crypto initialization, key derivation (HKDF), buffer management. Defines `crypto_t` with function pointers for encrypt/decrypt.
- `stream.c` - stream cipher implementation (CFB mode via mbedTLS)
- `aead.c` - AEAD cipher implementation (AES-GCM via mbedTLS, ChaCha20-Poly1305 via libsodium)
- `ppbloom.c` - ping-pong bloom filter for nonce replay detection

**ACL (Access Control Lists):**
- `acl.c` / `rule.c` - IP/domain-based routing rules using libipset

**Plugin support:**
- `plugin.c` - SIP003 plugin subprocess management

### Bundled Submodules

Three git submodules in the repo root (can be replaced with system libs via `-DWITH_EMBEDDED_SRC=OFF`):
- `libcork/` - data structures (dllist, hash-table, buffers)
- `libipset/` - IP set operations for ACL
- `libbloom/` - bloom filter implementation

### Event Loop

All binaries use **libev** for async I/O. The connection lifecycle follows stages defined in `src/common.h`: `STAGE_INIT` -> `STAGE_HANDSHAKE` -> `STAGE_RESOLVE` -> `STAGE_STREAM` -> `STAGE_STOP`. Each binary defines its own `listen_ctx_t`, `server_t`, and `remote_t` structs (note: "server" in `local.h` means the local-side connection, "remote" means the ss-server side).

### Compiler Flags

Default flags from `CMakeLists.txt`: `-g -O2 -Wall -Werror -Wno-deprecated-declarations -fno-strict-aliasing -std=gnu99 -D_GNU_SOURCE`

The `-Werror` flag means all warnings are errors - new code must compile warning-free.


================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)

set(PROJECT_NAME shadowsocks-libev)
set(RELEASE_DATE 2026-02-09)
set(PROJECT_VERSION "3.3.6")
set(PROJECT_DESC "a lightweight secured socks5 proxy")
set(PROJECT_URL "https://shadowsocks.org")
set(PROJECT_ISSUES_URL "https://github.com/shadowsocks/shadowsocks-libev")
project(${PROJECT_NAME} VERSION ${PROJECT_VERSION})

include(GNUInstallDirs)

# Compiler flags matching autotools
# Note: -Werror is applied per-target in src/CMakeLists.txt to avoid
# breaking bundled submodules (libcork, libipset, libbloom)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -D_GNU_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -Wall -Wno-deprecated-declarations -fno-strict-aliasing")

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
set(RUNTIME_SHARED_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/shared/bin)

set(CMAKE_MACOSX_RPATH TRUE)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Debug)
endif ()
# Detect linux
if (UNIX AND NOT APPLE)
    set(LINUX TRUE)
endif ()

message(STATUS "Running cmake version ${CMAKE_VERSION}")

option(WITH_STATIC "build with static libraries." ON)
option(WITH_EMBEDDED_SRC "build with embedded libcork, libipset, and libbloom source." ON)
option(ENABLE_CONNMARKTOS "Enable saved connmark to IP TOS QoS feature" OFF)
option(ENABLE_NFTABLES "Report malicious IP to nftables" OFF)

# When choose to not use embedded libcork, libipset and libbloom, use libs shipped by system
if (NOT WITH_EMBEDDED_SRC)
    set(USE_SYSTEM_SHARED_LIB TRUE)
endif ()

# Find dependencies via Find modules
find_package(PCRE2 REQUIRED)
find_package(MbedTLS REQUIRED)
find_package(Sodium REQUIRED)
find_package(Cares REQUIRED)

# Connmarktos support
if(ENABLE_CONNMARKTOS)
    if(NOT LINUX)
        message(FATAL_ERROR "connmarktos is only supported on Linux")
    endif()
    find_library(NETFILTER_CONNTRACK_LIB netfilter_conntrack)
    find_library(NFNETLINK_LIB nfnetlink)
    if(NOT NETFILTER_CONNTRACK_LIB)
        message(FATAL_ERROR "--enable-connmarktos specified but libnetfilter_conntrack not found")
    endif()
    set(USE_NFCONNTRACK_TOS 1)
    message(STATUS "Connmarktos enabled")
endif()

# Nftables support
if(ENABLE_NFTABLES)
    if(NOT LINUX)
        message(FATAL_ERROR "nftables is only supported on Linux")
    endif()
    find_library(MNL_LIB mnl)
    find_library(NFTNL_LIB nftnl)
    if(NOT MNL_LIB OR NOT NFTNL_LIB)
        message(FATAL_ERROR "--enable-nftables specified but libmnl or libnftnl not found")
    endif()
    set(USE_NFTABLES 1)
    message(STATUS "Nftables enabled")
endif()

# Run platform tests
include(${PROJECT_SOURCE_DIR}/cmake/configure.cmake)
configure_file(${PROJECT_SOURCE_DIR}/cmake/config.h.cmake ${PROJECT_BINARY_DIR}/src/config.h)
add_definitions(-I${PROJECT_BINARY_DIR}/src)
add_definitions(-DHAVE_CONFIG_H)

# pkg-config
configure_file(
        ${PROJECT_SOURCE_DIR}/cmake/shadowsocks-libev.pc.cmake
        ${PROJECT_BINARY_DIR}/pkgconfig/shadowsocks-libev.pc
        @ONLY
)
install(FILES
        ${PROJECT_BINARY_DIR}/pkgconfig/shadowsocks-libev.pc
        DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
        )

if (WITH_EMBEDDED_SRC)
# We need libcork,libipset headers
include_directories(libcork/include)
include_directories(libipset/include)
include_directories(libbloom/murmur2)
include_directories(libbloom)

set(LIBCORK_SOURCE
        libcork/src/libcork/cli/commands.c
        libcork/src/libcork/core/allocator.c
        libcork/src/libcork/core/error.c
        libcork/src/libcork/core/gc.c
        libcork/src/libcork/core/hash.c
        libcork/src/libcork/core/ip-address.c
        libcork/src/libcork/core/mempool.c
        libcork/src/libcork/core/timestamp.c
        libcork/src/libcork/core/u128.c
        libcork/src/libcork/core/version.c
        libcork/src/libcork/ds/array.c
        libcork/src/libcork/ds/bitset.c
        libcork/src/libcork/ds/buffer.c
        libcork/src/libcork/ds/dllist.c
        libcork/src/libcork/ds/file-stream.c
        libcork/src/libcork/ds/hash-table.c
        libcork/src/libcork/ds/managed-buffer.c
        libcork/src/libcork/ds/ring-buffer.c
        libcork/src/libcork/ds/slice.c
        libcork/src/libcork/posix/directory-walker.c
        libcork/src/libcork/posix/env.c
        libcork/src/libcork/posix/exec.c
        libcork/src/libcork/posix/files.c
        libcork/src/libcork/posix/process.c
        libcork/src/libcork/pthreads/thread.c
        )
if (NOT MINGW)
set(LIBCORK_SOURCE ${LIBCORK_SOURCE} libcork/src/libcork/posix/subprocess.c)
else ()
set(LIBCORK_SOURCE ${LIBCORK_SOURCE} libcork/src/libcork/posix/mingw.c)
endif ()

add_library(cork STATIC ${LIBCORK_SOURCE})
target_compile_definitions(cork PUBLIC -DCORK_API=CORK_LOCAL)
if (MINGW)
target_link_libraries(cork ws2_32)
endif ()

set(LIBIPSET_SOURCE
        libipset/src/libipset/general.c
        libipset/src/libipset/bdd/assignments.c
        libipset/src/libipset/bdd/basics.c
        libipset/src/libipset/bdd/bdd-iterator.c
        libipset/src/libipset/bdd/expanded.c
        libipset/src/libipset/bdd/reachable.c
        libipset/src/libipset/bdd/read.c
        libipset/src/libipset/bdd/write.c
        libipset/src/libipset/map/allocation.c
        libipset/src/libipset/map/inspection.c
        libipset/src/libipset/map/ipv4_map.c
        libipset/src/libipset/map/ipv6_map.c
        libipset/src/libipset/map/storage.c
        libipset/src/libipset/set/allocation.c
        libipset/src/libipset/set/inspection.c
        libipset/src/libipset/set/ipv4_set.c
        libipset/src/libipset/set/ipv6_set.c
        libipset/src/libipset/set/iterator.c
        libipset/src/libipset/set/storage.c
        )

add_library(ipset STATIC ${LIBIPSET_SOURCE})

set(LIBBLOOM_SOURCE
        libbloom/bloom.c
        libbloom/murmur2/MurmurHash2.c
        )

add_library(bloom STATIC ${LIBBLOOM_SOURCE})
target_link_libraries(ipset cork bloom)
endif ()

add_subdirectory(src)
add_subdirectory(doc)

# Testing
include(CTest)
if(BUILD_TESTING)
    add_subdirectory(tests)
endif()

# Install ss-nat on Linux
if(LINUX)
    install(PROGRAMS src/ss-nat DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

# Install ss-setup TUI tool
install(PROGRAMS scripts/ss-setup.sh DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME ss-setup)


================================================
FILE: COPYING
================================================
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.


================================================
FILE: Changes
================================================
shadowsocks-libev (3.3.5-1) unstable; urgency=medium

  * Remove the SNI proxy function.
  * Minor bug fixes. (#2581, #2582, #2590, #2595, #2599,
    #2600, #2620, #2687, #2692)

 -- Max Lv <max.c.lv@gmail.com>  Tue, 15 Sep 2020 10:24:43 +0800

shadowsocks-libev (3.3.4-1) unstable; urgency=medium

  * Minor bug fixes. (#2539, #2565, #2566, #2577)
  * Security bug fixes. (CVE-2019-5163, CVE-2019-5164)

 -- Max Lv <max.c.lv@gmail.com>  Fri, 10 Jan 2020 09:28:25 +0800

shadowsocks-libev (3.3.3-1) unstable; urgency=medium

  * Refine the handling of suspicious connections.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 31 Oct 2019 15:06:04 +0800

shadowsocks-libev (3.3.2-1) unstable; urgency=medium

  * Refine the handling of fragment request.
  * Minor bug fixes. (#2463, #2481, #2508)

 -- Max Lv <max.c.lv@gmail.com>  Sat, 12 Oct 2019 08:42:24 +0800

shadowsocks-libev (3.3.1-1) unstable; urgency=high

  * Fix a high CPU bug introduced in 3.3.0. (#2449)
  * Fix MinGW build. (#2438)
  * Minor bug fixes. (#2402, #2412, #2427, #2443)

 -- Max Lv <max.c.lv@gmail.com>  Fri, 09 Aug 2019 15:02:34 +0800

shadowsocks-libev (3.3.0-1) unstable; urgency=medium

  * Enlarge the socket buffer size to 16KB.
  * Fix the empty list bug in ss-manager.
  * Fix the IPv6 address parser.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 08 Jun 2019 07:53:20 +0800

shadowsocks-libev (3.2.5-1) unstable; urgency=medium

  * Fix a bug of port parser.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 09 Mar 2019 18:54:36 +0800

shadowsocks-libev (3.2.4-1) unstable; urgency=medium

  * Fix a crash with MinGW.
  * Refine SIP003 plugin interface.
  * Remove connection timeout from all clients.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 26 Feb 2019 09:40:18 +0800

shadowsocks-libev (3.2.3-1) unstable; urgency=medium

  * Fix the alignment issue again.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 28 Nov 2018 00:27:40 -0800

shadowsocks-libev (3.2.2-1) unstable; urgency=medium

  * Fix a bug on 32-bit arch.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 26 Nov 2018 20:07:21 -0800

shadowsocks-libev (3.2.1-1) unstable; urgency=medium

  * Add TCP fast open support to ss-tunnel by @PantherJohn.
  * Fix several security issues.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 07 Nov 2018 22:31:59 -0800

shadowsocks-libev (3.2.0-1) unstable; urgency=medium

  * Add MinGW support by @linusyang.
  * Refine c-ares integration by @xnoreq.
  * Fix building issues with GCC8 by @FlyingheartCN.
  * Minor bug fixes.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 28 May 2018 19:46:21 -0700

shadowsocks-libev (3.1.3-1) unstable; urgency=medium

  * Fix a bug in UDP relay.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 15 Jan 2018 17:19:31 -0800

shadowsocks-libev (3.1.2-1) unstable; urgency=medium

  * Fix a bug in DNS resolver.
  * Add new TFO API support.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 28 Dec 2017 21:01:56 -0800

shadowsocks-libev (3.1.1-1) unstable; urgency=high

  * Fix a security issue in ss-manager. (CVE-2017-15924)

 -- Max Lv <max.c.lv@gmail.com>  Mon, 20 Nov 2017 12:13:04 +0800

shadowsocks-libev (3.1.0-1) unstable; urgency=low

  * Replace libudns with libc-ares.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 14 Sep 2017 19:27:51 -0700

shadowsocks-libev (3.0.8-1) unstable; urgency=medium

  * Refine the ping-pong bloom filter.
  * Minor bug fixes by @vfreex, @vlolteanu and @jackyyf.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 27 Jul 2017 11:01:37 +0800

shadowsocks-libev (3.0.7-1) unstable; urgency=medium

  * Refine manager mode by @mengxd.
  * Fix a potential memory leak by @vlolteanu.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 27 Jun 2017 14:08:27 +0800

shadowsocks-libev (3.0.6-1) unstable; urgency=medium

  * Fix a bug with AEAD ciphers.
  * Refine ACL support by @blackgear.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 26 Apr 2017 13:48:11 +0800

shadowsocks-libev (3.0.5-1) unstable; urgency=medium

  * Fix a bug of TCP Fast Open in ss-redir.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 21 Mar 2017 13:49:18 +0800

shadowsocks-libev (3.0.4-1) unstable; urgency=medium

  * Add CMake files by @wenerme.
  * Support TCP Fast Open in ss-redir by @lqs.
  * Support TOS/DESCP in ss-redir by @sduponch.
  * Refine MPTCP by @sduponch.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 16 Mar 2017 14:07:57 +0800

shadowsocks-libev (3.0.3-1) unstable; urgency=medium

  * Replace nonce cache with a ping-pong bloom filter.

 -- Max Lv <max.c.lv@gmail.com>  Fri, 24 Feb 2017 12:08:31 +0800

shadowsocks-libev (3.0.2-1) unstable; urgency=high

  * Add session key for AEAD. (SIP007)

 -- Max Lv <max.c.lv@gmail.com>  Mon, 13 Feb 2017 09:07:17 +0800

shadowsocks-libev (3.0.1-1) unstable; urgency=medium

  * Fix a crashe when using stream ciphers.
  * Fix a protocol bug in AEAD ciphers. (SIP004)
  * Allow setting keys directly. (SIP006)

 -- Max Lv <max.c.lv@gmail.com>  Tue, 07 Feb 2017 13:18:02 +0800

shadowsocks-libev (3.0.0-1) unstable; urgency=medium

  * Drop dependencies of OpenSSL and PolarSSL.
  * Deprecate OTA (One-Time-Auth).
  * Add new ciphers for SIP004: aes-128-gcm, aes-192-gcm, aes-256-gcm,
    chacha20-poly1305 and chacha20-ietf-poly1305.
  * Refine SIP003 to support standalone mode of obfsproxy.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 01 Feb 2017 19:10:14 +0800

shadowsocks-libev (2.6.3-1) unstable; urgency=medium

  * Refine the project structure.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 24 Jan 2017 19:10:45 +0800

shadowsocks-libev (2.6.2-1) unstable; urgency=medium

  * Refine SIP003 plugin support.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 16 Jan 2017 10:16:12 +0800

shadowsocks-libev (2.6.1-1) unstable; urgency=medium

  * Deprecate HTTP/TLS obfuscating.
  * Add SIP003 plugin support.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 08 Jan 2017 15:14:19 +0800

shadowsocks-libev (2.6.0-1) unstable; urgency=medium

  * Add HTTP/TLS obfuscating.
  * Add support of aunch_activate_socket on macOS.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 27 Dec 2016 16:37:23 +0800

shadowsocks-libev (2.5.6-1) unstable; urgency=medium

  * Add outbound ACL for server.
  * Refine log format.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 01 Nov 2016 09:51:52 +0800

shadowsocks-libev (2.5.5-1) unstable; urgency=medium

  * Refine attack detection.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 11 Oct 2016 15:45:09 +0800

shadowsocks-libev (2.5.4-1) unstable; urgency=medium

  * Fix a bug of auto blocking mechanism.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 09 Oct 2016 19:36:37 +0800

shadowsocks-libev (2.5.3-1) unstable; urgency=medium

  * Fix TCP Fast Open on macOS.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 21 Sep 2016 19:31:57 +0800

shadowsocks-libev (2.5.2-1) unstable; urgency=medium

  * Fix a bug of UDP relay mode of ss-local.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 12 Sep 2016 12:54:33 +0800

shadowsocks-libev (2.5.1-1) unstable; urgency=medium

  * Refine ACL feature with hostname support.
  * Add HTTP/SNI parser for ss-local/ss-redir.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 10 Sep 2016 17:06:49 +0800

shadowsocks-libev (2.5.0-1) unstable; urgency=medium

  * Fix several bugs of the command line interface.
  * Add aes-128/192/256-ctr ciphers.
  * Add option MTU for UDP relay.
  * Add MultiPath TCP support.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 29 Aug 2016 13:07:51 +0800

shadowsocks-libev (2.4.8-1) unstable; urgency=low

  * Update manual pages with asciidoc.
  * Fix issues of bind_address option.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 20 Jul 2016 09:25:50 +0800

shadowsocks-libev (2.4.7-1) unstable; urgency=low

  * Add ss-nat, a helper script to set up NAT rules for ss-redir.
  * Fix several issues for debian package.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 1 Jun 2016 18:21:45 +0800

shadowsocks-libev (2.4.6-1) unstable; urgency=low

  * Update manual pages.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 21 Apr 2016 17:33:34 +0800

shadowsocks-libev (2.4.5-1) unstable; urgency=low

  * Fix build issues on OpenWRT.
  * Reduce the latency of redir mode.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 01 Feb 2016 13:22:50 +0800

shadowsocks-libev (2.4.4-1) unstable; urgency=low

  * Fix a potential memory leak.
  * Fix some compiler related issues.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 13 Jan 2016 11:50:12 +0800

shadowsocks-libev (2.4.3-1) unstable; urgency=high

  * Refine the buffer allocation.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 19 Dec 2015 12:30:21 +0900

shadowsocks-libev (2.4.1-1) unstable; urgency=high

  * Fix a security bug.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 29 Oct 2015 15:42:47 +0900

shadowsocks-libev (2.4.0-1) unstable; urgency=low

  * Update the one-time authentication

 -- Max Lv <max.c.lv@gmail.com>  Thu, 24 Sep 2015 14:11:05 +0900

shadowsocks-libev (2.3.3-1) unstable; urgency=low

  * Refine the onetime authentication of header.
  * Enforce CRC16 on the payload.

 -- Max Lv <max.c.lv@gmail.com>  Fri, 18 Sep 2015 10:38:21 +0900

shadowsocks-libev (2.3.2-1) unstable; urgency=low

  * Fix minor issues of build scripts.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 13 Sep 2015 15:22:28 +0900

shadowsocks-libev (2.3.1-1) unstable; urgency=low

  * Fix an issue of connection cache of UDP relay.
  * Add support of onetime authentication for header verification.

 -- Max Lv <max.c.lv@gmail.com>  Fri, 04 Sep 2015 07:54:02 +0900

shadowsocks-libev (2.3.0-1) unstable; urgency=low

  * Add manager mode to support multi-user and traffic stat.
  * Fix a build issue on OS X El Capitan.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 30 Jul 2015 17:30:43 +0900

shadowsocks-libev (2.2.3-1) unstable; urgency=high

  * Fix the multiple UDP source port issue.
  * Allow working in UDP only mode.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 11 Jul 2015 08:31:02 +0900

shadowsocks-libev (2.2.2-1) unstable; urgency=low

  * Fix the timer of UDP relay.
  * Check name_len in the header.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 15 Jun 2015 10:26:40 +0900

shadowsocks-libev (2.2.1-1) unstable; urgency=low

  * Fix an issue of UDP relay.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 10 May 2015 21:23:44 +0900

shadowsocks-libev (2.2.0-1) unstable; urgency=low

  * Add TPROXY support in redir mode.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 04 May 2015 02:44:17 -0300

shadowsocks-libev (2.1.4-1) unstable; urgency=low

  * Fix a bug of server mode ACL.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 08 Feb 2015 20:24:43 +0900

shadowsocks-libev (2.1.3-1) unstable; urgency=low

  * Add ACL support to remote server.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 08 Feb 2015 10:59:44 +0900

shadowsocks-libev (2.1.2-1) unstable; urgency=low

  * Refine multiple port binding.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 31 Jan 2015 18:56:25 +0900

shadowsocks-libev (2.1.1-1) unstable; urgency=low

  * Fix a memory leak.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 21 Jan 2015 21:40:58 +0900

shadowsocks-libev (2.1.0-1) unstable; urgency=low

  * Fix a bug of tunnel mode.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 19 Jan 2015 09:59:52 +0900

shadowsocks-libev (2.0.8-1) unstable; urgency=low

  * Fix a bug of IPv6.

 -- Max Lv <max.c.lv@gmail.com>  Fri, 16 Jan 2015 10:58:12 +0900

shadowsocks-libev (2.0.7-1) unstable; urgency=low

  * Fix some performance issue.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 13 Jan 2015 13:17:58 +0900

shadowsocks-libev (2.0.6-1) unstable; urgency=high

  * Fix a critical issue in redir mode.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 12 Jan 2015 21:51:19 +0900

shadowsocks-libev (2.0.5-1) unstable; urgency=low

  * Refine local, tunnel, and redir modes.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 12 Jan 2015 12:39:05 +0800

shadowsocks-libev (2.0.4-1) unstable; urgency=low

  * Fix building issues with MinGW32.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 11 Jan 2015 13:33:31 +0900

shadowsocks-libev (2.0.3-1) unstable; urgency=high

  * Fix some issues.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 10 Jan 2015 16:27:54 +0800

shadowsocks-libev (2.0.2-1) unstable; urgency=low

  * Fix issues with MinGW.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 10 Jan 2015 15:17:10 +0800

shadowsocks-libev (2.0.1-1) unstable; urgency=low

  * Implement a real asynchronous DNS resolver.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 10 Jan 2015 10:04:28 +0800

shadowsocks-libev (1.6.4-1) unstable; urgency=low

  * Update documents.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 07 Jan 2015 21:48:58 +0900

shadowsocks-libev (1.6.3-1) unstable; urgency=low

  * Refine ss-redir.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 04 Jan 2015 19:23:52 +0900

shadowsocks-libev (1.6.2-1) unstable; urgency=low

  * Fix some build issues.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 30 Dec 2014 10:30:28 +0800

shadowsocks-libev (1.6.1-1) unstable; urgency=high

  * Add salsa20 and chacha20 support.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 13 Dec 2014 15:11:34 +0800

shadowsocks-libev (1.6.0-1) unstable; urgency=low

  * Solve conflicts with other shadowsocks portings.

 -- Max Lv <max.c.lv@gmail.com>  Mon, 17 Nov 2014 14:10:21 +0800

shadowsocks-libev (1.5.3-2) unstable; urgency=low

  * rename as shadowsocks-libev.

 -- Symeon Huang <hzwhuang@gmail.com>  Sat, 15 Nov 2014 14:55:28 +0000

shadowsocks (1.5.3-1) unstable; urgency=low

  * Fix log on Win32.

 -- Max Lv <max.c.lv@gmail.com>  Fri, 14 Nov 2014 09:10:06 +0800

shadowsocks (1.5.2-1) unstable; urgency=low

  * Handle SIGTERM and SIGKILL nicely.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 12 Nov 2014 13:11:29 +0800

shadowsocks (1.5.1-1) unstable; urgency=low

  * Fix a bug of tcp fast open.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 08 Nov 2014 19:45:37 +0900

shadowsocks (1.5.0-1) unstable; urgency=low

  * Support to build static or shared library.
  * Supprot IPv6 NAT in redirect mode.
  * Refine the cache size of UDPRelay.

 -- Max Lv <max.c.lv@gmail.com>  Fri, 07 Nov 2014 09:33:19 +0800

shadowsocks (1.4.8-1) unstable; urgency=low

  * Fix a bug of tcp fast open.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 08 Oct 2014 18:02:02 +0800

shadowsocks (1.4.7-1) unstable; urgency=low

  * Add a new encryptor rc4-md5.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 09 Sep 2014 07:50:10 +0800

shadowsocks (1.4.6-1) unstable; urgency=low

  * Add ACL support.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 03 May 2014 04:37:10 -0400

shadowsocks (1.4.5-1) unstable; urgency=high

  * Fix the compatibility issue of udprelay.
  * Enhance asyncns to reduce the latency.
  * Add TCP_FASTOPEN support.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 20 Apr 2014 08:12:45 +0800

shadowsocks (1.4.4-1) unstable; urgency=low

  * Add CommonCrypto support for darwin.
  * Fix some config related issues.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 26 Mar 2014 13:29:03 +0800

shadowsocks (1.4.3-1) unstable; urgency=low

  * Add tunnel mode with local port forwarding feature.

 -- Max Lv <max.c.lv@gmail.com>  Fri, 21 Feb 2014 11:52:13 +0900

shadowsocks (1.4.2-1) unstable; urgency=high

  * Fix the UDP relay issues.
  * Add syslog support.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 05 Jan 2014 10:05:29 +0900

shadowsocks (1.4.1-1) unstable; urgency=low

  * Add multi-port support.
  * Add PolarSSL support by @linusyang.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 12 Nov 2013 03:57:21 +0000

shadowsocks (1.4.0-1) unstable; urgency=low

  * Add standard socks5 udp support.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 08 Sep 2013 02:20:40 +0000

shadowsocks (1.3.3-1) unstable; urgency=high

  * Provide more info in verbose mode.

 -- Max Lv <max.c.lv@gmail.com>  Fri, 21 Jun 2013 09:59:20 +0800

shadowsocks (1.3.2-1) unstable; urgency=high

  * Fix some ciphers by @linusyang.

 -- Max Lv <max.c.lv@gmail.com>  Sun, 09 Jun 2013 09:52:31 +0000

shadowsocks (1.3.1-1) unstable; urgency=low

  * Support more cihpers: camellia, idea, rc2 and seed.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 04 Jun 2013 00:56:17 +0000

shadowsocks (1.3-1) unstable; urgency=low

  * Able to bind connections to specific interface.
  * Support more ciphers: aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 16 May 2013 10:51:15 +0800

shadowsocks (1.2-2) unstable; urgency=low

  * Close timeouted TCP connections.

 -- Max Lv <max.c.lv@gmail.com>  Tue, 07 May 2013 14:10:33 +0800

shadowsocks (1.2-1) unstable; urgency=low

  * Fix a high load issue.

 -- Max Lv <max.c.lv@gmail.com>  Thu, 18 Apr 2013 10:52:34 +0800

shadowsocks (1.1-1) unstable; urgency=low

  * Fix a IPV6 resolve issue.

 -- Max Lv <max.c.lv@gmail.com>  Wed, 10 Apr 2013 12:11:36 +0800

shadowsocks (1.0-2) unstable; urgency=low

  * Initial release.

 -- Max Lv <max.c.lv@gmail.com>  Sat, 06 Apr 2013 16:59:15 +0800


================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS



================================================
FILE: README.md
================================================
# shadowsocks-libev

[![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)

## Intro

[Shadowsocks-libev](https://shadowsocks.org) is a lightweight secured SOCKS5
proxy for embedded devices and low-end boxes.

It is a port of [Shadowsocks](https://github.com/shadowsocks/shadowsocks)
created by [@clowwindy](https://github.com/clowwindy), and maintained by
[@madeye](https://github.com/madeye) and [@linusyang](https://github.com/linusyang).

Current version: 3.3.6 | [Changelog](debian/changelog)

## Features

Shadowsocks-libev is written in pure C and depends on [libev](http://software.schmorp.de/pkg/libev.html). It's designed
to be a lightweight implementation of shadowsocks protocol, in order to keep the resource usage as low as possible.

For a full list of feature comparison between different versions of shadowsocks,
refer to the [Wiki page](https://github.com/shadowsocks/shadowsocks/wiki/Feature-Comparison-across-Different-Versions).

## Quick Start

Snap is the recommended way to install the latest binaries.

### Install snap core

https://snapcraft.io/core

### Install from snapcraft.io

Stable channel:

```bash
sudo snap install shadowsocks-libev
```

Edge channel:

```bash
sudo snap install shadowsocks-libev --edge
```

## Installation

### Distribution-specific guide

- [Debian & Ubuntu](#debian--ubuntu)
    + [Install from repository](#install-from-repository-not-recommended)
    + [Build deb package from source](#build-deb-package-from-source)
    + [Configure and start the service](#configure-and-start-the-service)
- [Fedora & RHEL](#fedora--rhel)
    + [Build from source with centos](#build-from-source-with-centos)
- [Archlinux & Manjaro](#archlinux--manjaro)
- [NixOS](#nixos)
- [Nix](#nix)
- [Directly build and install on UNIX-like system](#linux)
- [FreeBSD](#freebsd)
    + [Install](#install)
    + [Configuration](#configuration)
    + [Run](#run)
    + [Run as client](#run-as-client)
- [OpenWRT](#openwrt)
- [OS X](#os-x)
- [Windows (MinGW)](#windows-mingw)
- [Docker](#docker)

* * *

### Build from source (CMake)

shadowsocks-libev uses CMake as its sole build system. Start by pulling submodules:

```bash
git submodule update --init --recursive
```

Then build:

```bash
mkdir -p build && cd build
cmake ..
make
sudo make install
```

To run unit tests:

```bash
cd build
ctest --output-on-failure
```

#### CMake options

For a complete list of available options, run `cmake -LH` from a build directory.
Commonly used options:

| Option | Default | Description |
|---|---|---|
| `-DWITH_EMBEDDED_SRC=OFF` | `ON` | Use system libcork/libipset/libbloom instead of bundled submodules |
| `-DWITH_DOC_MAN=OFF` | `ON` | Skip man page generation (removes asciidoc/xmlto dependency) |
| `-DBUILD_TESTING=OFF` | `ON` | Disable unit tests |
| `-DENABLE_CONNMARKTOS=ON` | `OFF` | Linux netfilter conntrack QoS support |
| `-DENABLE_NFTABLES=ON` | `OFF` | nftables firewall integration |

On macOS, if libraries are installed via Homebrew, specify paths:

```bash
cmake .. -DCMAKE_PREFIX_PATH="/usr/local/opt/mbedtls;/usr/local/opt/libsodium"
```

### Debian & Ubuntu

#### Install from repository (not recommended)

Shadowsocks-libev is available in the official repository for following distributions:

* Debian 8 or higher, including oldoldstable (jessie), old stable (stretch), stable (buster), testing (bullseye) and unstable (sid)
* Ubuntu 16.10 or higher

```bash
sudo apt update
sudo apt install shadowsocks-libev
```

#### Build deb package from source

You can build shadowsocks-libev and all its dependencies by script:

```bash
mkdir -p ~/build-area/
cp ./scripts/build_deb.sh ~/build-area/
cd ~/build-area
./build_deb.sh
```

For older systems, building `.deb` packages is not supported.
Please try to build and install directly from source. See the [Linux](#linux) section below.

#### Configure and start the service

```
# Edit the configuration file
sudo vim /etc/shadowsocks-libev/config.json

# Edit the default configuration for debian
sudo vim /etc/default/shadowsocks-libev

# Start the service
sudo /etc/init.d/shadowsocks-libev start    # for sysvinit, or
sudo systemctl start shadowsocks-libev      # for systemd
```

### Fedora & RHEL

Supported distributions:

* Recent Fedora versions (until EOL)
* RHEL 6, 7 and derivatives (including CentOS, Scientific Linux)

#### Build from source with centos

If you are using CentOS 7, you need to install these prerequirements to build from source code:

```bash
yum install epel-release -y
yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto c-ares-devel libev-devel libsodium-devel mbedtls-devel -y
```

### Archlinux & Manjaro

```bash
sudo pacman -S shadowsocks-libev
```

Please refer to downstream [PKGBUILD](https://github.com/archlinux/svntogit-community/blob/packages/shadowsocks-libev/trunk/PKGBUILD)
script for extra modifications and distribution-specific bugs.

### NixOS

```bash
nix-env -iA nixos.shadowsocks-libev
```

### Nix

```bash
nix-env -iA nixpkgs.shadowsocks-libev
```

### Linux

In general, you need the following build dependencies:

* cmake (>= 3.2)
* a C compiler (gcc or clang)
* pkg-config
* libmbedtls
* libsodium (>= 1.0.4)
* libpcre2
* libev
* libc-ares
* asciidoc (for documentation only)
* xmlto (for documentation only)

If your system is too old to provide libmbedtls and libsodium (>= 1.0.4), you will need to either install those libraries manually or upgrade your system.

Install build dependencies for your distribution:

```bash
# Debian / Ubuntu
sudo apt-get install --no-install-recommends build-essential cmake pkg-config \
    libpcre2-dev libev-dev libc-ares-dev libmbedtls-dev libsodium-dev \
    asciidoc xmlto

# CentOS / Fedora / RHEL
sudo yum install gcc cmake make pkg-config pcre2-devel c-ares-devel \
    libev-devel libsodium-devel mbedtls-devel asciidoc xmlto

# Arch
sudo pacman -S gcc cmake make pkg-config pcre2 c-ares libev libsodium mbedtls \
    asciidoc xmlto
```

Then build and install:

```bash
git submodule update --init --recursive
mkdir -p build && cd build
cmake ..
make
sudo make install
```

### FreeBSD
#### Install
Shadowsocks-libev is available in FreeBSD Ports Collection. You can install it in either way, `pkg` or `ports`.

**pkg (recommended)**

```bash
pkg install shadowsocks-libev
```

**ports**

```bash
cd /usr/ports/net/shadowsocks-libev
make install
```

#### Configuration
Edit your `config.json` file. By default, it's located in `/usr/local/etc/shadowsocks-libev`.

To enable shadowsocks-libev, add the following rc variable to your `/etc/rc.conf` file:

```
shadowsocks_libev_enable="YES"
```

#### Run

Start the Shadowsocks server:

```bash
service shadowsocks_libev start
```

#### Run as client
By 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.

```
# modify the following line from "ss-server" to "ss-local"
command="/usr/local/bin/ss-local"
```

Note that is simply a workaround, each time you upgrade the port your changes will be overwritten by the new version.

### OpenWRT

The OpenWRT project is maintained here:
[openwrt-shadowsocks](https://github.com/shadowsocks/openwrt-shadowsocks).

### OS X
For OS X, use [Homebrew](http://brew.sh) to install or build.

Install Homebrew:

```bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
Install shadowsocks-libev:

```bash
brew install shadowsocks-libev
```

### Windows (MinGW)
To build Windows native binaries, the recommended method is to use Docker:

* On Windows: double-click `make.bat` in `docker\mingw`
* On Unix-like system:

        cd shadowsocks-libev/docker/mingw
        make

A tarball with 32-bit and 64-bit binaries will be generated in the same directory.

You 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`.

Currently you need to use a patched libev library for MinGW:

* https://github.com/shadowsocks/libev/archive/mingw.zip

Notice that TCP Fast Open (TFO) is only available on **Windows 10**, **1607** or later version (precisely, build >= 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:

        netsh int tcp set global fastopenfallback=disabled

### Docker

As you expect, simply pull the image and run.
```
docker pull shadowsocks/shadowsocks-libev
docker run -e PASSWORD=<password> -p<server-port>:8388 -p<server-port>:8388/udp -d shadowsocks/shadowsocks-libev
```

More information about the image can be found [here](docker/alpine/README.md).

## Usage

For a detailed and complete list of all supported arguments,
you may refer to the man pages of the applications, respectively.

    ss-[local|redir|server|tunnel|manager]

       -s <server_host>           Host name or IP address of your remote server.

       -p <server_port>           Port number of your remote server.

       -l <local_port>            Port number of your local server.

       -k <password>              Password of your remote server.

       -m <encrypt_method>        Encrypt method: rc4-md5,
                                  aes-128-gcm, aes-192-gcm, aes-256-gcm,
                                  aes-128-cfb, aes-192-cfb, aes-256-cfb,
                                  aes-128-ctr, aes-192-ctr, aes-256-ctr,
                                  camellia-128-cfb, camellia-192-cfb,
                                  camellia-256-cfb, bf-cfb,
                                  chacha20-ietf-poly1305,
                                  xchacha20-ietf-poly1305,
                                  salsa20, chacha20 and chacha20-ietf.
                                  The default cipher is chacha20-ietf-poly1305.

       [-a <user>]                Run as another user.

       [-f <pid_file>]            The file path to store pid.

       [-t <timeout>]             Socket timeout in seconds.

       [-c <config_file>]         The path to config file.

       [-n <number>]              Max number of open files.

       [-i <interface>]           Network interface to bind.
                                  (not available in redir mode)

       [-b <local_address>]       Local address to bind.
                                  For servers: Specify the local address to use 
                                  while this server is making outbound 
                                  connections to remote servers on behalf of the
                                  clients.
                                  For clients: Specify the local address to use 
                                  while this client is making outbound 
                                  connections to the server.

       [-u]                       Enable UDP relay.
                                  (TPROXY is required in redir mode)

       [-U]                       Enable UDP relay and disable TCP relay.
                                  (not available in local mode)

       [-T]                       Use tproxy instead of redirect. (for tcp)
                                  (only available in redir mode)

       [-L <addr>:<port>]         Destination server address and port
                                  for local port forwarding.
                                  (only available in tunnel mode)

       [-6]                       Resolve hostname to IPv6 address first.

       [-d <addr>]                Name servers for internal DNS resolver.
                                  (only available in server mode)

       [--reuse-port]             Enable port reuse.

       [--fast-open]              Enable TCP fast open.
                                  with Linux kernel > 3.7.0.
                                  (only available in local and server mode)

       [--acl <acl_file>]         Path to ACL (Access Control List).
                                  (only available in local and server mode)

       [--manager-address <addr>] UNIX domain socket address.
                                  (only available in server and manager mode)

       [--mtu <MTU>]              MTU of your network interface.

       [--mptcp]                  Enable Multipath TCP on MPTCP Kernel.

       [--no-delay]               Enable TCP_NODELAY.

       [--executable <path>]      Path to the executable of ss-server.
                                  (only available in manager mode)

       [-D <path>]                Path to the working directory of ss-manager.
                                  (only available in manager mode)

       [--key <key_in_base64>]    Key of your remote server.

       [--plugin <name>]          Enable SIP003 plugin. (Experimental)

       [--plugin-opts <options>]  Set SIP003 plugin options. (Experimental)

       [-v]                       Verbose mode.

## Helper Scripts

### ss-setup

`ss-setup` is an interactive TUI (text user interface) tool for setting up shadowsocks-libev server and client configurations. It uses `whiptail` or `dialog` for the menu interface.

It is installed automatically by `make install` and can also be run directly from `scripts/ss-setup.sh`.

**Prerequisites:** `whiptail` or `dialog`, `openssl` (optional, for password generation)

#### Server setup (with systemd service)

Run as root for full functionality (config + systemd service installation):

```bash
sudo ss-setup
```

This launches an interactive menu that walks you through:
1. Choosing a config instance name
2. Setting the listen address and port (manual or random high port)
3. Selecting an AEAD cipher (chacha20-ietf-poly1305, aes-256-gcm, etc.)
4. Generating or entering a password
5. Configuring timeout, network mode (TCP/UDP), and TCP Fast Open
6. Optionally selecting a SIP003 plugin
7. Installing and starting a systemd service

The config is saved to `/etc/shadowsocks-libev/<name>.json` and a systemd template service `shadowsocks-libev-server@<name>.service` is created.

At the end, it displays a `ss://` URI you can import into clients.

#### Client config generation

Select "Generate ss-local client config" from the main menu. The wizard prompts for the remote server address, port, cipher, password, and local SOCKS5 port, then writes a JSON config:

```bash
# Run without root to generate config in the current directory
ss-setup
# Select: client -> fill in server details -> save

# Then start the client
ss-local -c ~/ss-client.json
```

#### Config-only mode (non-root)

When run without root, `ss-setup` skips service installation and plugin management, but still generates config files in the current directory:

```bash
ss-setup
# Config saved to ./config.json (in current directory)
# Start manually:
ss-server -c ./config.json
```

#### Service management

From the main menu, select "Manage running services" to start, stop, restart, enable/disable, or view logs for any configured instance:

```
sudo ss-setup
# Select: service -> pick instance -> start/stop/restart/logs
```

#### Plugin installation

Select "Install a SIP003 plugin" from the main menu (requires root). Supports automatic download of:
- simple-obfs (build from source or package manager)
- v2ray-plugin (GitHub release)
- xray-plugin (GitHub release)
- kcptun (GitHub release)
- Custom plugin binary

### ss-nat

`ss-nat` is a helper script that sets up iptables NAT rules for `ss-redir` to provide transparent TCP/UDP redirection. It is installed on Linux systems by `make install`.

**Prerequisites:** Linux with `iptables`, `ipset`, and optionally TPROXY kernel module for UDP

#### Basic usage (TCP redirect)

```bash
# Start ss-redir first
ss-redir -s YOUR_SERVER_IP -p 8388 -l 1080 -k PASSWORD -m chacha20-ietf-poly1305 -u

# Set up NAT rules to redirect TCP traffic through ss-redir
sudo ss-nat -s YOUR_SERVER_IP -l 1080
```

#### Enable UDP relay with TPROXY

```bash
sudo ss-nat -s YOUR_SERVER_IP -l 1080 -u
```

#### Apply rules to OUTPUT chain (proxy the local machine itself)

```bash
sudo ss-nat -s YOUR_SERVER_IP -l 1080 -u -o
```

#### Use separate TCP/UDP servers

```bash
sudo ss-nat -s TCP_SERVER_IP -l 1080 -S UDP_SERVER_IP -L 1080 -U
```

#### Bypass specific WAN IPs

```bash
sudo ss-nat -s YOUR_SERVER_IP -l 1080 -b "1.2.3.4 5.6.7.8"
```

#### Use a bypass IP list file

```bash
# Create a file with one IP/CIDR per line
echo "1.2.3.0/24" > /etc/ss-bypass.list
echo "5.6.7.0/24" >> /etc/ss-bypass.list

sudo ss-nat -s YOUR_SERVER_IP -l 1080 -i /etc/ss-bypass.list
```

#### LAN access control

```bash
# Whitelist mode: only proxy traffic from these LAN IPs
sudo ss-nat -s YOUR_SERVER_IP -l 1080 -a "w192.168.1.10 192.168.1.20"

# Blacklist mode: proxy all LAN traffic except these IPs
sudo ss-nat -s YOUR_SERVER_IP -l 1080 -a "b192.168.1.100"
```

#### Flush all rules

```bash
sudo ss-nat -f
```

#### Complete example: transparent proxy gateway

Set up a Linux box as a transparent proxy gateway for the entire LAN:

```bash
# 1. Start ss-redir with UDP relay
ss-redir -s YOUR_SERVER_IP -p 8388 -l 1080 -k PASSWORD \
    -m chacha20-ietf-poly1305 -u -f /var/run/ss-redir.pid

# 2. Set up NAT rules (TCP + UDP, apply to local OUTPUT too)
sudo ss-nat -s YOUR_SERVER_IP -l 1080 -u -o -I eth0

# 3. Point other devices' default gateway to this machine's LAN IP
#    and set their DNS to a public resolver (e.g., 1.1.1.1 or 8.8.8.8)

# To tear down:
sudo ss-nat -f
```

## Transparent proxy (manual iptables)

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

Note: For most use cases, [`ss-nat`](#ss-nat) above is simpler than writing iptables rules manually.

    # Create new chain
    iptables -t nat -N SHADOWSOCKS
    iptables -t mangle -N SHADOWSOCKS

    # Ignore your shadowsocks server's addresses
    # It's very IMPORTANT, just be careful.
    iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN

    # Ignore LANs and any other addresses you'd like to bypass the proxy
    # See Wikipedia and RFC5735 for full list of reserved networks.
    # See ashi009/bestroutetb for a highly optimized CHN route list.
    iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN

    # Anything else should be redirected to shadowsocks's local port
    iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345

    # Add any UDP rules
    ip route add local default dev lo table 100
    ip rule add fwmark 1 lookup 100
    iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01

    # Apply the rules
    iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
    iptables -t mangle -A PREROUTING -j SHADOWSOCKS

    # Start the shadowsocks-redir
    ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid

## Transparent proxy (pure tproxy)

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

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

```shell
#!/bin/bash

start_ssredir() {
    # please modify MyIP, MyPort, etc.
    (ss-redir -s MyIP -p MyPort -m MyMethod -k MyPasswd -b 127.0.0.1 -l 60080 --no-delay -u -T -v </dev/null &>>/var/log/ss-redir.log &)
}

stop_ssredir() {
    kill -9 $(pidof ss-redir) &>/dev/null
}

start_iptables() {
    ##################### SSREDIR #####################
    iptables -t mangle -N SSREDIR

    # connection-mark -> packet-mark
    iptables -t mangle -A SSREDIR -j CONNMARK --restore-mark
    iptables -t mangle -A SSREDIR -m mark --mark 0x2333 -j RETURN

    # please modify MyIP, MyPort, etc.
    # ignore traffic sent to ss-server
    iptables -t mangle -A SSREDIR -p tcp -d MyIP --dport MyPort -j RETURN
    iptables -t mangle -A SSREDIR -p udp -d MyIP --dport MyPort -j RETURN

    # ignore traffic sent to reserved addresses
    iptables -t mangle -A SSREDIR -d 0.0.0.0/8          -j RETURN
    iptables -t mangle -A SSREDIR -d 10.0.0.0/8         -j RETURN
    iptables -t mangle -A SSREDIR -d 100.64.0.0/10      -j RETURN
    iptables -t mangle -A SSREDIR -d 127.0.0.0/8        -j RETURN
    iptables -t mangle -A SSREDIR -d 169.254.0.0/16     -j RETURN
    iptables -t mangle -A SSREDIR -d 172.16.0.0/12      -j RETURN
    iptables -t mangle -A SSREDIR -d 192.0.0.0/24       -j RETURN
    iptables -t mangle -A SSREDIR -d 192.0.2.0/24       -j RETURN
    iptables -t mangle -A SSREDIR -d 192.88.99.0/24     -j RETURN
    iptables -t mangle -A SSREDIR -d 192.168.0.0/16     -j RETURN
    iptables -t mangle -A SSREDIR -d 198.18.0.0/15      -j RETURN
    iptables -t mangle -A SSREDIR -d 198.51.100.0/24    -j RETURN
    iptables -t mangle -A SSREDIR -d 203.0.113.0/24     -j RETURN
    iptables -t mangle -A SSREDIR -d 224.0.0.0/4        -j RETURN
    iptables -t mangle -A SSREDIR -d 240.0.0.0/4        -j RETURN
    iptables -t mangle -A SSREDIR -d 255.255.255.255/32 -j RETURN

    # mark the first packet of the connection
    iptables -t mangle -A SSREDIR -p tcp --syn                      -j MARK --set-mark 0x2333
    iptables -t mangle -A SSREDIR -p udp -m conntrack --ctstate NEW -j MARK --set-mark 0x2333

    # packet-mark -> connection-mark
    iptables -t mangle -A SSREDIR -j CONNMARK --save-mark

    ##################### OUTPUT #####################
    # proxy the outgoing traffic from this machine
    iptables -t mangle -A OUTPUT -p tcp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR
    iptables -t mangle -A OUTPUT -p udp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR

    ##################### PREROUTING #####################
    # proxy traffic passing through this machine (other->other)
    iptables -t mangle -A PREROUTING -p tcp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR
    iptables -t mangle -A PREROUTING -p udp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR

    # hand over the marked package to TPROXY for processing
    iptables -t mangle -A PREROUTING -p tcp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080
    iptables -t mangle -A PREROUTING -p udp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080
}

stop_iptables() {
    ##################### PREROUTING #####################
    iptables -t mangle -D PREROUTING -p tcp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080 &>/dev/null
    iptables -t mangle -D PREROUTING -p udp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080 &>/dev/null

    iptables -t mangle -D PREROUTING -p tcp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR &>/dev/null
    iptables -t mangle -D PREROUTING -p udp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR &>/dev/null

    ##################### OUTPUT #####################
    iptables -t mangle -D OUTPUT -p tcp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR &>/dev/null
    iptables -t mangle -D OUTPUT -p udp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR &>/dev/null

    ##################### SSREDIR #####################
    iptables -t mangle -F SSREDIR &>/dev/null
    iptables -t mangle -X SSREDIR &>/dev/null
}

start_iproute2() {
    ip route add local default dev lo table 100
    ip rule  add fwmark 0x2333        table 100
}

stop_iproute2() {
    ip rule  del   table 100 &>/dev/null
    ip route flush table 100 &>/dev/null
}

start_resolvconf() {
    # or nameserver 8.8.8.8, etc.
    echo "nameserver 1.1.1.1" >/etc/resolv.conf
}

stop_resolvconf() {
    echo "nameserver 114.114.114.114" >/etc/resolv.conf
}

start() {
    echo "start ..."
    start_ssredir
    start_iptables
    start_iproute2
    start_resolvconf
    echo "start end"
}

stop() {
    echo "stop ..."
    stop_resolvconf
    stop_iproute2
    stop_iptables
    stop_ssredir
    echo "stop end"
}

restart() {
    stop
    sleep 1
    start
}

main() {
    if [ $# -eq 0 ]; then
        echo "usage: $0 start|stop|restart ..."
        return 1
    fi

    for funcname in "$@"; do
        if [ "$(type -t $funcname)" != 'function' ]; then
            echo "'$funcname' not a shell function"
            return 1
        fi
    done

    for funcname in "$@"; do
        $funcname
    done
    return 0
}
main "$@"
```

## Security Tips

For any public server, to avoid users accessing localhost of your server, please add `--acl acl/server_block_local.acl` to the command line.

Although shadowsocks-libev can handle thousands of concurrent connections nicely, we still recommend
setting up your server's firewall rules to limit connections from each user:

    # Up to 32 connections are enough for normal usage
    iptables -A INPUT -p tcp --syn --dport ${SHADOWSOCKS_PORT} -m connlimit --connlimit-above 32 -j REJECT --reject-with tcp-reset

## License

```
Copyright: 2013-2015, Clow Windy <clowwindy42@gmail.com>
           2013-2018, Max Lv <max.c.lv@gmail.com>
           2014, Linus Yang <linusyang@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```


================================================
FILE: README_pt_BR.md
================================================
# shadowsocks-libev

[![Build Status](https://travis-ci.com/shadowsocks/shadowsocks-libev.svg?branch=master)](https://travis-ci.com/shadowsocks/shadowsocks-libev) [![Snap Status](https://build.snapcraft.io/badge/shadowsocks/shadowsocks-libev.svg)](https://build.snapcraft.io/user/shadowsocks/shadowsocks-libev)

## Introdução

[Shadowsocks-libev](https://shadowsocks.org) é um SOCKS5 leve e seguro
proxy para dispositivos embutidos e caixas de baixo custo.

É uma porta de [Shadowsocks](https://github.com/shadowsocks/shadowsocks)
criado por [@clowwindy](https://github.com/clowwindy) e mantido por
[@madeye](https://github.com/madeye) e [@linusyang](https://github.com/linusyang).

Versão atual: 3.3.6 | [Changelog](debian/changelog)

## Características

Shadowsocks-libev é escrito em C puro e depende de [libev](http://software.schmorp.de/pkg/libev.html). Ele foi projetado para ser uma implementação leve do protocolo shadowsocks, a fim de manter o uso de recursos o mais baixo possível.

Para obter uma lista completa de comparação de recursos entre diferentes versões de shadowsocks, consulte a [página da Wiki (https://github.com/shadowsocks/shadowsocks/wiki/Feature-Comparison-across-Different-Versions).

## Começo rápido

Snap é a maneira recomendada de instalar os binários mais recentes.

### Instale o snap core

https://snapcraft.io/core

### Instalar a partir do snapcraft.io

Stable channel:

```bash
sudo snap install shadowsocks-libev
```

Edge channel:

```bash
sudo snap install shadowsocks-libev --edge
```

## Instalação

### Guia específico de distribuição

- [Debian & Ubuntu](#debian--ubuntu)
    + [Instalar do repositório](#instale-a-partir-do-repositório-não-recomendado)
    + [Construa o pacote deb a partir da fonte](#compile-o-pacote-deb-a-partir-da-fonte)
    + [Configurar e iniciar o serviço](#configurar-e-iniciar-o-serviço)
- [Fedora & RHEL](#fedora--rhel)
     + [Construir a partir da fonte com centos](#construa-a-partir-da-fonte-com-centos)
- [Archlinux & Manjaro](#archlinux--manjaro)
- [NixOS](#nixos)
- [Nix](#nix)
- [Compile e instale diretamente no sistema semelhante ao UNIX](#linux)
- [FreeBSD](#freebsd)
     + [Instalar](#instalar)
     + [Configuração](#configuração)
     + [Executar](#executar)
     + [Executar como cliente](#executar-como-cliente)
- [OpenWRT](#openwrt)
- [OS X](#os-x)
- [Windows (MinGW)](#windows-mingw)
- [Docker](#docker)

* * *

### Inicialize o ambiente de compilação

Este repositório usa submódulos, então você deve puxá-los antes de começar, usando:

```bash
git submodule update --init --recursive
```

### Guia de configuração de pré-compilação

Para obter uma lista completa das opções de tempo de configuração disponíveis,
tentar `configure --help`.

### Debian & Ubuntu

#### Instale a partir do repositório (não recomendado)

Shadowsocks-libev está disponível no repositório oficial para as seguintes distribuições:

* Debian 8 ou superior, incluindo oldoldstable (jessie), old stable (stretch), stable (buster), testing (bullseye) e unstable (sid)
* Ubuntu 16.10 ou superior

```bash
sudo apt update
sudo apt install shadowsocks-libev
```

#### Compile o pacote deb a partir da fonte.

Distribuições suportadas:

* Debian 8, 9 ou superior
* Ubuntu 14.04 LTS, 16.04 LTS, 16.10 ou superior

Você pode construir shadowsocks-libev e todas as suas dependências por script:

```bash
mkdir -p ~/build-area/
cp ./scripts/build_deb.sh ~/build-area/
cd ~/build-area
./build_deb.sh
```

Para sistemas mais antigos, a construção de pacotes `.deb` não é suportada.
Por favor, tente construir e instalar diretamente da fonte. Veja a seção [Linux](#linux) abaixo.

**Nota para usuários do Debian 8 (Jessie) para construir seus próprios pacotes deb**:

Nós encorajamos você a instalar shadowsocks-libev de `jessie-backports-sloppy`. Se você insistir em compilar a partir da fonte, você precisará instalar manualmente o libsodium de `jessie-backports-sloppy`, **NÃO** libsodium no repositório principal.

Para mais informações sobre backports, você pode consultar [Debian Backports](https://backports.debian.org).

``` bash
cd shadowsocks-libev
sudo sh -c 'printf "deb http://deb.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list'
sudo sh -c 'printf "deb http://deb.debian.org/debian jessie-backports-sloppy main" >> /etc/apt/sources.list.d/jessie-backports.list'
sudo apt-get install --no-install-recommends devscripts equivs
mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
./autogen.sh && dpkg-buildpackage -b -us -uc
cd ..
sudo dpkg -i shadowsocks-libev*.deb
```

**Nota para usuários do Debian 9 (Stretch) para construir seus próprios pacotes deb**:

Nós encorajamos você a instalar shadowsocks-libev de `stretch-backports`. Se você insistir em compilar a partir do código-fonte, precisará instalar manualmente o libsodium de `stretch-backports`, **NÃO** libsodium no repositório principal.

Para mais informações sobre backports, você pode consultar [Debian Backports](https://backports.debian.org).

``` bash
cd shadowsocks-libev
sudo sh -c 'printf "deb http://deb.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/stretch-backports.list'
sudo apt-get install --no-install-recommends devscripts equivs
mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
./autogen.sh && dpkg-buildpackage -b -us -uc
cd ..
sudo dpkg -i shadowsocks-libev*.deb
```

#### Configurar e iniciar o serviço

```
# Edite o arquivo de configuração
sudo vim /etc/shadowsocks-libev/config.json

# Edite a configuração padrão do debian
sudo vim /etc/default/shadowsocks-libev

# Inicia o serviço
sudo /etc/init.d/shadowsocks-libev start    # para sysvinit, ou
sudo systemctl start shadowsocks-libev      # para systemd
```

### Fedora & RHEL

Distribuições suportadas:

* Versões recentes do Fedora (até EOL)
* RHEL 6, 7 e derivados (incluindo CentOS, Scientific Linux)

#### Construa a partir da fonte com centos

Se você estiver usando o CentOS 7, precisará instalar estes pré-requisitos para compilar a partir do código-fonte:

```bash
yum install epel-release -y
yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto c-ares-devel libev-devel libsodium-devel mbedtls-devel -y
```

### Archlinux & Manjaro

```bash
sudo pacman -S shadowsocks-libev
```

Consulte o script downstream [PKGBUILD](https://github.com/archlinux/svntogit-community/blob/packages/shadowsocks-libev/trunk/PKGBUILD) para modificações extras e bugs específicos da distribuição.

### NixOS

```bash
nix-env -iA nixos.shadowsocks-libev
```

### Nix

```bash
nix-env -iA nixpkgs.shadowsocks-libev
```

### Linux

Em geral, você precisa das seguintes dependências de compilação:

* autotools (autoconf, automake, libtool)
* gettext
* pkg-config
* libmbedtls
* libsodium
* libpcre3 (antiga biblioteca pcre)
* libev
* libc-ares
* asciidoc (somente para documentação)
* xmlto (apenas para documentação)

Notas: Fedora 26 libsodium versão >= 1.0.12, então você pode instalar via dnf install libsodium em vez de compilar a partir da fonte.

Se seu sistema for muito antigo para fornecer libmbedtls e libsodium (posterior a **v1.0.8**), você precisará instalar essas bibliotecas manualmente ou atualizar seu sistema.

Se o seu sistema fornece essas bibliotecas, você **não deve** instalá-las a partir do código-fonte. Você deve ir para esta seção e instalá-las a partir do repositório de distribuição.

Para algumas das distribuições, você pode instalar dependências de compilação como esta:

```bash
# Instalação de dependências básicas de compilação
## Debian / Ubuntu
sudo 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
## CentOS / Fedora / RHEL
sudo yum install gettext gcc autoconf libtool automake make asciidoc xmlto c-ares-devel libev-devel
## Arch
sudo pacman -S gettext gcc autoconf libtool automake make asciidoc xmlto c-ares libev

# Instalação do libsodium
export LIBSODIUM_VER=1.0.16
wget https://download.libsodium.org/libsodium/releases/old/libsodium-$LIBSODIUM_VER.tar.gz
tar xvf libsodium-$LIBSODIUM_VER.tar.gz
pushd libsodium-$LIBSODIUM_VER
./configure --prefix=/usr && make
sudo make install
popd
sudo ldconfig

# Instalação do MbedTLS
export MBEDTLS_VER=2.6.0
wget https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-$MBEDTLS_VER.tar.gz
tar xvf mbedtls-$MBEDTLS_VER.tar.gz
pushd mbedtls-$MBEDTLS_VER
make SHARED=1 CFLAGS="-O2 -fPIC"
sudo make DESTDIR=/usr install
popd
sudo ldconfig

# Comece a construir
./autogen.sh && ./configure && make
sudo make install
```

Pode ser necessário instalar manualmente os softwares ausentes.

### FreeBSD
#### Instalar
Shadowsocks-libev está disponível na Coleção de Ports do FreeBSD. Você pode instalá-lo de qualquer maneira, `pkg` ou `ports`.

**pkg (recomendado)**

```bash
pkg install shadowsocks-libev
```

**portas**

```bash
cd /usr/ports/net/shadowsocks-libev
make install
```

#### Configuração
Edite seu arquivo `config.json`. Por padrão, está localizado em `/usr/local/etc/shadowsocks-libev`.

Para habilitar shadowsocks-libev, adicione a seguinte variável rc ao seu arquivo `/etc/rc.conf`:

```
shadowsocks_libev_enable="YES"
```

#### Executar

Inicie o servidor Shadowsocks:

```bash
service shadowsocks_libev start
```

#### Executar como cliente
Por padrão, shadowsocks-libev está rodando como um servidor no FreeBSD. Se você quiser iniciar o shadowsocks-libev no modo cliente, você pode modificar o script rc (`/usr/local/etc/rc.d/shadowsocks_libev`) manualmente.

```
# modifique a seguinte linha de "ss-server" para "ss-local"
command="/usr/local/bin/ss-local"
```

Observe que é simplesmente uma solução alternativa, cada vez que você atualizar a porta, suas alterações serão substituídas pela nova versão.

### OpenWRT

O projeto OpenWRT é mantido aqui:
[openwrt-shadowsocks](https://github.com/shadowsocks/openwrt-shadowsocks).

### OS X
Para OS X, use [Homebrew](http://brew.sh) para instalar ou compilar.

Instale o Homebrew:

```bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
Instale shadowsocks-libev:

```bash
brew install shadowsocks-libev
```

### Windows (MinGW)
Para compilar binários nativos do Windows, o método recomendado é usar o Docker:

* No Windows: clique duas vezes em `make.bat` em `docker\mingw`
* No sistema do tipo Unix:

        cd shadowsocks-libev/docker/mingw
        make

Um tarball com binários de 32 bits e 64 bits será gerado no mesmo diretório.

Você também pode usar compiladores MinGW-w64 manualmente para compilar em shell do tipo Unix (MSYS2/Cygwin) ou compilar em sistemas semelhantes ao Unix (Linux/MacOS). Por favor, consulte os scripts de compilação em `docker/mingw`.

Atualmente você precisa usar uma biblioteca libev corrigida para MinGW:

* https://github.com/shadowsocks/libev/archive/mingw.zip

Observe que o TCP Fast Open (TFO) está disponível apenas no **Windows 10**, **1607** ou versão posterior (precisamente, build >= 14393). Se você estiver usando **1709** (compilação 16299) ou versão posterior, também precisará executar o seguinte comando no PowerShell/Prompt de comando **como administrador** e **reinicializar** para usar o TFO corretamente:

        netsh int tcp set global fastopenfallback=disabled

### Docker

Como você espera, basta puxar a imagem e executar.
```
docker pull shadowsocks/shadowsocks-libev
docker run -e PASSWORD=<password> -p<server-port>:8388 -p<server-port>:8388/udp -d shadowsocks/shadowsocks-libev
```

Mais informações sobre a imagem podem ser encontradas [aqui](docker/alpine/README.md).

## Utilização

Para obter uma lista detalhada e completa de todos os argumentos suportados,
você pode consultar as páginas de manual dos aplicativos, respectivamente.

     ss-[local|redir|server|tunnel|manager]

       -s <server_host>            Nome do host ou endereço IP de seu servidor remoto.

       -p <server_port>            Número da porta do seu servidor remoto.

       -l <local_port>             Número da porta do seu servidor local.

       -k <password>               Senha do seu servidor remoto.

       -m <encrypt_method>         Método de criptografia: rc4-md5,
                                   aes-128-gcm, aes-192-gcm, aes-256-gcm,
                                   aes-128-cfb, aes-192-cfb, aes-256-cfb,
                                   aes-128-ctr, aes-192-ctr, aes-256-ctr,
                                   camellia-128-cfb, camellia-192-cfb,
                                   camellia-256-cfb, bf-cfb,
                                   chacha20-ietf-poly1305,
                                   xchacha20-ietf-poly1305,
                                   salsa20, chacha20 e chacha20-ietf.
                                   A cifra padrão é chacha20-ietf-poly1305.

       [-a <user>]                 Executar como outro usuário.

       [-f <pid_file>]             O caminho do arquivo para armazenar pid.

       [-t <timeout>]              Tempo limite do soquete em segundos.

       [-c <config_file>]          O caminho para o arquivo de configuração.

       [-n <number>]               Número máximo de arquivos abertos.

       [-i <interface>]            Interface de rede a ser vinculada.
                                   (não disponível no modo redir)

       [-b <local_address>]        Endereço local para ligar.
                                   Para servidores: Especifique o endereço local a ser usado
                                   enquanto este servidor está fazendo saída
                                   conexões a servidores remotos em nome do
                                   clientes.
                                   Para clientes: Especifique o endereço local a ser usado
                                   enquanto este cliente está fazendo saída
                                   conexões com o servidor.

       [-u]                        Habilita retransmissão UDP.
                                   (TPROXY é necessário no modo redir)

       [-U]                        Ativa a retransmissão UDP e desativa a retransmissão TCP.
                                   (não disponível no modo local)

       [-T]                        Use tproxy em vez de redirecionar. (para tcp)
                                   (disponível apenas no modo redir)

       [-L <addr>:<port>]          Endereço e porta do servidor de destino
                                   para encaminhamento de porta local.
                                   (disponível apenas no modo túnel)

       [-6]                        Primeiro, resolva o nome do host para o endereço IPv6.

       [-d <addr>]                 Servidores de nome para resolvedor de DNS interno.
                                   (disponível apenas no modo servidor)

       [--reuse-port]              Habilita a reutilização de porta.

       [--fast-open]               Habilita a abertura rápida do TCP.
                                   com kernel do Linux > 3.7.0.
                                   (disponível apenas no modo local e servidor)

       [--acl <acl_file>]          Caminho para ACL (lista de controle de acesso).
                                   (disponível apenas no modo local e servidor)

       [--manager-address <addr>]  endereço de soquete do domínio UNIX.
                                   (disponível apenas no modo servidor e gerenciador)

       [--mtu <MTU>]               MTU de sua interface de rede.

       [--mptcp]                   Habilita o Multipath TCP no Kernel MPTCP.
 
       [--no-delay]                Habilita TCP_NODELAY.

       [--executable <path>]       Caminho para o executável do ss-server.
                                   (disponível apenas no modo gerenciador)
 
       [-D <path>]                 Caminho para o diretório de trabalho do ss-manager.
                                   (disponível apenas no modo gerenciador)

       [--key <key_in_base64>]     Chave do seu servidor remoto.

## proxy transparente

O mais recente shadowsocks-libev forneceu um modo *redir*. Você pode configurar sua caixa ou roteador baseado em Linux para fazer proxy de todo o tráfego TCP de forma transparente, o que é útil se você usar um roteador com OpenWRT.

    # Criar nova cadeia
    iptables -t nat -N SHADOWSOCKS
    iptables -t mangle -N SHADOWSOCKS

    # Ignore os endereços do seu servidor shadowsocks
    # É muito IMPORTANTE, apenas tome cuidado.
    iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN

    # Ignore LANs e quaisquer outros endereços que você gostaria de ignorar o proxy
    # Veja Wikipedia e RFC5735 para lista completa de redes reservadas.
    # Consulte ashi009/bestroutetb para obter uma lista de rotas CHN altamente otimizada.
    iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
    iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN

    # Qualquer outra coisa deve ser redirecionada para a porta local do shadowsocks
    iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345

    # Adicione quaisquer regras UDP
    ip route add local default dev lo table 100
    ip rule add fwmark 1 lookup 100
    iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01

    # Aplicar as regras
    iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
    iptables -t mangle -A PREROUTING -j SHADOWSOCKS

    # Iniciar o shadowsocks-redir
    ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid

## Proxy transparente (tproxy puro)

A execução deste script no host linux pode fazer proxy de todo o tráfego de saída desta máquina (exceto o tráfego enviado para o endereço reservado). Outros hosts na mesma LAN também podem alterar seu gateway padrão para o ip deste host linux (ao mesmo tempo, alterar o servidor dns para 1.1.1.1 ou 8.8.8.8, etc.) para fazer proxy de seu tráfego de saída.

> Claro, o proxy ipv6 é semelhante, basta alterar `iptables` para `ip6tables`, `ip` para `ip -6`, `127.0.0.1` para `::1`, e outros detalhes.

```shell
#!/bin/bash

start_ssredir() {
    # modifique MyIP, MyPort, etc.
    (ss-redir -s MyIP -p MyPort -m MyMethod -k MyPasswd -b 127.0.0.1 -l 60080 --no-delay -u -T -v </dev/null &>>/var/log/ss-redir.log &)
}

stop_ssredir() {
    kill -9 $(pidof ss-redir) &>/dev/null
}

start_iptables() {
    ##################### SSREDIR #####################
    iptables -t mangle -N SSREDIR

    # connection-mark -> packet-mark
    iptables -t mangle -A SSREDIR -j CONNMARK --restore-mark
    iptables -t mangle -A SSREDIR -m mark --mark 0x2333 -j RETURN

    # modifique MyIP, MyPort, etc.
    # ignorar o tráfego enviado para o servidor ss
    iptables -t mangle -A SSREDIR -p tcp -d MyIP --dport MyPort -j RETURN
    iptables -t mangle -A SSREDIR -p udp -d MyIP --dport MyPort -j RETURN

    # ignorar o tráfego enviado para endereços reservados
    iptables -t mangle -A SSREDIR -d 0.0.0.0/8          -j RETURN
    iptables -t mangle -A SSREDIR -d 10.0.0.0/8         -j RETURN
    iptables -t mangle -A SSREDIR -d 100.64.0.0/10      -j RETURN
    iptables -t mangle -A SSREDIR -d 127.0.0.0/8        -j RETURN
    iptables -t mangle -A SSREDIR -d 169.254.0.0/16     -j RETURN
    iptables -t mangle -A SSREDIR -d 172.16.0.0/12      -j RETURN
    iptables -t mangle -A SSREDIR -d 192.0.0.0/24       -j RETURN
    iptables -t mangle -A SSREDIR -d 192.0.2.0/24       -j RETURN
    iptables -t mangle -A SSREDIR -d 192.88.99.0/24     -j RETURN
    iptables -t mangle -A SSREDIR -d 192.168.0.0/16     -j RETURN
    iptables -t mangle -A SSREDIR -d 198.18.0.0/15      -j RETURN
    iptables -t mangle -A SSREDIR -d 198.51.100.0/24    -j RETURN
    iptables -t mangle -A SSREDIR -d 203.0.113.0/24     -j RETURN
    iptables -t mangle -A SSREDIR -d 224.0.0.0/4        -j RETURN
    iptables -t mangle -A SSREDIR -d 240.0.0.0/4        -j RETURN
    iptables -t mangle -A SSREDIR -d 255.255.255.255/32 -j RETURN

    # marca o primeiro pacote da conexão
    iptables -t mangle -A SSREDIR -p tcp --syn                      -j MARK --set-mark 0x2333
    iptables -t mangle -A SSREDIR -p udp -m conntrack --ctstate NEW -j MARK --set-mark 0x2333

    # packet-mark -> connection-mark
    iptables -t mangle -A SSREDIR -j CONNMARK --save-mark

    ##################### OUTPUT #####################
    # proxy the outgoing traffic from this machine
    iptables -t mangle -A OUTPUT -p tcp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR
    iptables -t mangle -A OUTPUT -p udp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR

    ##################### PREROUTING #####################
    # proxy traffic passing through this machine (other->other)
    iptables -t mangle -A PREROUTING -p tcp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR
    iptables -t mangle -A PREROUTING -p udp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR

    # hand over the marked package to TPROXY for processing
    iptables -t mangle -A PREROUTING -p tcp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080
    iptables -t mangle -A PREROUTING -p udp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080
}

stop_iptables() {
    ##################### PREROUTING #####################
    iptables -t mangle -D PREROUTING -p tcp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080 &>/dev/null
    iptables -t mangle -D PREROUTING -p udp -m mark --mark 0x2333 -j TPROXY --on-ip 127.0.0.1 --on-port 60080 &>/dev/null

    iptables -t mangle -D PREROUTING -p tcp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR &>/dev/null
    iptables -t mangle -D PREROUTING -p udp -m addrtype ! --src-type LOCAL ! --dst-type LOCAL -j SSREDIR &>/dev/null

    ##################### OUTPUT #####################
    iptables -t mangle -D OUTPUT -p tcp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR &>/dev/null
    iptables -t mangle -D OUTPUT -p udp -m addrtype --src-type LOCAL ! --dst-type LOCAL -j SSREDIR &>/dev/null

    ##################### SSREDIR #####################
    iptables -t mangle -F SSREDIR &>/dev/null
    iptables -t mangle -X SSREDIR &>/dev/null
}

start_iproute2() {
    ip route add local default dev lo table 100
    ip rule  add fwmark 0x2333        table 100
}

stop_iproute2() {
    ip rule  del   table 100 &>/dev/null
    ip route flush table 100 &>/dev/null
}

start_resolvconf() {
    # or nameserver 8.8.8.8, etc.
    echo "nameserver 1.1.1.1" >/etc/resolv.conf
}

stop_resolvconf() {
    echo "nameserver 114.114.114.114" >/etc/resolv.conf
}

start() {
    echo "start ..."
    start_ssredir
    start_iptables
    start_iproute2
    start_resolvconf
    echo "start end"
}

stop() {
    echo "stop ..."
    stop_resolvconf
    stop_iproute2
    stop_iptables
    stop_ssredir
    echo "stop end"
}

restart() {
    stop
    sleep 1
    start
}

main() {
    if [ $# -eq 0 ]; then
        echo "usage: $0 start|stop|restart ..."
        return 1
    fi

    for funcname in "$@"; do
        if [ "$(type -t $funcname)" != 'function' ]; then
            echo "'$funcname' not a shell function"
            return 1
        fi
    done

    for funcname in "$@"; do
        $funcname
    done
    return 0
}
main "$@"
```

## Dicas de segurança

Para qualquer servidor público, para evitar que os usuários acessem o localhost do seu servidor, adicione `--acl acl/server_block_local.acl` à linha de comando.

Embora shadowsocks-libev possa lidar bem com milhares de conexões simultâneas, ainda recomendamos
configurando as regras de firewall do seu servidor para limitar as conexões de cada usuário:

    # Até 32 conexões são suficientes para uso normal
    iptables -A INPUT -p tcp --syn --dport ${SHADOWSOCKS_PORT} -m connlimit --connlimit-above 32 -j REJECT --reject-with tcp-reset

## Licença

```
Copyright: 2013-2015, Clow Windy <clowwindy42@gmail.com>
           2013-2018, Max Lv <max.c.lv@gmail.com>
           2014, Linus Yang <linusyang@gmail.com>

Este programa é um software livre: você pode redistribuí-lo 
e/ou modificá-lo sob os termos da GNU General Public License 
conforme publicada pela Free Software Foundation, a versão 3
da Licença ou (a seu critério) qualquer versão posterior.

Este programa é distribuído na esperança de que seja útil,
 mas SEM QUALQUER GARANTIA; sem mesmo a garantia implícita 
de COMERCIALIZAÇÃO ou ADEQUAÇÃO A UM DETERMINADO FIM.Veja
a Licença Pública Geral GNU para mais detalhes.

Você deve ter recebido uma cópia da GNU General Public License 
juntamente com este programa. Caso contrário, 
consulte <http://www.gnu.org/licenses/>.
```


================================================
FILE: acl/chn.acl
================================================
[proxy_all]

[bypass_list]
1.0.1.0/24
1.0.2.0/23
1.0.8.0/21
1.0.32.0/19
1.1.0.0/24
1.1.2.0/23
1.1.4.0/22
1.1.8.0/21
1.1.16.0/20
1.1.32.0/19
1.2.0.0/23
1.2.2.0/24
1.2.5.0/24
1.2.6.0/23
1.2.8.0/21
1.2.16.0/20
1.2.32.0/19
1.2.64.0/18
1.3.0.0/16
1.4.1.0/24
1.4.2.0/23
1.4.4.0/22
1.4.8.0/21
1.4.16.0/20
1.4.32.0/19
1.4.64.0/18
1.8.0.0/18
1.8.64.0/19
1.8.96.0/22
1.8.100.0/23
1.8.112.0/20
1.8.128.0/20
1.8.144.0/22
1.8.148.0/23
1.8.154.0/23
1.8.156.0/22
1.8.160.0/19
1.8.192.0/19
1.8.224.0/20
1.8.244.0/22
1.8.248.0/21
1.10.0.0/21
1.10.8.0/23
1.10.11.0/24
1.10.12.0/22
1.10.16.0/20
1.10.32.0/19
1.10.64.0/18
1.12.0.0/14
1.18.128.0/24
1.24.0.0/13
1.45.0.0/16
1.48.0.0/14
1.56.0.0/13
1.68.0.0/14
1.80.0.0/12
1.116.0.0/15
1.118.1.0/24
1.118.2.0/23
1.118.4.0/22
1.118.8.0/21
1.118.16.0/20
1.118.32.0/19
1.118.64.0/18
1.118.128.0/17
1.119.0.0/16
1.180.0.0/14
1.184.0.0/15
1.188.0.0/14
1.192.0.0/13
1.202.0.0/15
1.204.0.0/14
2.20.54.23/32
8.128.0.0/10
8.209.36.0/22
8.209.40.0/21
8.209.48.0/20
8.209.192.0/18
8.210.0.0/15
8.212.0.0/14
8.216.0.0/13
14.0.0.0/21
14.0.12.0/22
14.1.0.0/22
14.1.24.0/22
14.1.108.0/22
14.16.0.0/12
14.102.128.0/22
14.102.180.0/22
14.103.0.0/16
14.104.0.0/13
14.112.0.0/12
14.130.0.0/15
14.134.0.0/15
14.144.0.0/12
14.192.60.0/22
14.192.76.0/22
14.196.0.0/15
14.204.0.0/15
14.208.0.0/12
20.81.0.0/24
20.134.160.0/20
20.139.160.0/20
20.249.255.0/24
20.251.0.0/22
23.236.64.0/25
23.236.64.128/26
23.236.64.192/27
27.0.128.0/21
27.0.160.0/21
27.0.188.0/22
27.0.204.0/22
27.0.208.0/21
27.8.0.0/13
27.16.0.0/12
27.34.232.0/21
27.36.0.0/14
27.40.0.0/13
27.50.40.0/21
27.50.128.0/17
27.54.72.0/21
27.54.152.0/21
27.54.192.0/18
27.98.208.0/20
27.98.224.0/19
27.99.128.0/17
27.103.0.0/16
27.106.128.0/18
27.106.204.0/22
27.109.32.0/19
27.109.124.0/22
27.112.0.0/18
27.112.80.0/20
27.112.112.0/21
27.113.128.0/18
27.115.0.0/17
27.116.44.0/22
27.121.72.0/21
27.121.120.0/21
27.128.0.0/15
27.131.220.0/22
27.144.0.0/16
27.148.0.0/14
27.152.0.0/13
27.184.0.0/13
27.192.0.0/11
27.224.0.0/14
36.0.0.0/22
36.0.16.0/20
36.0.32.0/19
36.0.64.0/18
36.0.128.0/17
36.1.0.0/16
36.4.0.0/14
36.16.0.0/12
36.32.0.0/14
36.36.0.0/16
36.37.0.0/19
36.37.36.0/23
36.37.39.0/24
36.37.40.0/21
36.37.48.0/20
36.40.0.0/13
36.48.0.0/15
36.51.0.0/17
36.51.128.0/18
36.51.192.0/19
36.51.224.0/20
36.51.240.0/21
36.51.248.0/22
36.51.252.0/23
36.56.0.0/13
36.96.0.0/11
36.128.0.0/10
36.192.0.0/11
36.248.0.0/14
36.254.0.0/16
36.255.116.0/22
36.255.128.0/22
36.255.164.0/22
36.255.172.0/22
36.255.176.0/22
38.142.239.114/32
39.0.0.0/24
39.0.2.0/23
39.0.4.0/22
39.0.8.0/21
39.0.16.0/20
39.0.32.0/19
39.0.64.0/18
39.0.128.0/17
39.64.0.0/11
39.96.0.0/13
39.104.0.0/14
39.108.0.0/16
39.109.120.0/23
39.128.0.0/10
40.0.176.0/20
40.0.247.0/24
40.0.248.0/22
40.0.252.0/23
40.0.255.0/24
40.72.0.0/15
40.77.136.112/28
40.77.236.224/27
40.77.254.64/27
40.125.128.0/17
40.126.64.0/18
40.198.10.0/24
40.198.16.0/21
40.198.24.0/23
40.251.225.0/24
40.251.227.0/24
42.0.0.0/22
42.0.8.0/21
42.0.16.0/21
42.0.24.0/22
42.0.32.0/19
42.0.128.0/17
42.1.0.0/19
42.1.32.0/20
42.1.48.0/21
42.1.56.0/22
42.4.0.0/14
42.48.0.0/13
42.56.0.0/14
42.62.0.0/17
42.62.128.0/19
42.62.160.0/20
42.62.180.0/22
42.62.184.0/21
42.63.0.0/16
42.80.0.0/15
42.83.64.0/20
42.83.80.0/22
42.83.88.0/21
42.83.96.0/19
42.83.128.0/23
42.83.134.0/24
42.83.139.0/24
42.83.140.0/22
42.83.144.0/20
42.83.160.0/19
42.83.192.0/18
42.84.0.0/14
42.88.0.0/13
42.96.64.0/19
42.96.96.0/21
42.96.108.0/22
42.96.112.0/20
42.96.128.0/17
42.97.0.0/16
42.99.0.0/18
42.99.64.0/19
42.99.96.0/20
42.99.112.0/22
42.99.120.0/21
42.100.0.0/14
42.120.0.0/15
42.122.0.0/16
42.123.0.0/19
42.123.36.0/22
42.123.40.0/21
42.123.48.0/20
42.123.64.0/18
42.123.128.0/17
42.128.0.0/12
42.156.0.0/19
42.156.36.0/22
42.156.40.0/21
42.156.48.0/20
42.156.64.0/18
42.156.128.0/17
42.157.0.0/21
42.157.8.0/22
42.157.14.0/23
42.157.16.0/20
42.157.32.0/19
42.157.64.0/18
42.157.128.0/17
42.158.0.0/15
42.160.0.0/12
42.176.0.0/13
42.184.0.0/15
42.186.0.0/16
42.187.0.0/18
42.187.64.0/19
42.187.96.0/20
42.187.112.0/21
42.187.120.0/22
42.187.128.0/17
42.192.0.0/13
42.201.0.0/17
42.202.0.0/15
42.204.0.0/14
42.208.0.0/12
42.224.0.0/12
42.240.0.0/16
42.242.0.0/15
42.244.0.0/15
42.246.0.0/16
42.247.0.0/22
42.247.4.0/24
42.247.5.0/25
42.247.5.128/26
42.247.5.204/30
42.247.5.208/28
42.247.5.224/27
42.247.6.0/23
42.247.8.0/21
42.247.16.0/20
42.247.32.0/19
42.247.64.0/18
42.247.128.0/17
42.248.0.0/13
43.224.12.0/22
43.224.24.0/22
43.224.44.0/22
43.224.52.0/22
43.224.56.0/22
43.224.68.0/22
43.224.72.0/22
43.224.80.0/22
43.224.100.0/22
43.224.144.0/22
43.224.160.0/22
43.224.176.0/22
43.224.184.0/22
43.224.200.0/21
43.224.208.0/21
43.224.216.0/22
43.224.240.0/22
43.225.76.0/22
43.225.86.0/24
43.225.120.0/22
43.225.180.0/22
43.225.208.0/22
43.225.216.0/21
43.225.224.0/20
43.225.240.0/21
43.225.252.0/22
43.226.32.0/19
43.226.64.0/19
43.226.96.0/20
43.226.112.0/21
43.226.120.0/22
43.226.128.0/19
43.226.160.0/21
43.226.236.0/22
43.226.240.0/20
43.227.0.0/21
43.227.8.0/22
43.227.32.0/19
43.227.64.0/19
43.227.104.0/22
43.227.136.0/21
43.227.144.0/22
43.227.152.0/21
43.227.160.0/20
43.227.176.0/21
43.227.188.0/22
43.227.192.0/19
43.227.232.0/22
43.227.248.0/21
43.228.0.0/18
43.228.64.0/21
43.228.76.0/22
43.228.100.0/22
43.228.116.0/24
43.228.118.0/23
43.228.132.0/22
43.228.136.0/22
43.228.148.0/22
43.228.152.0/22
43.228.188.0/22
43.229.40.0/22
43.229.48.0/22
43.229.56.0/22
43.229.96.0/22
43.229.136.0/21
43.229.168.0/21
43.229.176.0/20
43.229.192.0/21
43.229.216.0/21
43.229.232.0/21
43.230.20.0/22
43.230.32.0/22
43.230.68.0/22
43.230.72.0/22
43.230.84.0/22
43.230.124.0/22
43.230.220.0/22
43.230.224.0/19
43.231.12.0/22
43.231.32.0/20
43.231.80.0/20
43.231.96.0/20
43.231.136.0/21
43.231.144.0/20
43.231.160.0/20
43.231.176.0/21
43.236.0.0/15
43.238.0.0/16
43.239.0.0/19
43.239.32.0/20
43.239.48.0/22
43.239.116.0/22
43.239.120.0/22
43.239.172.0/22
43.240.0.0/22
43.240.56.0/21
43.240.68.0/22
43.240.72.0/21
43.240.84.0/22
43.240.124.0/22
43.240.128.0/21
43.240.136.0/22
43.240.156.0/22
43.240.160.0/19
43.240.192.0/19
43.240.240.0/20
43.241.0.0/20
43.241.16.0/21
43.241.48.0/22
43.241.76.0/22
43.241.80.0/20
43.241.112.0/22
43.241.168.0/21
43.241.176.0/21
43.241.184.0/22
43.241.208.0/20
43.241.224.0/20
43.241.240.0/22
43.241.248.0/22
43.242.8.0/21
43.242.16.0/20
43.242.48.0/22
43.242.53.0/24
43.242.54.0/23
43.242.56.0/21
43.242.64.0/22
43.242.72.0/21
43.242.80.0/20
43.242.96.0/22
43.242.144.0/20
43.242.160.0/21
43.242.180.0/22
43.242.188.0/22
43.242.192.0/21
43.242.204.0/22
43.242.216.0/21
43.242.252.0/22
43.243.4.0/22
43.243.8.0/21
43.243.16.0/22
43.243.88.0/22
43.243.128.0/22
43.243.136.0/22
43.243.144.0/21
43.243.156.0/22
43.243.180.0/22
43.243.228.0/22
43.243.232.0/22
43.243.244.0/22
43.246.0.0/18
43.246.64.0/19
43.246.96.0/22
43.246.228.0/22
43.247.4.0/22
43.247.8.0/22
43.247.44.0/22
43.247.48.0/22
43.247.68.0/22
43.247.76.0/22
43.247.84.0/22
43.247.88.0/21
43.247.96.0/21
43.247.108.0/22
43.247.112.0/22
43.247.148.0/22
43.247.152.0/22
43.247.176.0/20
43.247.196.0/22
43.247.200.0/21
43.247.208.0/20
43.247.224.0/19
43.248.0.0/21
43.248.20.0/22
43.248.28.0/22
43.248.48.0/22
43.248.76.0/22
43.248.80.0/20
43.248.96.0/19
43.248.128.0/20
43.248.144.0/21
43.248.176.0/20
43.248.192.0/20
43.248.208.0/22
43.248.228.0/22
43.248.232.0/22
43.248.244.0/22
43.249.4.0/22
43.249.120.0/22
43.249.132.0/22
43.249.136.0/22
43.249.144.0/20
43.249.160.0/21
43.249.168.0/22
43.249.192.0/22
43.249.236.0/22
43.250.4.0/22
43.250.12.0/22
43.250.16.0/21
43.250.28.0/22
43.250.32.0/22
43.250.96.0/21
43.250.108.0/22
43.250.112.0/21
43.250.128.0/22
43.250.144.0/21
43.250.160.0/22
43.250.168.0/22
43.250.176.0/22
43.250.200.0/22
43.250.212.0/22
43.250.216.0/21
43.250.236.0/22
43.250.244.0/22
43.251.4.0/22
43.251.36.0/22
43.251.192.0/22
43.251.232.0/22
43.251.244.0/22
43.252.48.0/22
43.252.56.0/22
43.252.224.0/22
43.254.0.0/21
43.254.8.0/22
43.254.24.0/22
43.254.36.0/22
43.254.44.0/22
43.254.52.0/22
43.254.64.0/22
43.254.72.0/22
43.254.84.0/22
43.254.88.0/21
43.254.100.0/22
43.254.104.0/22
43.254.112.0/21
43.254.128.0/22
43.254.136.0/21
43.254.144.0/20
43.254.168.0/21
43.254.180.0/22
43.254.184.0/21
43.254.192.0/22
43.254.200.0/22
43.254.208.0/22
43.254.220.0/22
43.254.224.0/20
43.254.240.0/22
43.254.248.0/21
43.255.0.0/21
43.255.8.0/22
43.255.16.0/22
43.255.48.0/22
43.255.64.0/20
43.255.84.0/22
43.255.96.0/22
43.255.144.0/22
43.255.176.0/22
43.255.184.0/22
43.255.192.0/22
43.255.200.0/21
43.255.208.0/21
43.255.224.0/21
43.255.232.0/22
43.255.244.0/22
45.40.192.0/20
45.40.208.0/21
45.40.224.0/19
45.65.16.0/20
45.112.132.0/22
45.112.188.0/22
45.112.208.0/22
45.112.216.0/21
45.112.228.0/22
45.112.232.0/21
45.113.12.0/22
45.113.16.0/20
45.113.40.0/22
45.113.52.0/22
45.113.72.0/22
45.113.144.0/21
45.113.168.0/22
45.113.184.0/22
45.113.200.0/21
45.113.208.0/20
45.113.240.0/22
45.113.252.0/22
45.114.0.0/22
45.114.32.0/22
45.114.52.0/22
45.114.96.0/22
45.114.136.0/22
45.114.196.0/22
45.114.200.0/22
45.114.228.0/22
45.114.237.0/24
45.114.238.0/23
45.114.252.0/22
45.115.44.0/22
45.115.100.0/22
45.115.120.0/22
45.115.132.0/22
45.115.144.0/22
45.115.156.0/22
45.115.164.0/22
45.115.200.0/22
45.115.212.0/22
45.115.244.0/22
45.115.248.0/22
45.116.16.0/22
45.116.24.0/22
45.116.32.0/21
45.116.52.0/22
45.116.96.0/21
45.116.140.0/22
45.116.152.0/22
45.116.208.0/22
45.117.8.0/22
45.117.20.0/22
45.117.68.0/22
45.117.124.0/22
45.117.252.0/22
45.119.60.0/22
45.119.64.0/21
45.119.72.0/22
45.119.104.0/22
45.119.232.0/22
45.120.100.0/22
45.120.140.0/22
45.120.164.0/22
45.120.180.128/27
45.120.240.0/22
45.121.52.0/22
45.121.64.0/21
45.121.72.0/22
45.121.92.0/22
45.121.96.0/22
45.121.172.0/22
45.121.176.0/22
45.121.240.0/20
45.122.0.0/19
45.122.32.0/21
45.122.40.0/22
45.122.60.0/22
45.122.64.0/19
45.122.96.0/20
45.122.112.0/21
45.122.160.0/19
45.122.192.0/20
45.122.208.0/21
45.122.216.0/22
45.123.28.0/22
45.123.32.0/21
45.123.44.0/22
45.123.48.0/20
45.123.64.0/20
45.123.80.0/21
45.123.120.0/22
45.123.128.0/21
45.123.136.0/22
45.123.148.0/22
45.123.152.0/21
45.123.164.0/22
45.123.168.0/21
45.123.176.0/21
45.123.184.0/22
45.123.204.0/22
45.123.212.0/22
45.123.224.0/19
45.124.0.0/22
45.124.20.0/22
45.124.28.0/22
45.124.32.0/21
45.124.44.0/22
45.124.68.0/22
45.124.76.0/22
45.124.80.0/22
45.124.100.0/22
45.124.124.0/22
45.124.172.0/22
45.124.176.0/22
45.124.208.0/22
45.124.248.0/22
45.125.24.0/22
45.125.44.0/22
45.125.52.0/22
45.125.56.0/22
45.125.76.0/22
45.125.80.0/20
45.125.96.0/21
45.125.136.0/22
45.126.48.0/21
45.126.108.0/22
45.126.112.0/21
45.126.120.0/22
45.126.220.0/22
45.127.8.0/21
45.127.128.0/22
45.127.144.0/21
45.127.156.0/22
45.248.8.0/22
45.248.80.0/22
45.248.88.0/22
45.248.96.0/20
45.248.128.0/21
45.248.204.0/22
45.248.208.0/20
45.248.224.0/19
45.249.0.0/21
45.249.12.0/22
45.249.16.0/20
45.249.32.0/21
45.249.112.0/22
45.249.188.0/22
45.249.192.0/20
45.249.208.0/21
45.250.12.0/22
45.250.16.0/22
45.250.28.0/22
45.250.32.0/21
45.250.40.0/22
45.250.76.0/22
45.250.80.0/20
45.250.96.0/22
45.250.104.0/21
45.250.112.0/20
45.250.128.0/20
45.250.144.0/21
45.250.152.0/22
45.250.164.0/22
45.250.180.0/22
45.250.184.0/21
45.250.192.0/22
45.251.0.0/22
45.251.8.0/22
45.251.16.0/21
45.251.52.0/22
45.251.84.0/22
45.251.88.0/21
45.251.96.0/21
45.251.120.0/21
45.251.137.0/24
45.251.138.0/23
45.251.140.0/22
45.251.144.0/20
45.251.160.0/19
45.251.192.0/19
45.251.224.0/22
45.252.0.0/19
45.252.32.0/20
45.252.48.0/22
45.252.84.0/22
45.252.88.0/21
45.252.96.0/19
45.252.128.0/19
45.252.160.0/20
45.252.176.0/22
45.252.192.0/19
45.252.224.0/21
45.252.232.0/22
45.253.0.0/18
45.253.64.0/20
45.253.80.0/21
45.253.92.0/22
45.253.96.0/20
45.253.112.0/21
45.253.120.0/22
45.253.130.0/23
45.253.132.0/22
45.253.136.0/21
45.253.144.0/20
45.253.160.0/19
45.253.192.0/19
45.253.224.0/20
45.253.240.0/22
45.254.0.0/20
45.254.16.0/21
45.254.28.0/22
45.254.40.0/22
45.254.48.0/20
45.254.64.0/18
45.254.128.0/18
45.254.192.0/19
45.254.224.0/21
45.254.236.0/22
45.254.240.0/22
45.254.248.0/22
45.255.0.0/18
45.255.64.0/19
45.255.96.0/20
45.255.112.0/21
45.255.120.0/22
45.255.136.0/21
45.255.144.0/20
45.255.160.0/19
45.255.192.0/19
45.255.224.0/20
45.255.240.0/21
45.255.248.0/22
46.248.24.0/23
47.92.0.0/14
47.96.0.0/11
49.4.0.0/14
49.51.56.0/22
49.51.60.0/23
49.51.110.0/23
49.51.112.0/20
49.52.0.0/14
49.64.0.0/11
49.112.0.0/13
49.120.0.0/14
49.128.0.0/24
49.128.2.0/23
49.128.4.0/22
49.140.0.0/15
49.152.0.0/14
49.208.0.0/14
49.220.0.0/14
49.232.0.0/14
49.239.0.0/18
49.239.192.0/18
52.80.0.0/14
52.94.249.0/27
52.130.0.0/15
54.222.0.0/15
54.231.208.0/20
54.240.224.0/24
57.92.96.0/20
58.14.0.0/15
58.16.0.0/13
58.24.0.0/15
58.30.0.0/15
58.32.0.0/11
58.65.232.0/21
58.66.0.0/15
58.68.128.0/19
58.68.160.0/23
58.68.163.0/24
58.68.164.0/22
58.68.179.0/24
58.68.180.0/24
58.68.200.0/21
58.68.208.0/20
58.68.224.0/19
58.82.0.0/17
58.83.0.0/16
58.87.64.0/18
58.99.128.0/17
58.100.0.0/15
58.116.0.0/14
58.128.0.0/13
58.144.0.0/16
58.154.0.0/15
58.192.0.0/11
58.240.0.0/12
59.32.0.0/11
59.64.0.0/12
59.80.0.0/15
59.82.0.0/16
59.83.0.0/18
59.83.132.0/22
59.83.136.0/21
59.83.144.0/20
59.83.160.0/19
59.83.192.0/19
59.83.224.0/20
59.83.240.0/21
59.83.248.0/22
59.83.252.0/23
59.83.254.0/24
59.107.0.0/16
59.108.0.0/14
59.151.0.0/17
59.152.16.0/20
59.152.36.0/22
59.152.64.0/20
59.152.112.0/21
59.153.4.0/22
59.153.32.0/22
59.153.64.0/21
59.153.72.0/22
59.153.92.0/22
59.153.136.0/22
59.153.152.0/21
59.153.164.0/22
59.153.168.0/21
59.153.176.0/20
59.153.192.0/22
59.155.0.0/16
59.172.0.0/14
59.191.0.0/17
59.192.0.0/10
60.0.0.0/11
60.55.0.0/16
60.63.0.0/16
60.160.0.0/11
60.194.0.0/15
60.200.0.0/13
60.208.0.0/12
60.232.0.0/15
60.235.0.0/16
60.245.128.0/17
60.247.0.0/16
60.252.0.0/16
60.253.128.0/17
60.255.0.0/16
61.4.81.0/24
61.4.82.0/23
61.4.84.0/22
61.4.88.0/21
61.4.176.0/20
61.8.160.0/20
61.14.212.0/22
61.14.216.0/21
61.14.240.0/21
61.28.0.0/17
61.29.128.0/18
61.29.192.0/19
61.29.224.0/20
61.45.128.0/18
61.45.224.0/20
61.47.128.0/18
61.48.0.0/13
61.87.192.0/18
61.128.0.0/10
61.232.0.0/14
61.236.0.0/15
61.240.0.0/14
62.234.0.0/16
68.79.0.0/18
69.230.192.0/18
69.231.128.0/18
69.234.192.0/18
69.235.128.0/18
71.131.192.0/18
71.132.0.0/18
71.136.64.0/18
71.137.0.0/18
72.163.240.0/23
72.163.248.0/22
81.68.0.0/14
81.161.63.0/24
82.156.0.0/15
87.254.207.0/24
91.223.53.0/24
91.239.190.0/24
93.183.14.0/24
93.183.18.0/24
94.191.0.0/17
101.0.0.0/22
101.1.0.0/22
101.2.172.0/22
101.4.0.0/14
101.16.0.0/12
101.32.0.0/14
101.36.0.0/18
101.36.64.0/20
101.36.88.0/21
101.36.96.0/19
101.36.128.0/17
101.37.0.0/16
101.38.0.0/15
101.40.0.0/13
101.48.0.0/15
101.50.8.0/21
101.50.56.0/22
101.52.0.0/16
101.53.100.0/22
101.54.0.0/16
101.55.224.0/21
101.64.0.0/13
101.72.0.0/14
101.76.0.0/15
101.78.0.0/22
101.78.32.0/19
101.80.0.0/12
101.96.0.0/21
101.96.8.0/22
101.96.16.0/20
101.96.128.0/17
101.99.96.0/19
101.101.64.0/19
101.101.100.0/24
101.101.102.0/23
101.101.104.0/21
101.101.112.0/20
101.102.64.0/19
101.102.100.0/23
101.102.102.0/24
101.102.104.0/21
101.102.112.0/20
101.104.0.0/14
101.110.64.0/19
101.110.96.0/20
101.110.116.0/22
101.110.120.0/21
101.120.0.0/14
101.124.0.0/15
101.126.0.0/16
101.128.0.0/22
101.128.8.0/21
101.128.16.0/20
101.128.32.0/19
101.129.0.0/16
101.130.0.0/15
101.132.0.0/15
101.134.0.0/17
101.134.128.0/19
101.134.160.0/20
101.134.176.0/21
101.134.184.0/22
101.134.189.0/24
101.134.190.0/23
101.134.192.0/18
101.135.0.0/16
101.144.0.0/12
101.192.0.0/14
101.196.0.0/16
101.198.128.0/18
101.198.194.0/24
101.198.196.0/23
101.198.200.0/22
101.198.224.0/19
101.199.0.0/19
101.199.48.0/20
101.199.64.0/18
101.199.128.0/17
101.200.0.0/15
101.203.128.0/19
101.203.160.0/21
101.203.172.0/22
101.203.176.0/20
101.204.0.0/14
101.224.0.0/13
101.232.0.0/15
101.234.64.0/21
101.234.76.0/22
101.234.80.0/20
101.234.96.0/19
101.236.0.0/14
101.240.0.0/13
101.248.0.0/15
101.251.0.0/22
101.251.8.0/21
101.251.16.0/20
101.251.32.0/19
101.251.64.0/18
101.251.128.0/17
101.252.0.0/15
101.254.0.0/16
102.176.130.0/24
103.1.8.0/22
103.1.20.0/22
103.1.24.0/22
103.1.88.0/22
103.1.168.0/22
103.2.108.0/22
103.2.156.0/22
103.2.164.0/22
103.2.200.0/21
103.2.208.0/21
103.3.84.0/22
103.3.88.0/21
103.3.96.0/19
103.3.128.0/20
103.3.148.0/22
103.3.152.0/21
103.4.56.0/22
103.4.168.0/22
103.4.184.0/22
103.5.36.0/22
103.5.52.0/23
103.5.56.0/22
103.5.152.0/22
103.5.168.0/22
103.5.192.0/22
103.5.252.0/22
103.6.76.0/22
103.6.108.0/22
103.6.120.0/22
103.6.220.0/22
103.6.228.0/22
103.7.140.0/22
103.7.212.0/22
103.7.216.0/21
103.8.0.0/21
103.8.8.0/22
103.8.32.0/22
103.8.52.0/22
103.8.68.0/22
103.8.108.0/22
103.8.156.0/22
103.8.200.0/21
103.8.220.0/22
103.9.8.0/22
103.9.24.0/22
103.9.108.0/22
103.9.152.0/22
103.9.248.0/21
103.10.0.0/22
103.10.16.0/22
103.10.84.0/22
103.10.111.0/24
103.10.140.0/22
103.11.16.0/22
103.11.168.0/22
103.11.180.0/22
103.12.32.0/22
103.12.136.0/22
103.12.184
Download .txt
gitextract_w3iy52_5/

├── .copr/
│   └── Makefile
├── .dockerignore
├── .github/
│   ├── FUNDING.yml
│   ├── dependabot.yml
│   ├── issue_template.md
│   └── workflows/
│       └── build.yml
├── .gitignore
├── .gitmodules
├── .travis.yml
├── .uncrustify.cfg
├── AUTHORS
├── CLAUDE.md
├── CMakeLists.txt
├── COPYING
├── Changes
├── LICENSE
├── README.md
├── README_pt_BR.md
├── acl/
│   ├── chn.acl
│   ├── gfwlist.acl
│   ├── local.acl
│   ├── server_block_chn.acl
│   └── server_block_local.acl
├── cmake/
│   ├── FindCares.cmake
│   ├── FindMbedTLS.cmake
│   ├── FindPCRE2.cmake
│   ├── FindSodium.cmake
│   ├── config.h.cmake
│   ├── configure.cmake
│   └── shadowsocks-libev.pc.cmake
├── completions/
│   ├── bash/
│   │   ├── ss-local
│   │   ├── ss-manager
│   │   ├── ss-redir
│   │   ├── ss-server
│   │   └── ss-tunnel
│   └── zsh/
│       ├── _ss-local
│       ├── _ss-manager
│       ├── _ss-redir
│       ├── _ss-server
│       └── _ss-tunnel
├── debian/
│   ├── .gitignore
│   ├── README.Debian
│   ├── changelog
│   ├── compat
│   ├── config.json
│   ├── control
│   ├── copyright
│   ├── copyright.original
│   ├── libshadowsocks-libev-dev.install
│   ├── libshadowsocks-libev2.install
│   ├── rules
│   ├── shadowsocks-libev-local@.service
│   ├── shadowsocks-libev-redir@.service
│   ├── shadowsocks-libev-server@.service
│   ├── shadowsocks-libev-tunnel@.service
│   ├── shadowsocks-libev.NEWS
│   ├── shadowsocks-libev.default
│   ├── shadowsocks-libev.doc-base
│   ├── shadowsocks-libev.docs
│   ├── shadowsocks-libev.init
│   ├── shadowsocks-libev.install
│   ├── shadowsocks-libev.lintian-overrides
│   ├── shadowsocks-libev.postinst
│   ├── shadowsocks-libev.postrm
│   ├── shadowsocks-libev.service
│   ├── source/
│   │   └── format
│   ├── tests/
│   │   └── control
│   ├── upstream/
│   │   └── metadata
│   └── watch
├── doc/
│   ├── CMakeLists.txt
│   ├── asciidoc.conf
│   ├── manpage-base.xsl
│   ├── manpage-bold-literal.xsl
│   ├── manpage-normal.xsl
│   ├── shadowsocks-libev.asciidoc
│   ├── ss-local.asciidoc
│   ├── ss-manager.asciidoc
│   ├── ss-nat.asciidoc
│   ├── ss-redir.asciidoc
│   ├── ss-server.asciidoc
│   └── ss-tunnel.asciidoc
├── docker/
│   ├── alpine/
│   │   ├── Dockerfile
│   │   ├── README.md
│   │   ├── docker-compose.yml
│   │   └── entrypoint.sh
│   └── mingw/
│       ├── Dockerfile
│       ├── Makefile
│       ├── apt.sh
│       ├── build.sh
│       ├── deps.sh
│       ├── make.bat
│       └── prepare.sh
├── rpm/
│   ├── SOURCES/
│   │   ├── etc/
│   │   │   └── init.d/
│   │   │       └── shadowsocks-libev
│   │   └── systemd/
│   │       ├── shadowsocks-libev-local.service
│   │       ├── shadowsocks-libev-local@.service
│   │       ├── shadowsocks-libev-redir@.service
│   │       ├── shadowsocks-libev-server@.service
│   │       ├── shadowsocks-libev-tunnel@.service
│   │       ├── shadowsocks-libev.default
│   │       └── shadowsocks-libev.service
│   ├── SPECS/
│   │   └── shadowsocks-libev.spec.in
│   └── genrpm.sh
├── scripts/
│   ├── build_deb.sh
│   ├── chroot_build.sh
│   ├── code-format.bat
│   ├── code-format.sh
│   ├── git_archive.sh
│   ├── git_version.sh
│   ├── iperf.sh
│   └── ss-setup.sh
├── snap/
│   └── snapcraft.yaml
├── src/
│   ├── CMakeLists.txt
│   ├── acl.c
│   ├── acl.h
│   ├── aead.c
│   ├── aead.h
│   ├── android.c
│   ├── base64.c
│   ├── base64.h
│   ├── cache.c
│   ├── cache.h
│   ├── common.h
│   ├── crypto.c
│   ├── crypto.h
│   ├── jconf.c
│   ├── jconf.h
│   ├── json.c
│   ├── json.h
│   ├── local.c
│   ├── local.h
│   ├── manager.c
│   ├── manager.h
│   ├── netutils.c
│   ├── netutils.h
│   ├── plugin.c
│   ├── plugin.h
│   ├── ppbloom.c
│   ├── ppbloom.h
│   ├── redir.c
│   ├── redir.h
│   ├── resolv.c
│   ├── resolv.h
│   ├── rule.c
│   ├── rule.h
│   ├── server.c
│   ├── server.h
│   ├── shadowsocks.h
│   ├── socks5.h
│   ├── ss-nat
│   ├── stream.c
│   ├── stream.h
│   ├── tunnel.c
│   ├── tunnel.h
│   ├── udprelay.c
│   ├── udprelay.h
│   ├── uthash.h
│   ├── utils.c
│   ├── utils.h
│   ├── winsock.c
│   └── winsock.h
└── tests/
    ├── CMakeLists.txt
    ├── aes-ctr.json
    ├── aes-gcm.json
    ├── aes.json
    ├── chacha20-ietf-poly1305.json
    ├── chacha20-ietf.json
    ├── chacha20.json
    ├── qemu/
    │   └── guest-init.sh
    ├── rc4-md5.json
    ├── redir.json
    ├── salsa20.json
    ├── stress_test.py
    ├── test.py
    ├── test.sh
    ├── test_base64.c
    ├── test_buffer.c
    ├── test_cache.c
    ├── test_crypto.c
    ├── test_deb_build.sh
    ├── test_jconf.c
    ├── test_json.c
    ├── test_netutils.c
    ├── test_ppbloom.c
    ├── test_redir_qemu.sh
    ├── test_rule.c
    ├── test_ss_setup.sh
    └── test_utils.c
Download .txt
SYMBOL INDEX (553 symbols across 51 files)

FILE: src/acl.c
  type ip_set (line 41) | struct ip_set
  type ip_set (line 42) | struct ip_set
  type ip_set (line 44) | struct ip_set
  type ip_set (line 45) | struct ip_set
  type cork_dllist (line 47) | struct cork_dllist
  type cork_dllist (line 48) | struct cork_dllist
  type ip_set (line 52) | struct ip_set
  type ip_set (line 53) | struct ip_set
  type cork_dllist (line 54) | struct cork_dllist
  function parse_addr_cidr (line 56) | static void
  function init_acl (line 100) | int
  function free_rules (line 228) | void
  function free_acl (line 238) | void
  function get_acl_mode (line 250) | int
  function acl_match_host (line 261) | int
  function acl_add_ip (line 292) | int
  function acl_remove_ip (line 310) | int
  function outbound_block_match_host (line 332) | int

FILE: src/aead.c
  function aead_cipher_encrypt (line 151) | static int
  function aead_cipher_decrypt (line 208) | static int
  function cipher_kt_t (line 270) | const cipher_kt_t *
  function aead_cipher_ctx_set_key (line 293) | static void
  function aead_cipher_ctx_init (line 332) | static void
  function aead_ctx_init (line 372) | void
  function aead_ctx_release (line 385) | void
  function aead_encrypt_all (line 407) | int
  function aead_decrypt_all (line 448) | int
  function aead_chunk_encrypt (line 498) | static int
  function aead_encrypt (line 537) | int
  function aead_chunk_decrypt (line 586) | static int
  function aead_decrypt (line 631) | int
  function cipher_t (line 727) | cipher_t *
  function cipher_t (line 761) | cipher_t *

FILE: src/android.c
  function protect_socket (line 48) | int
  function send_traffic_stat (line 97) | int

FILE: src/base64.c
  function base64_decode (line 51) | int base64_decode(uint8_t *out, const char *in, int out_size)

FILE: src/cache.c
  function cache_create (line 48) | int
  function cache_delete (line 79) | int
  function cache_clear (line 119) | int
  function cache_remove (line 161) | int
  function cache_lookup (line 208) | int
  function cache_key_exist (line 231) | int
  function cache_insert (line 267) | int

FILE: src/cache.h
  type cache_entry (line 42) | struct cache_entry {
  type cache (line 52) | struct cache {
  type cache (line 58) | struct cache
  type cache (line 60) | struct cache
  type cache (line 61) | struct cache
  type cache (line 62) | struct cache
  type cache (line 63) | struct cache
  type cache (line 64) | struct cache
  type cache (line 65) | struct cache

FILE: src/crypto.c
  function balloc (line 46) | int
  function brealloc (line 55) | int
  function bfree (line 68) | void
  function bprepend (line 81) | int
  function rand_bytes (line 91) | int
  function entropy_check (line 115) | static void
  function crypto_t (line 134) | crypto_t *
  function crypto_derive_key (line 205) | int
  function crypto_hkdf (line 249) | int
  function crypto_hkdf_extract (line 263) | int
  function crypto_hkdf_expand (line 286) | int
  function crypto_parse_key (line 355) | int
  function dump (line 383) | void

FILE: src/crypto.h
  type crypto_aead_aes256gcm_state (line 41) | typedef crypto_aead_aes256gcm_state aes256gcm_ctx;
  type mbedtls_cipher_info_t (line 45) | typedef mbedtls_cipher_info_t cipher_kt_t;
  type mbedtls_cipher_context_t (line 46) | typedef mbedtls_cipher_context_t cipher_evp_t;
  type mbedtls_md_info_t (line 47) | typedef mbedtls_md_info_t digest_type_t;
  type buffer_t (line 90) | typedef struct buffer {
  type cipher_t (line 97) | typedef struct {
  type cipher_ctx_t (line 106) | typedef struct {
  type crypto_t (line 118) | typedef struct crypto {
  function bswap_data (line 135) | static inline void
  type cache (line 167) | struct cache

FILE: src/jconf.c
  function free_addr (line 58) | void
  function parse_addr (line 65) | void
  function parse_dscp (line 120) | static int
  function jconf_t (line 155) | jconf_t *

FILE: src/jconf.h
  type ss_port_password_t (line 46) | typedef struct {
  type ss_dscp_t (line 51) | typedef struct {
  type jconf_t (line 56) | typedef struct {

FILE: src/json.c
  type _json_value (line 44) | struct _json_value
  type json_uchar (line 52) | typedef unsigned int json_uchar;
  function hex_value (line 54) | static unsigned char hex_value (json_char c)
  type json_state (line 70) | typedef struct
  function default_free (line 90) | static void default_free (void * ptr, void * user_data)
  function new_value (line 109) | static int new_value (json_state * state,
  function json_value (line 228) | json_value * json_parse_ex (json_settings * settings,
  function json_value (line 973) | json_value * json_parse (const json_char * json, size_t length)
  function json_value_free_ex (line 979) | void json_value_free_ex (json_settings * settings, json_value * value)
  function json_value_free (line 1029) | void json_value_free (json_value * value)

FILE: src/json.h
  type json_settings (line 58) | typedef struct
  type json_type (line 77) | typedef enum
  type _json_value (line 90) | struct _json_value
  type json_object_entry (line 92) | typedef struct _json_object_entry
  type return (line 101) | typedef struct _json_value
  function const (line 192) | inline const struct _json_value &operator [] (const char * index) const

FILE: src/local.c
  type ev_signal (line 106) | struct ev_signal
  type ev_signal (line 107) | struct ev_signal
  type ev_signal (line 109) | struct ev_signal
  type ev_signal (line 110) | struct ev_signal
  type plugin_watcher_t (line 113) | struct plugin_watcher_t {
  type sockaddr (line 142) | struct sockaddr
  type cork_dllist (line 151) | struct cork_dllist
  function setnonblocking (line 154) | int
  function create_and_bind (line 166) | int
  function launch_or_create (line 226) | int
  function free_connections (line 256) | static void
  function delayed_connect_cb (line 268) | static void
  function server_handshake_reply (line 277) | static int
  function server_handshake (line 331) | static int
  function server_stream (line 580) | static void
  function server_recv_cb (line 783) | static void
  function server_send_cb (line 889) | static void
  function stat_update_cb (line 928) | void
  function remote_timeout_cb (line 940) | static void
  function remote_recv_cb (line 957) | static void
  function remote_send_cb (line 1032) | static void
  function remote_t (line 1126) | static remote_t *
  function free_remote (line 1154) | static void
  function close_and_free_remote (line 1169) | static void
  function server_t (line 1181) | static server_t *
  function free_server (line 1220) | static void
  function close_and_free_server (line 1249) | static void
  function remote_t (line 1261) | static remote_t *
  function signal_cb (line 1341) | static void
  function plugin_watcher_cb (line 1373) | static void
  function accept_cb (line 1393) | void
  type option (line 1455) | struct option
  type sockaddr_in (line 1836) | struct sockaddr_in
  type sockaddr (line 1841) | struct sockaddr
  type sockaddr (line 1900) | struct sockaddr
  type sockaddr (line 1901) | struct sockaddr
  type sockaddr_storage (line 1910) | struct sockaddr_storage
  type sockaddr_storage (line 1910) | struct sockaddr_storage
  type sockaddr_storage (line 1911) | struct sockaddr_storage
  type sockaddr (line 1915) | struct sockaddr
  type ev_loop (line 1940) | struct ev_loop
  type sockaddr_storage (line 1969) | struct sockaddr_storage
  type sockaddr_storage (line 1969) | struct sockaddr_storage
  type sockaddr_storage (line 1970) | struct sockaddr_storage
  type sockaddr (line 1974) | struct sockaddr
  type sockaddr (line 1974) | struct sockaddr
  function _start_ss_local_server (line 2037) | int
  function start_ss_local_server (line 2183) | int
  function start_ss_local_server_with_callback (line 2189) | int

FILE: src/local.h
  type listen_ctx_t (line 43) | typedef struct listen_ctx {
  type server_ctx_t (line 53) | typedef struct server_ctx {
  type server_t (line 59) | typedef struct server {
  type remote_ctx_t (line 78) | typedef struct remote_ctx {
  type remote_t (line 86) | typedef struct remote {

FILE: src/manager.c
  type cork_hash_table (line 73) | struct cork_hash_table
  function setnonblocking (line 75) | static int
  function destroy_server (line 85) | static void
  function build_config (line 99) | static void
  type manager_ctx (line 144) | struct manager_ctx
  type server (line 144) | struct server
  type server (line 269) | struct server
  type server (line 288) | struct server
  type server (line 288) | struct server
  type server (line 289) | struct server
  function parse_traffic (line 340) | static int
  function create_and_bind (line 374) | static int
  function check_port (line 457) | static int
  function add_server (line 498) | static int
  function kill_server (line 520) | static void
  function stop_server (line 543) | static void
  function remove_server (line 565) | static void
  function update_stat (line 581) | static void
  function manager_recv_cb (line 594) | static void
  function signal_cb (line 766) | static void
  function create_server_socket (line 778) | int
  function main (line 855) | int

FILE: src/manager.h
  type manager_ctx (line 39) | struct manager_ctx {
  type server (line 68) | struct server {

FILE: src/netutils.c
  function set_reuseport (line 56) | int
  function get_sockaddr_len (line 63) | size_t
  function setinterface (line 75) | int
  function parse_local_addr (line 88) | int
  function bind_to_addr (line 116) | int
  function get_sockaddr (line 128) | ssize_t
  function sockaddr_cmp (line 202) | int
  function sockaddr_cmp_addr (line 236) | int
  function validate_hostname (line 263) | int
  function is_ipv6only (line 300) | int

FILE: src/netutils.h
  type ss_addr_t (line 58) | typedef struct {
  type sockaddr (line 86) | struct sockaddr
  type sockaddr_storage (line 88) | struct sockaddr_storage
  type sockaddr_storage (line 96) | struct sockaddr_storage
  type sockaddr_storage (line 97) | struct sockaddr_storage
  type sockaddr_storage (line 100) | struct sockaddr_storage
  type sockaddr_storage (line 110) | struct sockaddr_storage
  type sockaddr_storage (line 111) | struct sockaddr_storage
  type sockaddr_storage (line 120) | struct sockaddr_storage
  type sockaddr_storage (line 121) | struct sockaddr_storage

FILE: src/plugin.c
  type cork_env (line 51) | struct cork_env
  type cork_exec (line 52) | struct cork_exec
  type cork_subprocess (line 53) | struct cork_subprocess
  type cork_subprocess (line 56) | struct cork_subprocess
  function plugin_log__data (line 59) | static int
  function plugin_log__eof (line 74) | static int
  function plugin_log__free (line 82) | static void
  type cork_stream_consumer (line 88) | struct cork_stream_consumer
  function start_ss_plugin (line 94) | static int
  function start_obfsproxy (line 158) | static int
  type plugin_mode (line 246) | enum plugin_mode
  function get_local_port (line 302) | uint16_t
  function stop_plugin (line 332) | void
  function is_plugin_running (line 346) | int

FILE: src/plugin.h
  type plugin_mode (line 30) | enum plugin_mode {
  type plugin_mode (line 75) | enum plugin_mode

FILE: src/ppbloom.c
  type bloom (line 33) | struct bloom
  function ppbloom_init (line 39) | int
  function ppbloom_check (line 62) | int
  function ppbloom_add (line 78) | int
  function ppbloom_free (line 97) | void

FILE: src/redir.c
  type ev_signal (line 108) | struct ev_signal
  type ev_signal (line 109) | struct ev_signal
  type ev_signal (line 110) | struct ev_signal
  function getdestaddr (line 114) | static int
  function setnonblocking (line 135) | int
  function create_and_bind (line 145) | int
  function server_recv_cb (line 221) | static void
  function server_send_cb (line 313) | static void
  function delayed_connect_cb (line 350) | static void
  function remote_timeout_cb (line 374) | static void
  function remote_recv_cb (line 389) | static void
  function remote_send_cb (line 458) | static void
  function remote_t (line 614) | static remote_t *
  function free_remote (line 640) | static void
  function close_and_free_remote (line 655) | static void
  function server_t (line 667) | static server_t *
  function free_server (line 699) | static void
  function close_and_free_server (line 722) | static void
  function accept_cb (line 734) | static void
  function signal_cb (line 869) | static void
  function main (line 891) | int

FILE: src/redir.h
  type listen_ctx_t (line 34) | typedef struct listen_ctx {
  type server_ctx_t (line 44) | typedef struct server_ctx {
  type server_t (line 50) | typedef struct server {
  type remote_ctx_t (line 65) | typedef struct remote_ctx {
  type remote_t (line 72) | typedef struct remote {

FILE: src/resolv.c
  type resolv_ctx (line 72) | struct resolv_ctx {
  type resolv_query (line 81) | struct resolv_query {
  type resolv_ctx (line 98) | struct resolv_ctx
  type ev_loop (line 99) | struct ev_loop
  type ev_loop (line 108) | struct ev_loop
  type ev_io (line 108) | struct ev_io
  type ev_loop (line 109) | struct ev_loop
  type ev_timer (line 109) | struct ev_timer
  type hostent (line 112) | struct hostent
  type hostent (line 113) | struct hostent
  type resolv_query (line 115) | struct resolv_query
  type resolv_query (line 116) | struct resolv_query
  type sockaddr (line 117) | struct sockaddr
  type resolv_query (line 117) | struct resolv_query
  type sockaddr (line 118) | struct sockaddr
  type resolv_query (line 118) | struct resolv_query
  type sockaddr (line 119) | struct sockaddr
  type resolv_query (line 119) | struct resolv_query
  function resolv_sock_cb (line 124) | static void
  function resolv_init (line 139) | int
  function resolv_shutdown (line 195) | void
  function resolv_start (line 208) | void
  function dns_query_v4_cb (line 237) | static void
  function dns_query_v6_cb (line 299) | static void
  function process_client_callback (line 364) | static void
  type sockaddr (line 392) | struct sockaddr
  type resolv_query (line 393) | struct resolv_query
  type sockaddr (line 403) | struct sockaddr
  type resolv_query (line 404) | struct resolv_query
  type sockaddr (line 414) | struct sockaddr
  type resolv_query (line 415) | struct resolv_query
  function all_requests_are_null (line 424) | static inline int
  function resolv_timer_cb (line 439) | static void
  function resolv_sock_state_cb (line 462) | static void

FILE: src/resolv.h
  type resolv_query (line 38) | struct resolv_query
  type ev_loop (line 40) | struct ev_loop
  type sockaddr (line 42) | struct sockaddr
  type ev_loop (line 44) | struct ev_loop

FILE: src/rule.c
  function rule_t (line 40) | rule_t *
  function accept_rule_arg (line 54) | int
  function add_rule (line 71) | void
  function init_rule (line 77) | int
  function rule_t (line 101) | rule_t *
  function remove_rule (line 121) | void
  function free_rule (line 128) | static void

FILE: src/rule.h
  type rule_t (line 39) | typedef struct rule {
  type cork_dllist (line 49) | struct cork_dllist
  type cork_dllist (line 51) | struct cork_dllist

FILE: src/server.c
  type datatypes (line 62) | enum datatypes {
  type sockaddr (line 117) | struct sockaddr
  type sockaddr_storage (line 128) | struct sockaddr_storage
  type sockaddr_storage (line 129) | struct sockaddr_storage
  type ev_signal (line 156) | struct ev_signal
  type ev_signal (line 157) | struct ev_signal
  type ev_signal (line 159) | struct ev_signal
  type plugin_watcher_t (line 161) | struct plugin_watcher_t {
  type cork_dllist (line 169) | struct cork_dllist
  function stat_update_cb (line 172) | static void
  function free_connections (line 250) | static void
  type sockaddr_storage (line 266) | struct sockaddr_storage
  type sockaddr_storage (line 267) | struct sockaddr_storage
  type sockaddr (line 270) | struct sockaddr
  type sockaddr_in (line 273) | struct sockaddr_in
  type sockaddr_in (line 273) | struct sockaddr_in
  type sockaddr_in6 (line 276) | struct sockaddr_in6
  type sockaddr_in6 (line 276) | struct sockaddr_in6
  function stop_server (line 285) | static void
  type nftbl_set_info (line 292) | struct nftbl_set_info {
  type nftnl_set (line 299) | struct nftnl_set
  type nftnl_set (line 302) | struct nftnl_set
  type nftnl_set_elem (line 307) | struct nftnl_set_elem
  function nftbl_build_nlmsg (line 317) | static uint32_t
  function nftbl_send_request (line 339) | static int
  function nftbl_report_addr (line 361) | static void
  function nftbl_check_cb (line 395) | static int
  function nftbl_check (line 428) | static int
  function nftbl_init (line 460) | static int
  function report_addr (line 492) | static void
  function setfastopen (line 509) | int
  function setnonblocking (line 536) | int
  function create_and_bind (line 548) | int
  function remote_t (line 656) | static remote_t *
  function setMarkDscpCallback (line 843) | int
  function conntrackQuery (line 861) | void
  function setTosFromConnmark (line 881) | void
  function server_recv_cb (line 933) | static void
  function server_send_cb (line 1197) | static void
  function server_timeout_cb (line 1249) | static void
  function resolv_free_cb (line 1265) | static void
  function resolv_cb (line 1277) | static void
  function remote_recv_cb (line 1335) | static void
  function remote_send_cb (line 1420) | static void
  function remote_t (line 1533) | static remote_t *
  function free_remote (line 1563) | static void
  function close_and_free_remote (line 1578) | static void
  function server_t (line 1593) | static server_t *
  function free_server (line 1639) | static void
  function close_and_free_server (line 1676) | static void
  function signal_cb (line 1696) | static void
  function plugin_watcher_cb (line 1724) | static void
  function accept_cb (line 1744) | static void
  function main (line 1787) | int

FILE: src/server.h
  type listen_ctx_t (line 45) | typedef struct listen_ctx {
  type server_ctx_t (line 53) | typedef struct server_ctx {
  type dscptracker (line 65) | struct dscptracker {
  type query (line 74) | struct query
  type server_t (line 76) | typedef struct server {
  type query_t (line 98) | typedef struct query {
  type remote_ctx_t (line 103) | typedef struct remote_ctx {
  type remote_t (line 109) | typedef struct remote {

FILE: src/shadowsocks.h
  type profile_t (line 25) | typedef struct {

FILE: src/socks5.h
  type method_select_request (line 50) | struct method_select_request {
  type method_select_response (line 56) | struct method_select_response {
  type socks5_request (line 61) | struct socks5_request {
  type socks5_response (line 68) | struct socks5_response {

FILE: src/stream.c
  function crypto_stream_xor_ic (line 154) | static int
  function cipher_kt_t (line 171) | const cipher_kt_t *
  function stream_cipher_ctx_init (line 197) | void
  function stream_ctx_release (line 226) | void
  function cipher_ctx_set_nonce (line 243) | void
  function cipher_ctx_update (line 294) | static int
  function stream_encrypt_all (line 303) | int
  function stream_encrypt (line 353) | int
  function stream_decrypt_all (line 437) | int
  function stream_decrypt (line 495) | int
  function stream_ctx_init (line 627) | void
  function cipher_t (line 639) | cipher_t *
  function cipher_t (line 671) | cipher_t *

FILE: src/tunnel.c
  type ev_signal (line 101) | struct ev_signal
  type ev_signal (line 102) | struct ev_signal
  type ev_signal (line 104) | struct ev_signal
  type plugin_watcher_t (line 106) | struct plugin_watcher_t {
  function setnonblocking (line 115) | static int
  function create_and_bind (line 127) | int
  function server_recv_cb (line 186) | static void
  function server_send_cb (line 253) | static void
  function remote_timeout_cb (line 296) | static void
  function remote_recv_cb (line 315) | static void
  function remote_send_cb (line 384) | static void
  function remote_t (line 596) | static remote_t *
  function free_remote (line 622) | static void
  function close_and_free_remote (line 637) | static void
  function server_t (line 649) | static server_t *
  function free_server (line 678) | static void
  function close_and_free_server (line 701) | static void
  function accept_cb (line 712) | static void
  function signal_cb (line 835) | static void
  function plugin_watcher_cb (line 863) | static void
  type option (line 918) | struct option
  type sockaddr_in (line 1281) | struct sockaddr_in
  type sockaddr (line 1286) | struct sockaddr
  type listen_ctx (line 1351) | struct listen_ctx
  type listen_ctx (line 1352) | struct listen_ctx
  type sockaddr (line 1355) | struct sockaddr
  type sockaddr (line 1356) | struct sockaddr
  type sockaddr_storage (line 1364) | struct sockaddr_storage
  type sockaddr_storage (line 1364) | struct sockaddr_storage
  type sockaddr_storage (line 1365) | struct sockaddr_storage
  type sockaddr (line 1369) | struct sockaddr
  type ev_loop (line 1380) | struct ev_loop
  type sockaddr_storage (line 1405) | struct sockaddr_storage
  type sockaddr_storage (line 1405) | struct sockaddr_storage
  type sockaddr_storage (line 1406) | struct sockaddr_storage
  type sockaddr (line 1410) | struct sockaddr
  type sockaddr (line 1410) | struct sockaddr

FILE: src/tunnel.h
  type listen_ctx_t (line 41) | typedef struct listen_ctx {
  type server_ctx_t (line 52) | typedef struct server_ctx {
  type server_t (line 58) | typedef struct server {
  type remote_ctx_t (line 70) | typedef struct remote_ctx {
  type remote_t (line 77) | typedef struct remote {

FILE: src/udprelay.c
  type sockaddr_storage (line 81) | struct sockaddr_storage
  type sockaddr (line 84) | struct sockaddr
  type sockaddr_storage (line 103) | struct sockaddr_storage
  type sockaddr_storage (line 104) | struct sockaddr_storage
  function setnonblocking (line 115) | static int
  function set_broadcast (line 128) | static int
  function set_nosigpipe (line 138) | static int
  function get_dstaddr (line 173) | static int
  type sockaddr_storage (line 197) | struct sockaddr_storage
  type sockaddr_storage (line 199) | struct sockaddr_storage
  function construct_udprelay_header (line 211) | static int
  function parse_udprelay_header (line 244) | static int
  type sockaddr (line 327) | struct sockaddr
  type sockaddr_in (line 334) | struct sockaddr_in
  type sockaddr_in6 (line 335) | struct sockaddr_in6
  type sockaddr_in (line 339) | struct sockaddr_in
  type sockaddr_in6 (line 346) | struct sockaddr_in6
  function create_remote_socket (line 368) | int
  function create_server_socket (line 444) | int
  function remote_ctx_t (line 564) | remote_ctx_t *
  function server_ctx_t (line 581) | server_ctx_t *
  type query_ctx (line 595) | struct query_ctx
  type query_ctx (line 598) | struct query_ctx
  type query_ctx (line 598) | struct query_ctx
  type query_ctx (line 599) | struct query_ctx
  function close_and_free_query (line 607) | void
  function close_and_free_remote (line 621) | void
  function remote_timeout_cb (line 632) | static void
  function resolv_free_cb (line 647) | static void
  function resolv_cb (line 658) | static void
  function convert_ipv4_mapped_ipv6 (line 746) | void convert_ipv4_mapped_ipv6(struct sockaddr_storage* addr) {
  function remote_recv_cb (line 769) | static void
  function server_recv_cb (line 968) | static void
  function free_cb (line 1433) | void
  function init_udprelay (line 1445) | int
  function free_udprelay (line 1502) | void

FILE: src/udprelay.h
  type server_ctx_t (line 51) | typedef struct server_ctx {
  type query_ctx_t (line 71) | typedef struct query_ctx {
  type remote_ctx_t (line 81) | typedef struct remote_ctx {

FILE: src/uthash.h
  type UT_hash_bucket (line 1006) | typedef struct UT_hash_bucket {
  type UT_hash_table (line 1030) | typedef struct UT_hash_table {
  type UT_hash_handle (line 1063) | typedef struct UT_hash_handle {

FILE: src/utils.c
  function ERROR (line 64) | void
  function ss_isnumeric (line 97) | int
  function run_as (line 110) | int
  function FATAL (line 230) | void
  function ss_is_ipv6addr (line 279) | int
  function usage (line 285) | void
  function daemonize (line 442) | void
  function set_nofile (line 505) | int
  function load16_be (line 574) | uint16_t
  function get_mptcp (line 582) | int

FILE: src/winsock.c
  function disable_quick_edit (line 44) | static void
  function winsock_init (line 63) | void
  function winsock_cleanup (line 76) | void
  function setnonblocking (line 82) | int
  function ss_error (line 89) | void
  function BOOL (line 126) | static BOOL
  function BOOL (line 144) | static BOOL
  function ss_color_info (line 170) | void
  function ss_color_error (line 176) | void
  function ss_color_reset (line 182) | void
  function LPFN_CONNECTEX (line 189) | LPFN_CONNECTEX
  function winsock_dummybind (line 221) | int

FILE: src/winsock.h
  type sockaddr (line 118) | struct sockaddr

FILE: tests/stress_test.py
  function get_rss_kb (line 47) | def get_rss_kb(pid):
  class SinkServer (line 69) | class SinkServer:
    method __init__ (line 74) | def __init__(self, port):
    method _run (line 86) | def _run(self):
    method _handle (line 99) | def _handle(self, conn):
    method stop (line 112) | def stop(self):
  function server_args (line 118) | def server_args(ss_server, cipher, password, server_port):
  function tunnel_args (line 129) | def tunnel_args(ss_tunnel, cipher, password, server_port, local_port, fw...
  function kill_proc (line 142) | def kill_proc(proc):
  function run_bandwidth_test (line 156) | def run_bandwidth_test(bin_dir, cipher, data_size_mb, password="stress_t...
  function format_size (line 278) | def format_size(nbytes):
  function format_rss (line 288) | def format_rss(kb):
  function main (line 296) | def main():

FILE: tests/test_base64.c
  function test_encode_decode (line 7) | static void
  function test_empty_input (line 24) | static void
  function test_single_byte (line 33) | static void
  function test_two_bytes (line 48) | static void
  function test_three_bytes (line 64) | static void
  function test_roundtrip_binary (line 81) | static void
  function test_invalid_chars (line 97) | static void
  function main (line 105) | int

FILE: tests/test_buffer.c
  type cache (line 14) | struct cache
  function test_balloc (line 16) | static void
  function test_brealloc (line 35) | static void
  function test_bprepend (line 54) | static void
  function test_balloc_zero (line 82) | static void
  function main (line 95) | int

FILE: tests/test_cache.c
  function test_create_delete (line 14) | static void
  function test_create_null (line 27) | static void
  function test_insert_lookup (line 35) | static void
  function test_key_exist (line 52) | static void
  function test_remove (line 67) | static void
  function test_lookup_missing (line 83) | static void
  function test_eviction (line 96) | static void
  function main (line 118) | int

FILE: tests/test_crypto.c
  type cache (line 15) | struct cache
  function test_crypto_md5 (line 17) | static void
  function test_crypto_derive_key (line 41) | static void
  function test_crypto_hkdf (line 64) | static void
  function test_crypto_hkdf_extract (line 102) | static void
  function test_crypto_parse_key (line 132) | static void
  function main (line 151) | int

FILE: tests/test_jconf.c
  function test_parse_addr_ipv4_with_port (line 14) | static void
  function test_parse_addr_ipv6_with_port (line 27) | static void
  function test_parse_addr_hostname_with_port (line 40) | static void
  function test_parse_addr_no_port (line 53) | static void
  function test_parse_addr_ipv6_no_port (line 65) | static void
  function main (line 76) | int

FILE: tests/test_json.c
  function test_parse_simple_object (line 7) | static void
  function test_parse_array (line 29) | static void
  function test_parse_nested (line 45) | static void
  function test_parse_types (line 64) | static void
  function test_parse_invalid (line 84) | static void
  function test_parse_empty_object (line 97) | static void
  function test_parse_empty_array (line 108) | static void
  function main (line 119) | int

FILE: tests/test_netutils.c
  function test_get_sockaddr_len (line 16) | static void
  function test_sockaddr_cmp (line 36) | static void
  function test_sockaddr_cmp_addr (line 59) | static void
  function test_validate_hostname (line 83) | static void
  function main (line 107) | int

FILE: tests/test_ppbloom.c
  function test_init_free (line 14) | static void
  function test_add_check (line 23) | static void
  function test_binary_data (line 51) | static void
  function main (line 67) | int

FILE: tests/test_rule.c
  function test_new_rule (line 14) | static void
  function test_accept_rule_arg (line 24) | static void
  function test_init_rule (line 44) | static void
  function test_init_rule_invalid (line 63) | static void
  function test_lookup_rule (line 77) | static void
  function main (line 117) | int

FILE: tests/test_utils.c
  function test_ss_itoa (line 13) | static void
  function test_ss_isnumeric (line 36) | static void
  function test_ss_strndup (line 47) | static void
  function main (line 69) | int
Condensed preview — 187 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,543K chars).
[
  {
    "path": ".copr/Makefile",
    "chars": 575,
    "preview": ".PHONY: deps srpm\n.DEFAULT_GOAL := srpm\n\nDOT_COPR := $(dir $(firstword $(MAKEFILE_LIST)))\nTOP_DIR := $(realpath $(DOT_CO"
  },
  {
    "path": ".dockerignore",
    "chars": 280,
    "preview": "# General\n.dockerignore\n.git\n.gitmodules\n.gitignore\n.github\nAUTHORS\nChanges\nCOPYING\nINSTALL\nLICENSE\nREADME.md\n\n# Code fo"
  },
  {
    "path": ".github/FUNDING.yml",
    "chars": 78,
    "preview": "custom: ['https://crowdfunding.lfx.linuxfoundation.org/projects/shadowsocks']\n"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 116,
    "preview": "version: 2\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"daily\""
  },
  {
    "path": ".github/issue_template.md",
    "chars": 514,
    "preview": "Please answer these questions before submitting your issue. Thanks!\n\n(Please mention that if the issue you filed is solv"
  },
  {
    "path": ".github/workflows/build.yml",
    "chars": 1703,
    "preview": "name: build\n\non:\n  push:\n    branches: [master]\n  pull_request:\n    branches: [master]\n\njobs:\n  build:\n    strategy:\n   "
  },
  {
    "path": ".gitignore",
    "chars": 1302,
    "preview": "# Ignore files generated by autoconf\n/Makefile.in\n/aclocal.m4\n/auto/\n/config.h.in\n/configure\n/doc/Makefile.in\n/m4/libtoo"
  },
  {
    "path": ".gitmodules",
    "chars": 324,
    "preview": "[submodule \"libcork\"]\n\tpath = libcork\n\turl = https://github.com/shadowsocks/libcork.git\n    ignore = dirty\n[submodule \"l"
  },
  {
    "path": ".travis.yml",
    "chars": 1740,
    "preview": "sudo: required\nlanguage: c\ndist : trusty\ncompiler:\n    - clang\n    - gcc\nos:\n    - linux\n    - osx\nenv:\n    global:\n    "
  },
  {
    "path": ".uncrustify.cfg",
    "chars": 61451,
    "preview": "#\n# General options\n#\n\n# The type of line endings\nnewlines                                 = lf       # auto/lf/crlf/cr\n"
  },
  {
    "path": "AUTHORS",
    "chars": 420,
    "preview": "Shadowsocks-libev was originally created in late 2013, by\nClowwindy <clowwindy@gmail.com>, then rewritten and maintained"
  },
  {
    "path": "CLAUDE.md",
    "chars": 4611,
    "preview": "# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## "
  },
  {
    "path": "CMakeLists.txt",
    "chars": 6484,
    "preview": "cmake_minimum_required(VERSION 3.5)\n\nset(PROJECT_NAME shadowsocks-libev)\nset(RELEASE_DATE 2026-02-09)\nset(PROJECT_VERSIO"
  },
  {
    "path": "COPYING",
    "chars": 613,
    "preview": "This program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public Licens"
  },
  {
    "path": "Changes",
    "chars": 16435,
    "preview": "shadowsocks-libev (3.3.5-1) unstable; urgency=medium\n\n  * Remove the SNI proxy function.\n  * Minor bug fixes. (#2581, #2"
  },
  {
    "path": "LICENSE",
    "chars": 32473,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README.md",
    "chars": 26735,
    "preview": "# shadowsocks-libev\n\n[![Build Status](https://travis-ci.com/shadowsocks/shadowsocks-libev.svg?branch=master)](https://tr"
  },
  {
    "path": "README_pt_BR.md",
    "chars": 25170,
    "preview": "# shadowsocks-libev\n\n[![Build Status](https://travis-ci.com/shadowsocks/shadowsocks-libev.svg?branch=master)](https://tr"
  },
  {
    "path": "acl/chn.acl",
    "chars": 90334,
    "preview": "[proxy_all]\n\n[bypass_list]\n1.0.1.0/24\n1.0.2.0/23\n1.0.8.0/21\n1.0.32.0/19\n1.1.0.0/24\n1.1.2.0/23\n1.1.4.0/22\n1.1.8.0/21\n1.1."
  },
  {
    "path": "acl/gfwlist.acl",
    "chars": 125834,
    "preview": "# gfw list rules for shadowsocks-libev $\n# updated on 2020-04-18 01:30:05$\n[bypass_all]\n\n[proxy_list]\n# Telegram IPs$\n14"
  },
  {
    "path": "acl/local.acl",
    "chars": 274,
    "preview": "[reject_all]\n\n[white_list]\n0.0.0.0/8\n10.0.0.0/8\n100.64.0.0/10\n127.0.0.0/8\n169.254.0.0/16\n172.16.0.0/12\n192.0.0.0/24\n192."
  },
  {
    "path": "acl/server_block_chn.acl",
    "chars": 90612,
    "preview": "# All IPs listed here will be blocked while the ss-server try to outbound.\n# Only IP is allowed, *NOT* domain name.\n#\n# "
  },
  {
    "path": "acl/server_block_local.acl",
    "chars": 409,
    "preview": "# All IPs listed here will be blocked while the ss-server try to outbound.\n# Only IP is allowed, *NOT* domain name.\n#\n\n["
  },
  {
    "path": "cmake/FindCares.cmake",
    "chars": 1139,
    "preview": "# FindCares.cmake - Find c-ares library\n#\n# Sets:\n#   CARES_FOUND\n#   CARES_INCLUDE_DIRS\n#   CARES_LIBRARIES\n\nfind_path("
  },
  {
    "path": "cmake/FindMbedTLS.cmake",
    "chars": 2541,
    "preview": "# FindMbedTLS.cmake - Find mbedTLS library with feature detection\n#\n# Sets:\n#   MBEDTLS_FOUND\n#   MBEDTLS_INCLUDE_DIRS\n#"
  },
  {
    "path": "cmake/FindPCRE2.cmake",
    "chars": 1753,
    "preview": "# FindPCRE2.cmake - Find PCRE2 library (8-bit)\n#\n# Sets:\n#   PCRE2_FOUND\n#   PCRE2_INCLUDE_DIRS\n#   PCRE2_LIBRARIES\n\ninc"
  },
  {
    "path": "cmake/FindSodium.cmake",
    "chars": 1657,
    "preview": "# FindSodium.cmake - Find libsodium with version check\n#\n# Sets:\n#   SODIUM_FOUND\n#   SODIUM_INCLUDE_DIRS\n#   SODIUM_LIB"
  },
  {
    "path": "cmake/config.h.cmake",
    "chars": 9373,
    "preview": "#ifndef _SHADOWSOCKS_CONFIG_H\n#define _SHADOWSOCKS_CONFIG_H\n\n/* Define if building universal (internal helper macro) */\n"
  },
  {
    "path": "cmake/configure.cmake",
    "chars": 5958,
    "preview": "\n# -------------------------------------------------------------\n# config.h\n\n# Use cmake to generate config.h\ninclude(Ch"
  },
  {
    "path": "cmake/shadowsocks-libev.pc.cmake",
    "chars": 308,
    "preview": "prefix=@CMAKE_INSTALL_PREFIX@\nexec_prefix=${prefix}\nlibdir=${prefix}/@CMAKE_INSTALL_LIBDIR@\nincludedir=${prefix}/@CMAKE_"
  },
  {
    "path": "completions/bash/ss-local",
    "chars": 1256,
    "preview": "_ss_local()\n{\n    local cur prev opts ciphers\n    opts='-s -p -l -k -m -a -f -t -c -n -i -b -u -U -v -h --reuse-port --f"
  },
  {
    "path": "completions/bash/ss-manager",
    "chars": 1464,
    "preview": "_ss_manager()\n{\n    local cur prev opts ciphers\n    opts='-s -p -l -k -m -a -f -t -c -n -i -b -u -U -v -h --reuse-port -"
  },
  {
    "path": "completions/bash/ss-redir",
    "chars": 1149,
    "preview": "_ss_redir()\n{\n    local cur prev opts ciphers\n    opts='-s -p -l -k -m -a -f -t -c -n -b -u -U -T -v -h --reuse-port --m"
  },
  {
    "path": "completions/bash/ss-server",
    "chars": 1494,
    "preview": "_ss_server()\n{\n    local cur prev opts ciphers\n    opts='-s -p -l -k -m -a -f -t -c -n -i -b -u -U -6 -d -v -h --reuse-p"
  },
  {
    "path": "completions/bash/ss-tunnel",
    "chars": 1407,
    "preview": "_ss_tunnel()\n{\n    local cur prev opts ciphers\n    opts='-s -p -l -k -m -a -f -t -c -n -i -b -u -U -L -v -h --reuse-port"
  },
  {
    "path": "completions/zsh/_ss-local",
    "chars": 1183,
    "preview": "#compdef ss-local\n\nlocal ciphers\nciphers='(rc4-md5 aes-128-gcm aes-192-gcm aes-256-gcm aes-128-cfb aes-192-cfb aes-256-c"
  },
  {
    "path": "completions/zsh/_ss-manager",
    "chars": 1206,
    "preview": "#compdef ss-manager\n\nlocal ciphers\nciphers='(rc4-md5 aes-128-gcm aes-192-gcm aes-256-gcm aes-128-cfb aes-192-cfb aes-256"
  },
  {
    "path": "completions/zsh/_ss-redir",
    "chars": 1151,
    "preview": "#compdef ss-redir\n\nlocal ciphers\nciphers='(rc4-md5 aes-128-gcm aes-192-gcm aes-256-gcm aes-128-cfb aes-192-cfb aes-256-c"
  },
  {
    "path": "completions/zsh/_ss-server",
    "chars": 1311,
    "preview": "#compdef ss-server\n\nlocal ciphers\nciphers='(rc4-md5 aes-128-gcm aes-192-gcm aes-256-gcm aes-128-cfb aes-192-cfb aes-256-"
  },
  {
    "path": "completions/zsh/_ss-tunnel",
    "chars": 1139,
    "preview": "#compdef ss-tunnel\n\nlocal ciphers\nciphers='(rc4-md5 aes-128-gcm aes-192-gcm aes-256-gcm aes-128-cfb aes-192-cfb aes-256-"
  },
  {
    "path": "debian/.gitignore",
    "chars": 88,
    "preview": "*.substvars\ndebhelper-build-stamp\nlibshadowsocks-libev*/\nlibshadowsocks-libev-dev/\ntmp/\n"
  },
  {
    "path": "debian/README.Debian",
    "chars": 748,
    "preview": "shadowsocks-libev for Debian\n----------------------------\n\nThe Debian package has added systemd support. A default serve"
  },
  {
    "path": "debian/changelog",
    "chars": 16680,
    "preview": "shadowsocks-libev (3.3.6-1) unstable; urgency=medium\n\n  * Reduce memory copies in crypto encrypt/decrypt paths.\n  * Fix "
  },
  {
    "path": "debian/compat",
    "chars": 3,
    "preview": "10\n"
  },
  {
    "path": "debian/config.json",
    "chars": 197,
    "preview": "{\n    \"server\":[\"::1\", \"127.0.0.1\"],\n    \"mode\":\"tcp_and_udp\",\n    \"server_port\":8388,\n    \"local_port\":1080,\n    \"passw"
  },
  {
    "path": "debian/control",
    "chars": 2408,
    "preview": "Source: shadowsocks-libev\nSection: net\nPriority: optional\nMaintainer: Debian Bridges Team <team+bridges@tracker.debian.o"
  },
  {
    "path": "debian/copyright",
    "chars": 8697,
    "preview": "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: shadowsocks-libev\nUpstream-Con"
  },
  {
    "path": "debian/copyright.original",
    "chars": 382,
    "preview": "This work was packaged for Debian by:\n\n    Max Lv <max.c.lv@gmail.com> on Sat, 06 Apr 2013 16:59:15 +0800\n\nIt was downlo"
  },
  {
    "path": "debian/libshadowsocks-libev-dev.install",
    "chars": 68,
    "preview": "usr/include/\nusr/lib/*/libshadowsocks-libev.so\nusr/lib/*/pkgconfig/\n"
  },
  {
    "path": "debian/libshadowsocks-libev2.install",
    "chars": 36,
    "preview": "usr/lib/*/libshadowsocks-libev.so.*\n"
  },
  {
    "path": "debian/rules",
    "chars": 437,
    "preview": "#!/usr/bin/make -f\n# See debhelper(7) (uncomment to enable)\n# output every command that modifies files on the build syst"
  },
  {
    "path": "debian/shadowsocks-libev-local@.service",
    "chars": 815,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "debian/shadowsocks-libev-redir@.service",
    "chars": 854,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "debian/shadowsocks-libev-server@.service",
    "chars": 817,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "debian/shadowsocks-libev-tunnel@.service",
    "chars": 829,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "debian/shadowsocks-libev.NEWS",
    "chars": 800,
    "preview": "shadowsocks-libev (3.2.0+ds-5) unstable; urgency=medium\n\n  There is a mode setting to choose whether to enable both TCP "
  },
  {
    "path": "debian/shadowsocks-libev.default",
    "chars": 602,
    "preview": "# Defaults for shadowsocks initscript\n# sourced by /etc/init.d/shadowsocks-libev\n# installed at /etc/default/shadowsocks"
  },
  {
    "path": "debian/shadowsocks-libev.doc-base",
    "chars": 315,
    "preview": "Document: shadowsocks-libev\nTitle: shadowsocks-libev documentation\nAuthor: Max Lv <max.c.lv@gmail.com>\nAbstract: This is"
  },
  {
    "path": "debian/shadowsocks-libev.docs",
    "chars": 63,
    "preview": "AUTHORS\nREADME.md\ndebian/copyright.original\nscripts\ndoc/*.html\n"
  },
  {
    "path": "debian/shadowsocks-libev.init",
    "chars": 4033,
    "preview": "#!/bin/sh\n### BEGIN INIT INFO\n# Provides:          shadowsocks-libev\n# Required-Start:    $network $local_fs $remote_fs\n"
  },
  {
    "path": "debian/shadowsocks-libev.install",
    "chars": 268,
    "preview": "completions/bash/* usr/share/bash-completion/completions/\ncompletions/zsh/* usr/share/zsh/vendor-completions/\ndebian/con"
  },
  {
    "path": "debian/shadowsocks-libev.lintian-overrides",
    "chars": 509,
    "preview": "# False positive: systemd service templates cannot fallback to sysvinit script\npackage-supports-alternative-init-but-no-"
  },
  {
    "path": "debian/shadowsocks-libev.postinst",
    "chars": 1283,
    "preview": "#!/bin/sh\n\nset -e\n\n# POSIX-compliant maint function recommend by devref\n# to check for the existence of a command\n# http"
  },
  {
    "path": "debian/shadowsocks-libev.postrm",
    "chars": 525,
    "preview": "#!/bin/sh\n\nset -e\n\ncase \"$1\" in\n\tpurge)\n\t\trm -f /etc/shadowsocks-libev/config.json\n\t\tif test ! -e /etc/shadowsocks-libev"
  },
  {
    "path": "debian/shadowsocks-libev.service",
    "chars": 858,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "debian/source/format",
    "chars": 12,
    "preview": "3.0 (quilt)\n"
  },
  {
    "path": "debian/tests/control",
    "chars": 96,
    "preview": "Test-Command: bash tests/test.sh\nDepends: @, python3, curl, dnsutils\nRestrictions: allow-stderr\n"
  },
  {
    "path": "debian/upstream/metadata",
    "chars": 298,
    "preview": "Name: shadowsocks-libev\nHomepage: https://shadowsocks.org\nRepository: https://github.com/shadowsocks/shadowsocks-libev.g"
  },
  {
    "path": "debian/watch",
    "chars": 288,
    "preview": "version=4\n\nopts=\"repack,compression=xz, \\\n   dversionmangle=s/\\+ds\\d*$//,repacksuffix=+ds, \\\n   filenamemangle=s%(?:.*?)"
  },
  {
    "path": "doc/CMakeLists.txt",
    "chars": 3499,
    "preview": "find_program(XMLTO_EXECUTABLE NAMES xmlto)\nfind_program(ASCIIDOC_EXECUTABLE NAMES asciidoc asciidoc.py)\n\n# Opt-in doc bu"
  },
  {
    "path": "doc/asciidoc.conf",
    "chars": 787,
    "preview": "[tags]\nbracket-emphasis={1?[{1}]}<emphasis>&lt;|&gt;</emphasis>\n\n[quotes]\n&lt;|&gt;=#bracket-emphasis\n\n[attributes]\naste"
  },
  {
    "path": "doc/manpage-base.xsl",
    "chars": 1192,
    "preview": "<!-- manpage-base.xsl:\n     special formatting for manpages rendered from asciidoc+docbook -->\n<xsl:stylesheet xmlns:xsl"
  },
  {
    "path": "doc/manpage-bold-literal.xsl",
    "chars": 578,
    "preview": "<!-- manpage-bold-literal.xsl:\n     special formatting for manpages rendered from asciidoc+docbook -->\n<xsl:stylesheet x"
  },
  {
    "path": "doc/manpage-normal.xsl",
    "chars": 475,
    "preview": "<!-- manpage-normal.xsl:\n     special settings for manpages rendered from asciidoc+docbook\n     handles anything we want"
  },
  {
    "path": "doc/shadowsocks-libev.asciidoc",
    "chars": 9549,
    "preview": "shadowsocks-libev(8)\n====================\n\nNAME\n----\nshadowsocks-libev - a lightweight and secure socks5 proxy\n\nSYNOPSIS"
  },
  {
    "path": "doc/ss-local.asciidoc",
    "chars": 4272,
    "preview": "ss-local(1)\n===========\n\nNAME\n----\nss-local - shadowsocks client as socks5 proxy, libev port\n\nSYNOPSIS\n--------\n*ss-loca"
  },
  {
    "path": "doc/ss-manager.asciidoc",
    "chars": 5087,
    "preview": "ss-manager(1)\n=============\n\nNAME\n----\nss-manager - ss-server controller for multi-user management and traffic statistic"
  },
  {
    "path": "doc/ss-nat.asciidoc",
    "chars": 2061,
    "preview": "ss-nat(1)\n=========\n\nNAME\n----\nss-nat - helper script to setup NAT rules for transparent proxy\n\nSYNOPSIS\n--------\n*ss-na"
  },
  {
    "path": "doc/ss-redir.asciidoc",
    "chars": 5121,
    "preview": "ss-redir(1)\n===========\n\nNAME\n----\nss-redir - shadowsocks client as transparent proxy, libev port\n\nSYNOPSIS\n--------\n*ss"
  },
  {
    "path": "doc/ss-server.asciidoc",
    "chars": 5112,
    "preview": "ss-server(1)\n============\n\nNAME\n----\nss-server - shadowsocks server, libev port\n\nSYNOPSIS\n--------\n*ss-server*\n [-uUv] ["
  },
  {
    "path": "doc/ss-tunnel.asciidoc",
    "chars": 4440,
    "preview": "ss-tunnel(1)\n============\n\nNAME\n----\nss-tunnel - shadowsocks tools for local port forwarding, libev port\n\nSYNOPSIS\n-----"
  },
  {
    "path": "docker/alpine/Dockerfile",
    "chars": 1400,
    "preview": "FROM alpine:3.16\nLABEL maintainer=\"kev <noreply@datageek.info>, Sah <contact@leesah.name>, vndroid <waveworkshop@outlook"
  },
  {
    "path": "docker/alpine/README.md",
    "chars": 5771,
    "preview": "# Shadowsocks-libev Docker Image\n\n[shadowsocks-libev][1] is a lightweight secured socks5 proxy for embedded\ndevices and "
  },
  {
    "path": "docker/alpine/docker-compose.yml",
    "chars": 188,
    "preview": "shadowsocks:\n  image: shadowsocks/shadowsocks-libev\n  ports:\n    - \"8388:8388/tcp\"\n    - \"8388:8388/udp\"\n  environment:\n"
  },
  {
    "path": "docker/alpine/entrypoint.sh",
    "chars": 812,
    "preview": "#!/bin/sh\n# vim:sw=4:ts=4:et\n\nset -e\n\nif [ \"$1\" = \"ss-server\" ]; then\n    COREVER=$(uname -r | grep -Eo '[0-9].[0-9]+' |"
  },
  {
    "path": "docker/mingw/Dockerfile",
    "chars": 1307,
    "preview": "#\n# Dockerfile for building MinGW port\n#\n# This file is part of the shadowsocks-libev.\n#\n# shadowsocks-libev is free sof"
  },
  {
    "path": "docker/mingw/Makefile",
    "chars": 1185,
    "preview": "#\n# Makefile for building MinGW port\n#\n# This file is part of the shadowsocks-libev.\n#\n# shadowsocks-libev is free softw"
  },
  {
    "path": "docker/mingw/apt.sh",
    "chars": 984,
    "preview": "#!/bin/bash\n#\n# Functions for building MinGW port in Docker\n#\n# This file is part of the shadowsocks-libev.\n#\n# shadowso"
  },
  {
    "path": "docker/mingw/build.sh",
    "chars": 1806,
    "preview": "#!/bin/bash\n#\n# Functions for building MinGW port in Docker\n#\n# This file is part of the shadowsocks-libev.\n#\n# shadowso"
  },
  {
    "path": "docker/mingw/deps.sh",
    "chars": 2034,
    "preview": "#!/bin/bash\n#\n# Functions for building MinGW port in Docker\n#\n# This file is part of the shadowsocks-libev.\n#\n# shadowso"
  },
  {
    "path": "docker/mingw/make.bat",
    "chars": 385,
    "preview": "@echo off\r\npushd %~dp0\r\nset \"REPO=shadowsocks\"\r\nset \"REV=master\"\r\nset \"PLUGIN=true\"\r\nset \"IMAGE=ss-build-mingw\"\r\nset \"DI"
  },
  {
    "path": "docker/mingw/prepare.sh",
    "chars": 2129,
    "preview": "#!/bin/bash\n#\n# Functions for building MinGW port in Docker\n#\n# This file is part of the shadowsocks-libev.\n#\n# shadowso"
  },
  {
    "path": "rpm/SOURCES/etc/init.d/shadowsocks-libev",
    "chars": 2230,
    "preview": "#!/bin/bash\n#\n# Script to run Shadowsocks in daemon mode at boot time.\n# ScriptAuthor: icyboy\n# Revision 1.0 - 14th Sep "
  },
  {
    "path": "rpm/SOURCES/systemd/shadowsocks-libev-local.service",
    "chars": 799,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "rpm/SOURCES/systemd/shadowsocks-libev-local@.service",
    "chars": 801,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "rpm/SOURCES/systemd/shadowsocks-libev-redir@.service",
    "chars": 826,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "rpm/SOURCES/systemd/shadowsocks-libev-server@.service",
    "chars": 803,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "rpm/SOURCES/systemd/shadowsocks-libev-tunnel@.service",
    "chars": 815,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "rpm/SOURCES/systemd/shadowsocks-libev.default",
    "chars": 607,
    "preview": "# Defaults for shadowsocks initscript\n# sourced by /etc/init.d/shadowsocks-libev\n# installed at /etc/sysconfig/shadowsoc"
  },
  {
    "path": "rpm/SOURCES/systemd/shadowsocks-libev.service",
    "chars": 824,
    "preview": "#  This file is part of shadowsocks-libev.\n#\n#  Shadowsocks-libev is free software; you can redistribute it and/or modif"
  },
  {
    "path": "rpm/SPECS/shadowsocks-libev.spec.in",
    "chars": 6560,
    "preview": "%global requires   pcre openssl mbedtls libsodium >= 1.0.4 libev c-ares\n%global conflicts  python-shadowsocks python3-sh"
  },
  {
    "path": "rpm/genrpm.sh",
    "chars": 2019,
    "preview": "#!/usr/bin/env bash\nset -e\n\nNAME=shadowsocks-libev\n\nSELF=$(readlink -f -- \"$0\")\nHERE=$(dirname -- \"$SELF\")\n\nSOURCES=\"${H"
  },
  {
    "path": "scripts/build_deb.sh",
    "chars": 13445,
    "preview": "#!/bin/sh\n# Copyright 2017-2018 Roger Shimizu <rosh@debian.org>\n#\n# This is free software; you can redistribute it and/o"
  },
  {
    "path": "scripts/chroot_build.sh",
    "chars": 3288,
    "preview": "#!/bin/sh\n# Copyright 2018 Roger Shimizu <rosh@debian.org>\n#\n# This is free software; you can redistribute it and/or mod"
  },
  {
    "path": "scripts/code-format.bat",
    "chars": 545,
    "preview": "@echo off\n\nset root=%~dp0\nset source=%root%src\n\ngoto start\n\n:format\nset filelist=%1\nfor /r \"%filelist%\" %%f in (*) do (\n"
  },
  {
    "path": "scripts/code-format.sh",
    "chars": 628,
    "preview": "#!/usr/bin/env bash\n\nroot=$(pwd)\nsource=\"$root\"/src\n\nfunction format() {\n  filelist=$(ls \"$1\")\n  pushd \"$1\"\n  for file i"
  },
  {
    "path": "scripts/git_archive.sh",
    "chars": 1361,
    "preview": "#!/usr/bin/env bash\nset -e\n\narchive() {\n    export TARBALL_NAME=$1\n    export TARBALL_OUTDIR=$2\n\n    # archive this repo"
  },
  {
    "path": "scripts/git_version.sh",
    "chars": 533,
    "preview": "#!/usr/bin/env bash\nset -e\n\n# determine version and release number\nGIT_DESCRIBE=$(git describe --tags --match 'v*' --lon"
  },
  {
    "path": "scripts/iperf.sh",
    "chars": 465,
    "preview": "#!/bin/bash\n\nnumber=$1\nmethod=$2\n\nss-tunnel -k test -m $method -l 8387 -L 127.0.0.1:8388 -s 127.0.0.1 -p 8389 &\nss_tunne"
  },
  {
    "path": "scripts/ss-setup.sh",
    "chars": 43424,
    "preview": "#!/usr/bin/env bash\nset -euo pipefail\n\n###############################################################################\n#"
  },
  {
    "path": "snap/snapcraft.yaml",
    "chars": 1660,
    "preview": "base: core22\nname: shadowsocks-libev\nversion: '3.3.6'\nsummary: libev port of shadowsocks\ndescription: |\n  Shadowsocks-li"
  },
  {
    "path": "src/CMakeLists.txt",
    "chars": 10596,
    "preview": "# redir need linux/* stuff\nif (LINUX)\n    option(WITH_SS_REDIR \"Build ss-redir\" ON)\n    option(WITH_SS_MANAGER \"Build ss"
  },
  {
    "path": "src/acl.c",
    "chars": 9282,
    "preview": "/*\n * acl.c - Manage the ACL (Access Control List)\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * Th"
  },
  {
    "path": "src/acl.h",
    "chars": 1166,
    "preview": "/*\n * acl.h - Define the ACL interface\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is p"
  },
  {
    "path": "src/aead.c",
    "chars": 24011,
    "preview": "/*\n * aead.c - Manage AEAD ciphers\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is part "
  },
  {
    "path": "src/aead.h",
    "chars": 1525,
    "preview": "/*\n * aead.h - Define the AEAD interface\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is"
  },
  {
    "path": "src/android.c",
    "chars": 3602,
    "preview": "/*\n * android.c - Setup IPC for shadowsocks-android\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * T"
  },
  {
    "path": "src/base64.c",
    "chars": 3220,
    "preview": "/*\n * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)\n *\n * This file is part of FFmpeg.\n *\n * FFmpeg is fre"
  },
  {
    "path": "src/base64.h",
    "chars": 1838,
    "preview": "/*\n * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)\n *\n * This file is part of FFmpeg.\n *\n * FFmpeg is fre"
  },
  {
    "path": "src/cache.c",
    "chars": 7077,
    "preview": "/*\n * cache.c - Manage the connection cache for UDPRELAY\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *"
  },
  {
    "path": "src/cache.h",
    "chars": 2181,
    "preview": "/*\n * cache.h - Define the cache manager interface\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * Th"
  },
  {
    "path": "src/common.h",
    "chars": 2476,
    "preview": "/*\n * common.h - Provide global definitions\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file"
  },
  {
    "path": "src/crypto.c",
    "chars": 10668,
    "preview": "/*\n * crypto.c - Manage the global crypto\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file i"
  },
  {
    "path": "src/crypto.h",
    "chars": 4945,
    "preview": "/*\n * crypto.h - Define the enryptor's interface\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This"
  },
  {
    "path": "src/jconf.c",
    "chars": 14084,
    "preview": "/*\n * jconf.c - Parse the JSON format config file\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * Thi"
  },
  {
    "path": "src/jconf.h",
    "chars": 2489,
    "preview": "/*\n * jconf.h - Define the config data structure\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This"
  },
  {
    "path": "src/json.c",
    "chars": 30627,
    "preview": "/* vim: set et ts=3 sw=3 sts=3 ft=c:\n *\n * Copyright (C) 2012, 2013, 2014 James McLaughlin et al.  All rights reserved.\n"
  },
  {
    "path": "src/json.h",
    "chars": 6407,
    "preview": "\n/* vim: set et ts=3 sw=3 sts=3 ft=c:\n *\n * Copyright (C) 2012, 2013, 2014 James McLaughlin et al.  All rights reserved."
  },
  {
    "path": "src/local.c",
    "chars": 66621,
    "preview": "/*\n * local.c - Setup a socks5 proxy through remote shadowsocks server\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv"
  },
  {
    "path": "src/local.h",
    "chars": 2224,
    "preview": "/*\n * local.h - Define the client's buffers and callbacks\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n "
  },
  {
    "path": "src/manager.c",
    "chars": 37506,
    "preview": "/*\n * server.c - Provide shadowsocks service\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This fil"
  },
  {
    "path": "src/manager.h",
    "chars": 1775,
    "preview": "/*\n * server.h - Define shadowsocks server's buffers and callbacks\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gma"
  },
  {
    "path": "src/netutils.c",
    "chars": 9728,
    "preview": "/*\n * netutils.c - Network utilities\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is par"
  },
  {
    "path": "src/netutils.h",
    "chars": 3631,
    "preview": "/*\n * netutils.h - Network utilities\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is par"
  },
  {
    "path": "src/plugin.c",
    "chars": 9548,
    "preview": "/*\n * plugin.c - Manage plugins\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is part of "
  },
  {
    "path": "src/plugin.h",
    "chars": 2557,
    "preview": "/*\n * acl.h - Define the ACL interface\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is p"
  },
  {
    "path": "src/ppbloom.c",
    "chars": 2204,
    "preview": "/*\n * ppbloom.c - Ping-Pong Bloom Filter for nonce reuse detection\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gma"
  },
  {
    "path": "src/ppbloom.h",
    "chars": 1074,
    "preview": "/*\n * ppbloom.h - Define the Ping-Pong Bloom Filter interface\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.co"
  },
  {
    "path": "src/redir.c",
    "chars": 42747,
    "preview": "/*\n * redir.c - Provide a transparent TCP proxy through remote shadowsocks\n *           server\n *\n * Copyright (C) 2013 "
  },
  {
    "path": "src/redir.h",
    "chars": 1936,
    "preview": "/* * redir.h - Define the redirector's buffers and callbacks\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com"
  },
  {
    "path": "src/resolv.c",
    "chars": 13728,
    "preview": "/*\n * Copyright (c) 2014, Dustin Lundquist <dustin@null-ptr.net>\n * All rights reserved.\n *\n * Redistribution and use in"
  },
  {
    "path": "src/resolv.h",
    "chars": 1847,
    "preview": "/*\n * Copyright (c) 2014, Dustin Lundquist <dustin@null-ptr.net>\n * All rights reserved.\n *\n * Redistribution and use in"
  },
  {
    "path": "src/rule.c",
    "chars": 3843,
    "preview": "/*\n * Copyright (c) 2011 and 2012, Dustin Lundquist <dustin@null-ptr.net>\n * Copyright (c) 2011 Manuel Kasper <mk@neon1."
  },
  {
    "path": "src/rule.h",
    "chars": 2037,
    "preview": "/*\n * Copyright (c) 2011 and 2012, Dustin Lundquist <dustin@null-ptr.net>\n * Copyright (c) 2011 Manuel Kasper <mk@neon1."
  },
  {
    "path": "src/server.c",
    "chars": 75268,
    "preview": "/*\n * server.c - Provide shadowsocks service\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This fil"
  },
  {
    "path": "src/server.h",
    "chars": 2593,
    "preview": "/*\n * server.h - Define shadowsocks server's buffers and callbacks\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gma"
  },
  {
    "path": "src/shadowsocks.h",
    "chars": 3214,
    "preview": "/*\n * shadowsocks.h - Header files of library interfaces\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *"
  },
  {
    "path": "src/socks5.h",
    "chars": 2205,
    "preview": "/*\n * socks5.h - Define SOCKS5's header\n *\n * Copyright (C) 2013, clowwindy <clowwindy42@gmail.com>\n *\n * This file is p"
  },
  {
    "path": "src/ss-nat",
    "chars": 6049,
    "preview": "#!/bin/bash\n#\n# Copyright (C) 2015 OpenWrt-dist\n# Copyright (C) 2015 Jian Chang <aa65535@live.com>\n#\n# This is free soft"
  },
  {
    "path": "src/stream.c",
    "chars": 21308,
    "preview": "/*\n * stream.c - Manage stream ciphers\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is p"
  },
  {
    "path": "src/stream.h",
    "chars": 1614,
    "preview": "/*\n * encrypt.h - Define the enryptor's interface\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * Thi"
  },
  {
    "path": "src/tunnel.c",
    "chars": 44025,
    "preview": "/*\n * tunnel.c - Setup a local port forwarding through remote shadowsocks server\n *\n * Copyright (C) 2013 - 2019, Max Lv"
  },
  {
    "path": "src/tunnel.h",
    "chars": 2060,
    "preview": "/*\n * tunnel.h - Define tunnel's buffers and callbacks\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n "
  },
  {
    "path": "src/udprelay.c",
    "chars": 45781,
    "preview": "/*\n * udprelay.c - Setup UDP relay for both client and server\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.co"
  },
  {
    "path": "src/udprelay.h",
    "chars": 2300,
    "preview": "/*\n * udprelay.h - Define UDP relay's buffers and callbacks\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>"
  },
  {
    "path": "src/uthash.h",
    "chars": 69484,
    "preview": "/*\nCopyright (c) 2003-2016, Troy D. Hanson     http://troydhanson.github.com/uthash/\nAll rights reserved.\n\nRedistributio"
  },
  {
    "path": "src/utils.c",
    "chars": 16558,
    "preview": "/*\n * utils.c - Misc utilities\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is part of t"
  },
  {
    "path": "src/utils.h",
    "chars": 10399,
    "preview": "/*\n * utils.h - Misc utilities\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * This file is part of t"
  },
  {
    "path": "src/winsock.c",
    "chars": 5929,
    "preview": "/*\n * winsock.c - Windows socket compatibility layer\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * "
  },
  {
    "path": "src/winsock.h",
    "chars": 2878,
    "preview": "/*\n * winsock.h - Windows socket compatibility layer\n *\n * Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>\n *\n * "
  },
  {
    "path": "tests/CMakeLists.txt",
    "chars": 4333,
    "preview": "# Unit tests using CTest\ninclude_directories(BEFORE ${MBEDTLS_INCLUDE_DIRS})\ninclude_directories(${PROJECT_SOURCE_DIR}/s"
  },
  {
    "path": "tests/aes-ctr.json",
    "chars": 201,
    "preview": "{\n    \"server\":\"127.0.0.1\",\n    \"server_port\":8389,\n    \"local_port\":1081,\n    \"password\":\"aes_password\",\n    \"timeout\":"
  },
  {
    "path": "tests/aes-gcm.json",
    "chars": 201,
    "preview": "{\n    \"server\":\"127.0.0.1\",\n    \"server_port\":8389,\n    \"local_port\":1081,\n    \"password\":\"aes_password\",\n    \"timeout\":"
  },
  {
    "path": "tests/aes.json",
    "chars": 201,
    "preview": "{\n    \"server\":\"127.0.0.1\",\n    \"server_port\":8389,\n    \"local_port\":1081,\n    \"password\":\"aes_password\",\n    \"timeout\":"
  },
  {
    "path": "tests/chacha20-ietf-poly1305.json",
    "chars": 216,
    "preview": "{\n    \"server\":\"127.0.0.1\",\n    \"server_port\":8389,\n    \"local_port\":1081,\n    \"password\":\"salsa20_password\",\n    \"timeo"
  },
  {
    "path": "tests/chacha20-ietf.json",
    "chars": 207,
    "preview": "{\n    \"server\":\"127.0.0.1\",\n    \"server_port\":8389,\n    \"local_port\":1081,\n    \"password\":\"salsa20_password\",\n    \"timeo"
  },
  {
    "path": "tests/chacha20.json",
    "chars": 203,
    "preview": "{\n    \"server\":\"127.0.0.1\",\n    \"server_port\":8389,\n    \"local_port\":1081,\n    \"password\":\"chacha20_password\",\n    \"time"
  },
  {
    "path": "tests/qemu/guest-init.sh",
    "chars": 4543,
    "preview": "#!/bin/bash\n#\n# Guest init script (PID 1) for ss-redir transparent proxy test.\n# Runs inside a QEMU Alpine Linux VM.\n#\n#"
  },
  {
    "path": "tests/rc4-md5.json",
    "chars": 197,
    "preview": "{\n    \"server\":\"127.0.0.1\",\n    \"server_port\":8389,\n    \"local_port\":1081,\n    \"password\":\"aes_password\",\n    \"timeout\":"
  },
  {
    "path": "tests/redir.json",
    "chars": 159,
    "preview": "{\n    \"server\":\"10.0.2.2\",\n    \"server_port\":8389,\n    \"local_port\":1080,\n    \"password\":\"test_redir_password\",\n    \"tim"
  },
  {
    "path": "tests/salsa20.json",
    "chars": 201,
    "preview": "{\n    \"server\":\"127.0.0.1\",\n    \"server_port\":8389,\n    \"local_port\":1081,\n    \"password\":\"salsa20_password\",\n    \"timeo"
  },
  {
    "path": "tests/stress_test.py",
    "chars": 13452,
    "preview": "#!/usr/bin/env python3\n\"\"\"\nStress test for shadowsocks-libev: measures bandwidth on loopback\nwith different ciphers usin"
  },
  {
    "path": "tests/test.py",
    "chars": 4670,
    "preview": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2015 clowwindy\n#\n# Licensed under the Apache License, Version 2."
  },
  {
    "path": "tests/test.sh",
    "chars": 1074,
    "preview": "#!/bin/bash\n\nresult=0\n\nfunction run_test {\n    printf '\\e[0;36m'\n    echo \"running test: $command $@\"\n    printf '\\e[0m'"
  },
  {
    "path": "tests/test_base64.c",
    "chars": 2859,
    "preview": "#include <assert.h>\n#include <string.h>\n#include <stdint.h>\n\n#include \"base64.h\"\n\nstatic void\ntest_encode_decode(void)\n{"
  },
  {
    "path": "tests/test_buffer.c",
    "chars": 1784,
    "preview": "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n\nint verbos"
  },
  {
    "path": "tests/test_cache.c",
    "chars": 2489,
    "preview": "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n#include <e"
  },
  {
    "path": "tests/test_crypto.c",
    "chars": 4341,
    "preview": "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n#include <s"
  },
  {
    "path": "tests/test_deb_build.sh",
    "chars": 5325,
    "preview": "#!/bin/bash\n#\n# Test that Debian packages build, contain expected files, install, and work.\n#\n# Usage: bash tests/test_d"
  },
  {
    "path": "tests/test_jconf.c",
    "chars": 1898,
    "preview": "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n\nint verbos"
  },
  {
    "path": "tests/test_json.c",
    "chars": 3667,
    "preview": "#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n\n#include \"json.h\"\n\nstatic void\ntest_parse_simple_object(voi"
  },
  {
    "path": "tests/test_netutils.c",
    "chars": 3300,
    "preview": "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n#include <s"
  },
  {
    "path": "tests/test_ppbloom.c",
    "chars": 1445,
    "preview": "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include <assert.h>\n#include <stdint.h>\n#include <string.h>\n#include <s"
  },
  {
    "path": "tests/test_redir_qemu.sh",
    "chars": 8374,
    "preview": "#!/bin/bash\n#\n# End-to-end test for ss-redir transparent proxy using QEMU.\n#\n# Architecture:\n#   Host: ss-server listens"
  },
  {
    "path": "tests/test_rule.c",
    "chars": 2720,
    "preview": "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n\nint verbos"
  },
  {
    "path": "tests/test_ss_setup.sh",
    "chars": 27845,
    "preview": "#!/usr/bin/env bash\n###############################################################################\n# test_ss_setup.sh -"
  },
  {
    "path": "tests/test_utils.c",
    "chars": 1297,
    "preview": "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n\nint verbos"
  }
]

About this extraction

This page contains the full source code of the shadowsocks/shadowsocks-libev GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 187 files (1.4 MB), approximately 472.4k tokens, and a symbol index with 553 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!