Commit Graph
310 Commits
Author SHA1 Message Date
Max Lv bdc77408cb Rename to shadowsocks-c with libuv, async DNS and CI lint (#3051)
Rename the project to shadowsocks-c while retaining ss-* commands, the embedding ABI, and legacy library/package lookup compatibility.

Replace libev with bundled libuv for IOCP/kqueue event backends, expand asynchronous runtime DNS coverage, and add actionlint/Ruff with strict clang-tidy failure handling. Validate native platforms, static builds, packaging, interoperability, sanitizers, and canonical/legacy consumers.

All 22 hosted checks pass at reviewed head a8493250eb.
2026-09-11 14:18:37 +08:00
Max Lv 201e70c4bd Modernize C builds with offline dependencies and portable runtime helpers (#3050)
Bundle pinned offline dependencies, remove libcork/libipset and submodule requirements, and add portable runtime helpers with relocatable static/shared library installations.

Add Clang static build validation for Linux/musl, macOS and Windows, real TCP/UDP and SIP003 interoperability coverage, and recorded performance tradeoffs. All 21 hosted checks pass at the reviewed PR head 8d504e6218.
2026-09-11 13:42:11 +08:00
Max Lv 8cc58cea95 Accept an ss:// server URL on the ss-local command line
shadowsocks-rust takes a whole server definition as a URL; libev could
only be given the pieces separately, so importing a server meant taking a
URL apart by hand. ss-local now accepts --server-url and reads the
address, port, cipher, password and SIP003 plugin from it.

Both encodings are handled: the SIP002 form with the userinfo in
base64url, and the older form where the whole body is one base64 blob.
The userinfo is also accepted in the clear, because that is what
shadowsocks-rust's `ssurl` emits for the 2022 ciphers, whose base64
pre-shared keys it percent-encodes instead. IPv6 literals, a trailing
slash, the plugin query and the '#' tag are all covered.

Options given later on the command line still win, since they are applied
as getopt reaches them.

ssurl.c sits with the ss-local sources rather than the shared ones: it
depends on base64.c, which ss-manager does not link.

The tests include URLs copied verbatim from `ssurl --encode` output, so
the parser is pinned against what another implementation really produces
rather than only against my reading of the spec. Verified end to end by
pointing ss-local at a rust-generated URL and proxying through their
ssserver.
2026-08-19 20:15:38 +08:00
Max Lv 46791234c0 Add Shadowsocks 2022 (SIP022) ciphers
shadowsocks-rust has supported the 2022 edition for years while libev was
stuck on the 2017 AEAD construction, the largest functional gap between
the two implementations. This adds the three SIP022 methods:

  2022-blake3-aes-128-gcm
  2022-blake3-aes-256-gcm
  2022-blake3-chacha20-poly1305

TCP uses BLAKE3 derive_key for session subkeys, standalone header chunks
carrying a type byte and timestamp, request padding, and a response header
echoing the request salt. Replay protection uses an exact-match salt pool
with 60s retention rather than the bloom filter, which SIP022 forbids
because false positives are unacceptable there.

UDP is session-based: an AES-ECB separate header for the AES methods and a
merged XChaCha20-Poly1305 construction for ChaCha, with a per-session
sliding window replay filter. Servers must route by client session ID,
which is only known after decryption, so the crypto layer owns the
server-side session table and hands the session back to udprelay for the
reply path.

The 2022 code lives in aead2022.c and aead2022_udp.c so aead.c keeps its
current size, with aead_internal.h carrying what they share. BLAKE3 is
vendored (portable backend only) as its own build target.

Keys are base64 pre-shared keys of exactly the cipher's key size; per
SIP022 a password is never stretched into a key.

Verified interoperable in both directions against shadowsocks-rust 1.24.0
for all three ciphers over TCP and UDP, including an 8MB transfer checked
by digest, plus unit tests for header framing, partial delivery, tamper
detection, and UDP replay rejection.
2026-08-19 18:15:35 +08:00
Max LvandClaude Opus 4.6 5c47b80f4e Update README with CMake build instructions and ss-setup/ss-nat docs
Modernize build instructions to focus on CMake (the sole build system),
remove outdated autotools/backports references, and add documentation
for the ss-setup interactive TUI tool and the ss-nat transparent proxy
helper script with practical usage examples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 08:59:58 +08:00
Max LvandClaude Opus 4.6 c5e8788013 Bump version to 3.3.6
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:15:12 +08:00
Max LvandClaude Opus 4.6 7bb250739e Modernize build: switch to CMake, add unit tests, fix man pages
* Modernize build: switch to CMake, add unit tests, fix man pages

Remove autotools (configure.ac, Makefile.am, m4/, autogen.sh) and make
CMake the sole build system. Enhance CMake with proper Find modules for
MbedTLS, libsodium, PCRE, and c-ares with version/feature detection.
Add support for connmarktos, nftables, stack protector, and MinGW.

Add 10 unit test suites (CTest) covering base64, buffer, cache, crypto,
jconf, json, netutils, ppbloom, rule, and utils modules. Add a Python
stress test measuring bandwidth per cipher with memory leak detection.

Fix man page typos ("Resovle" -> "Resolve"), document missing TCP buffer
options, fix ss-manager duplicate --executable entry, add example section
to ss-tunnel, and document --workdir and --nftables-sets options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Migrate from PCRE to PCRE2

Replace legacy PCRE (libpcre3) with PCRE2 (libpcre2-8). PCRE1 has been
end-of-life since 2021.

- src/rule.h: use pcre2_code and pcre2_match_data types
- src/rule.c: pcre_compile -> pcre2_compile, pcre_exec -> pcre2_match,
  pcre_free -> pcre2_code_free, with proper error message retrieval
- cmake/FindPCRE.cmake -> cmake/FindPCRE2.cmake: find libpcre2-8 via
  pkg-config, pcre2-config, or manual search
- Update all CMakeLists.txt, config.h.cmake, configure.cmake, README.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update Dockerfiles: use CMake build and pcre2-dev

The alpine Dockerfile still used autotools (autogen.sh/configure) which
were removed. Switch to cmake build and replace pcre-dev with pcre2-dev.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix Docker build: disable tests and remove git dep

The tests/ directory is excluded by .dockerignore, so pass
-DBUILD_TESTING=OFF to cmake. Submodules are already checked out
by actions/checkout, no need for git inside the container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix Docker build: disable static libs (not available in alpine)

Alpine's mbedtls-dev only provides shared libraries. Disable static
build since Docker only needs shared binaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Rewrite GitHub Actions: build and test directly on runner

Replace Docker-based CI with direct cmake build on ubuntu-latest and
macos-latest. Install dependencies via apt/brew, build with cmake,
run unit tests with ctest.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix CI: use mbedtls@3 on macOS, disable static build

- macOS: brew's mbedtls is now v4 (incompatible), use mbedtls@3
- Disable static build since CI runners lack static lib packages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix test build on Linux: add stdint.h and link libm

- test_ppbloom.c: add missing #include <stdint.h> for uint8_t
- test_json: link against libm for pow() used in json.c

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix test_ppbloom link: add libm for bloom's log()

On Linux, libbloom uses log() which requires explicit -lm linkage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix Linux build: link libm for test_buffer and test_crypto, fix warnings

Both test_buffer and test_crypto link libbloom.so which uses log() from
libm. Also fix unused variable warnings in test_json.c that would fail
with -Werror.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix Linux build: link libm for test_jconf (json.c uses pow)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CI: add unit test and stress test steps to GitHub Actions

Split the Test step into separate "Unit tests" (ctest) and "Stress test"
(stress_test.py with 10MB transfer across all AEAD ciphers) steps for
better visibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 17:06:47 +08:00
Bill Zhong 288cba784e fix snap link and badge 2022-11-30 11:06:54 +08:00
rickyrick2002 7f7f68afe4 replace fixed mbedtls version with variable $MBEDTLS_VER 2022-10-25 11:59:31 +08:00
rickyrick2002 a3b1dc7f37 update MbedTLS dependency link and add Debian / Ubuntu apt pkg-config 2022-10-25 11:59:31 +08:00
nishans08 d3e73c6ce6 fixes grammatical errors in README.md
221: You should jump this section and install them from distribution repository instead. -> You should jump to this section and install them from the distribution repository instead.

FIX #7
2022-07-28 10:24:48 +08:00
Chen Shaoju 90f21abc2d Update README.md
Update the PKGBUILD url.
2022-05-29 08:50:41 +08:00
Paul "Joey" Clark 3654658111 Add git submodule to the build docs
This confused me, and looking at the issues, it has confused other people as well. [1](https://github.com/shadowsocks/shadowsocks-libev/issues/2758)

I'm not sure if we can automate it though, e.g. in `autogen.sh`. Because some people might want to build with a modified version of the libraries.

Perhaps we could automatically fetch the submodules IF we see they are empty...

Anyway, for now, we can at least document this step.
2021-08-27 08:11:33 +08:00
t0nyt4ng 8e0fe4e6a2 update libsodium url
libsodium 1.0.16 has been removed to the old release
2021-03-11 12:19:50 +08:00
Max Lv 8285e5a7de Bump version 2020-09-15 10:30:48 +08:00
zfl9 03df264fcd add tcp_tproxy option, add a sample script in readme.md 2020-07-18 21:09:08 +08:00
zfl9 cde88d4074 add tcp_tproxy option, README.md update 2020-07-18 17:10:37 +08:00
Bill Zhong 982f1e1d1e fix broken anchor 2020-07-04 00:47:51 -02:30
Symeon Huang 4baff35e25 Remove the unmaintained Fedora COPR section
I'm no longer maintaining the packages for Fedora and RHEL. This PR seeks to remove this section to avoid confusions.
2020-04-14 12:43:38 +01:00
Max Lv cafdd77b3d Update README.md 2020-03-01 17:13:58 +08:00
Max Lv 33976557d6 Revert "Use classic mode to install shadowsocks-libev" 2020-02-14 09:02:00 +08:00
Mygod 5c16299c1a Use classic mode to install shadowsocks-libev
This can prevent `Too many open files` error from happening due to sandboxing.
2020-02-11 18:34:57 -05:00
Max Lv 6b85c980ee Fix #2595 2020-01-18 08:44:26 +08:00
Max Lv 72d7d9217c Bump version 2020-01-10 09:48:42 +08:00
Max Lv 7763b961c5 Merge pull request #2531 from jessie-backports/patch-1
Update README.md
2019-11-06 12:41:00 +08:00
Max Lv f7a0822e3e Fix #2532 2019-11-06 12:23:44 +08:00
jessie-backports f60057d69f Update README.md
update debian distribution
2019-11-06 10:24:36 +08:00
Max Lv e2765847cc Bump version 2019-10-31 15:16:05 +08:00
Xiaoding Liu 488987927d Update FreeBSD section
Update FreeBSD section, including install / configuration / run / run as client.
2019-10-25 13:28:31 +08:00
Max Lv 346ab1be47 Bump version 2019-10-12 15:20:52 +08:00
Alonzo Liu 964f145a60 readme: add manjaro 2019-10-05 15:15:17 +08:00
Max Lv 03fb8c9f74 Revert "Add option '--long-idle' for server"
This reverts commit b4cda9dd42.
2019-09-02 09:25:30 +08:00
lixingcong b4cda9dd42 Add option '--long-idle' for server
Restore the default behavior handling timeout, make an option to enable
long idle connections.

Previously discussion:

https://github.com/shadowsocks/shadowsocks-libev/pull/2421

https://github.com/shadowsocks/shadowsocks-libev/issues/2427
2019-08-31 10:45:52 +08:00
Max Lv 3e8a57752a Update README.md
FIx #2456
2019-08-19 09:58:34 +08:00
Max Lv 3a4690727c Update README.md 2019-08-09 15:35:53 +08:00
Max Lv a1b691c784 Update README.md 2019-08-09 15:34:40 +08:00
Max Lv 21fc899150 Remove PPA and recommend installing from snap 2019-08-09 15:29:02 +08:00
Max Lv 615588bd39 Bump version 2019-08-09 15:17:53 +08:00
Max Lv 70d8951c23 Update build badge 2019-07-16 19:36:43 +08:00
Max Lv ffad914ddd Bump version 2019-06-08 08:01:47 +08:00
Max Lv c2337fed3f Update README.md 2019-05-08 09:42:38 +08:00
amphineko e509a19698 doc: refine document for argument -b, fix #2353 2019-04-22 05:51:39 +08:00
Max Lv b0c6ba4945 Bump version 2019-03-09 19:07:22 +08:00
Punk 0401d0efdb dont overrides mbedtls's CFLAGS
From mbedtls README.md, "Please note that setting CFLAGS overrides its default value of -O2 and...".
Restore the -O2 will save ~100k for any of mbedtls's lib files.
2019-03-08 00:32:33 +08:00
Donghyeok Tak 3c1f68c91b Update README.md
Fix typo
2019-03-03 10:27:15 +09:00
Max Lv c9159fc927 Bump version 2019-02-26 12:33:30 +08:00
Max Lv ed67a1abcb Update README.md 2019-02-13 12:41:08 +08:00
Max Lv 6a2f970817 Update README.md 2019-02-13 12:39:40 +08:00
Simon Shi e5d8476afe Update docs 2019-01-04 23:28:52 +08:00
Max Lv 545c04182f Bump version 2018-11-28 00:48:15 -08:00