shadowsocks/shadowsocks-windows
A C# port of shadowsocks
Stale — last commit 1y ago
non-standard license (Other); last commit was 1y ago…
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
last commit was 1y ago; no CI workflows detected
- ⚠Stale — last commit 1y ago
- ⚠Non-standard license (Other) — review terms
- ⚠No CI workflows detected
- ✓11 active contributors
- ✓Distributed ownership (top contributor 44% of recent commits)
- ✓Other licensed
- ✓Tests present
What would improve this?
- →Use as dependency Concerns → Mixed if: clarify license terms
- →Deploy as-is Mixed → Healthy if: 1 commit in the last 180 days
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Forkable" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/shadowsocks/shadowsocks-windows)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card
This card auto-renders when someone shares https://repopilot.app/r/shadowsocks/shadowsocks-windows on X, Slack, or LinkedIn.
Ask AI about shadowsocks/shadowsocks-windows
Grounded in the actual source code. Pick a starter question or write your own.
Onboarding doc
Onboarding: shadowsocks/shadowsocks-windows
Generated by RepoPilot · 2026-06-19 · Source
🎯Verdict
WAIT — Stale — last commit 1y ago
- 11 active contributors
- Distributed ownership (top contributor 44% of recent commits)
- Other licensed
- Tests present
- ⚠ Stale — last commit 1y ago
- ⚠ Non-standard license (Other) — review terms
- ⚠ No CI workflows detected
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
⚡TL;DR
A C# Windows implementation of Shadowsocks that enables encrypted proxy connections with PAC-based routing rules. It proxies traffic via SOCKS5/HTTP to remote servers, supports UDP relay and plugin architecture (SIP003), and uses GeoSite domain lists to intelligently route Chinese and non-Chinese traffic through different channels (direct vs. proxy). Single-project structure under shadowsocks-csharp/ with Controller/ organizing business logic (ShadowsocksController.cs), Service/ handling relay/daemon tasks (TCPRelay, UDPRelay, PACDaemon), Strategy/ implementing load balancing and failover, System/ wrapping Windows APIs (SystemProxy, Hotkeys), and Data/ embedding runtime assets (privoxy, sysproxy, PAC generator). Main entry point CommandLineOption.cs parses CLI args.
👥Who it's for
Windows users in restricted networks seeking censorship circumvention and privacy; developers maintaining or extending the Windows version of Shadowsocks who need to understand C# proxy implementation, system integration (hotkeys, auto-startup), and PAC rule generation.
🌱Maturity & risk
Production-ready but aging: the project is mature with full feature set (auto-switching strategies, system proxy config, plugins), active CI/CD via AppVeyor, but commit frequency and issue triage patterns suggest maintenance mode rather than active development. .NET Framework 4.8 requirement indicates established Windows compatibility focus.
Moderate risk: single-language ecosystem (C# only, no cross-platform) creates platform lock-in; dependency on external GeoSite updates (v2fly/domain-list-community) for PAC rules introduces upstream drift; unclear test coverage across Controller/Service modules; no visible recent commit metadata in provided data limits assessment of security patch velocity.
Active areas of work
Cannot determine from provided data; no recent commit dates, PR list, or issue backlog visible. Presence of appveyor.yml.obsolete and multiple appveyor.yml variants suggests CI/CD migration or cleanup in progress. GeoSite integration (GeositeUpdater.cs) indicates ongoing maintenance of domain-list bindings.
🚀Get running
Clone: git clone https://github.com/shadowsocks/shadowsocks-windows.git && cd shadowsocks-windows. Build: Open shadowsocks-csharp/shadowsocks-csharp.csproj in Visual Studio 2019+ (requires .NET Framework 4.8 SDK). Compile via msbuild shadowsocks-csharp/shadowsocks-csharp.csproj or Visual Studio. Run: Execute resulting .exe from bin/ folder.
Daily commands: No traditional dev server; this is a Windows desktop application. Build in Visual Studio then execute the compiled .exe. For CLI testing use CommandLineOption.cs parser; for service testing instantiate ShadowsocksController.cs and call Start(). Requires Windows system-level proxy permissions for SystemProxy.cs operations.
🗺️Map of the codebase
- shadowsocks-csharp/Controller/ShadowsocksController.cs: Core orchestrator: manages relay services, strategy switching, config hot-reload, and event propagation to UI
- shadowsocks-csharp/Controller/Service/TCPRelay.cs: TCP proxy implementation: handles client-to-remote encryption/decryption, buffer management, and connection lifecycle
- shadowsocks-csharp/Controller/Service/PACDaemon.cs: PAC rule engine: generates dynamic routing rules from GeoSite database, switches between whitelist/blacklist modes based on geositePreferDirect flag
- shadowsocks-csharp/Controller/System/SystemProxy.cs: Windows system integration: configures global proxy settings via registry/WinHTTP, enables tray app to become system default proxy
- shadowsocks-csharp/Controller/Service/Sip003Plugin.cs: Plugin architecture: spawns and manages external SIP003-compliant transport plugins for obfuscation/tunneling
- shadowsocks-csharp/Controller/Strategy/StrategyManager.cs: Server selection: routes traffic via BalancingStrategy (random) or HighAvailabilityStrategy (latency-based failover)
- shadowsocks-csharp/Data/abp.js: PAC JavaScript library: parses geosite rules and domain patterns, evaluates proxy bypass conditions in browser AutoConfig
🛠️How to make changes
Protocol/relay changes: edit Controller/Service/TCPRelay.cs and UDPRelay.cs. Proxy rules: modify Controller/Service/PACDaemon.cs and PACServer.cs, update Data/abp.js. Strategy logic: extend Controller/Strategy/IStrategy.cs and StrategyManager.cs. System integration: patch Controller/System/SystemProxy.cs (Windows proxy config), Hotkeys.cs (keyboard hooks). UI/config: CommandLineOption.cs parses args; check ShadowsocksController.cs for config flow.
🪤Traps & gotchas
Windows-only: no Linux/macOS builds; relies on sysproxy.exe and privoxy.exe binaries in Data/. GeoSite updates require dlc.dat format parsing (undocumented in repo; see GeositeUpdater.cs for clues). System proxy changes require admin privileges and WMI/registry access. Hotkey registration (Hotkeys.cs) is global OS-level, conflicts possible with other apps. .NET Framework 4.8 is end-of-life; future compatibility risk. PAC generation in whitelist vs. blacklist mode is non-obvious; controlled by geositePreferDirect in gui-config.json (not visible in provided file list).
💡Concepts to learn
- SOCKS5 proxy relay — TCPRelay.cs and UDPRelay.cs implement SOCKS5 handshake and data forwarding; essential to understand connection lifecycle and buffer management
- PAC (Proxy Auto-Config) generation and whitelist/blacklist modes — PACDaemon.cs and abp.js dynamically generate routing rules from GeoSite; the geositePreferDirect toggle inverts rule logic—non-obvious behavior impacting user traffic
- SIP003 pluggable transport protocol — Sip003Plugin.cs spawns external binaries to obfuscate or tunnel traffic; understanding subprocess lifecycle and env var passing is critical for plugin compatibility
- Windows system proxy configuration via WinHTTP/registry — SystemProxy.cs directly manipulates OS proxy settings; requires admin privileges and understanding of HKEY_CURRENT_USER registry hives and netsh commands
- Global hotkey registration (OS-level) — Hotkeys.cs registers keyboard shortcuts at OS level using WinAPI; conflicts with other apps and escape on logout require careful lifecycle management
- Server failover and load balancing strategies — HighAvailabilityStrategy.cs vs. BalancingStrategy.cs implement competing server selection; HA uses latency probes, LB uses random—critical for multi-server reliability
- StreamCipher encryption modes (AES, ChaCha20, etc.) — libsscrypto.dll.gz (embedded OpenSSL binding) provides encryption; Controller/Service code uses these ciphers; understanding cipher selection and IV handling prevents security bugs
🔗Related repos
shadowsocks/shadowsocks— Original Python reference implementation; defines core protocol, encryption ciphers, and architectural patterns this C# port adaptsv2fly/domain-list-community— External GeoSite database upstream: shadowsocks-windows fetches dlc.dat from here via GeositeUpdater.cs to populate PAC rulesshadowsocks/shadowsocks-libev— C library implementation; defines SIP003 plugin protocol and UDP relay semantics adopted by this Windows versionclowwindy/OpenWrt-Shadowsocks— Router-based deployment reference; demonstrates multi-client relay patterns and strategy concepts reused in StrategyManager.csshadowsocks/shadowsocks-rust— Modern Rust rewrite of core protocols; serves as performance/async baseline for future architecture discussions on this C# port
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add unit tests for Encryption module (AEAD, Stream ciphers, and EncryptorFactory)
The Encryption folder contains critical cryptographic implementations (AEAD/*.cs, EncryptorFactory.cs, various encryptor backends) but there's no visible test project in the file structure. This is a security-sensitive area where unit tests are essential to prevent regressions in cipher implementations, key derivation, and encryptor instantiation logic.
- [ ] Create a new test project (e.g., shadowsocks-csharp.Tests or similar)
- [ ] Add tests for EncryptorFactory.cs covering all cipher type instantiations
- [ ] Add tests for AEAD/AEADEncryptor.cs verifying encryption/decryption round-trips
- [ ] Add tests for different backend implementations (AEADOpenSSLEncryptor.cs, AEADSodiumEncryptor.cs, AEADMbedTLSEncryptor.cs)
- [ ] Add tests for CircularBuffer/ByteCircularBuffer.cs with edge cases
- [ ] Reference these tests in CI configuration (appveyor.yml)
Add integration tests for Controller/Service components (TCPRelay, UDPRelay, PACDaemon)
The Service folder contains core relay logic (TCPRelay.cs, UDPRelay.cs) and daemon services (PACDaemon.cs, PACServer.cs) but lacks visible integration tests. These components handle network traffic, proxy protocol parsing, and service lifecycle—critical areas needing test coverage to ensure reliability across proxy modes.
- [ ] Create integration test suite in test project targeting Controller/Service
- [ ] Add tests for TCPRelay.cs covering SOCKS5 handshake, data relay, and error handling
- [ ] Add tests for UDPRelay.cs covering UDP packet forwarding and timeout behavior
- [ ] Add tests for PACDaemon.cs and PACServer.cs verifying PAC file generation and serving
- [ ] Add tests for StrategyManager.cs and strategy implementations (HighAvailabilityStrategy.cs, BalancingStrategy.cs)
- [ ] Document test setup requirements in CONTRIBUTING.md
Replace deprecated appveyor.yml configs and consolidate CI to GitHub Actions workflow
The repo has three appveyor.yml files (appveyor.yml, appveyor.yml.obsolete, appveyor.yml.sample) indicating legacy CI setup. GitHub Actions is now standard for GitHub repos and would provide better integration, visibility, and reduce AppVeyor maintenance burden. This improves contributor experience and build transparency.
- [ ] Create .github/workflows/build.yml with .NET Framework 4.8 build for Windows runners
- [ ] Add workflow steps to build, run unit tests, and run integration tests
- [ ] Add workflow step to verify code style/linting if tools exist
- [ ] Document the new CI setup in CONTRIBUTING.md with link to Actions page
- [ ] Remove or archive appveyor.yml obsolete files after validating feature parity
- [ ] Update README.md build badge to reference GitHub Actions instead of AppVeyor
🌿Good first issues
- Add unit tests for Controller/Strategy/BalancingStrategy.cs and HighAvailabilityStrategy.cs: currently no test files visible; implement xUnit or NUnit test suite covering server selection logic and failover triggers.
- Document Sip003Plugin.cs subprocess environment and protocol: create CONTRIBUTING.md section explaining how to write/test plugins, list required env vars (SS_PLUGIN_OPTIONS, SS_REMOTE_HOST, etc.) inferred from code.
- Add logging instrumentation to Controller/Service/UDPRelay.cs: file has no visible NLog calls; add debug/info events for packet routes, timeouts, and error conditions to aid troubleshooting.
⭐Top contributors
Click to expand
Top contributors
- @database64128 — 44 commits
- @studentmain — 32 commits
- @celeron533 — 9 commits
- @ahmadalli — 5 commits
- @Lomik_XP — 3 commits
📝Recent commits
Click to expand
Recent commits
891d971— Forget about current chose server in menu item (Lomik_XP)6b0cbab— Up Google.Protobuf, Newtonsoft.Json for security fix (Lomik_XP)c44f4ab— Fix freezes than to much servers thought Online config was added (fix on 20 servers in menu item) (Lomik_XP)9987188— Merge pull request #3281 from shadowsocks/feature/plain-cipher (Max Lv)3f6baa4— cipher: add plain/none ciphers (Max Lv)1155ac5— Update privoxy to 3.0.31 (HMBSbige)dd6edbc— 💭 PAC: display message when geosite already latest (database64128)ac0fcdf— ⚠ Warn when importing from legacy ss:// links (database64128)a28efee— 🆙 Update docs and bump version to 4.4.0.0 (database64128)70a88b5— 🚱 Remove infrastructure of stream ciphers (database64128)
🔒Security observations
- High · Unvalidated Online Configuration Resolution —
shadowsocks-csharp/Controller/Service/OnlineConfigResolver.cs. The OnlineConfigResolver.cs service appears to fetch and process configuration from external sources. Without explicit evidence of HTTPS enforcement, certificate pinning, or signature validation, this could enable Man-in-the-Middle (MITM) attacks or injection of malicious configurations. Fix: Enforce HTTPS with certificate pinning, implement cryptographic signature verification for fetched configurations, and validate all remote data against a whitelist schema before processing. - High · Potential XSS via PAC File Generation —
shadowsocks-csharp/Controller/Service/PACDaemon.cs, shadowsocks-csharp/Controller/Service/PACServer.cs. PACDaemon.cs and PACServer.cs handle PAC (Proxy Auto-Config) file generation and serving. If user rules or geosite data are not properly sanitized before injection into JavaScript PAC files, attackers could inject malicious JavaScript code. Fix: Implement strict output encoding for all data injected into PAC files. Use a templating engine with automatic escaping or manually escape special JavaScript characters. Validate rule formats before processing. - High · Insecure Plugin Execution (Sip003) —
shadowsocks-csharp/Controller/Service/Sip003Plugin.cs. Sip003Plugin.cs executes external plugins with minimal validation. Plugin executables could be tampered with or replaced by an attacker if the plugin directory has weak permissions, leading to arbitrary code execution. Fix: Implement executable signature verification using Windows code signing certificates. Set strict file permissions on plugin directories (read-only for non-admin users). Validate plugin manifests and implement a whitelist of approved plugins. - High · Potential Command Injection in PrivoxyRunner —
shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs. PrivoxyRunner.cs spawns external processes. If command-line arguments are constructed from user input without proper escaping, attackers could inject arbitrary commands. Fix: Use ProcessStartInfo with Arguments property separately from FileName. Never concatenate user input into command strings. Use a safe argument builder or parameterized approach. - Medium · Unencrypted Configuration File Storage —
shadowsocks-csharp/Model/Configuration.cs. Configuration.cs handles configuration persistence. If server credentials and settings are stored unencrypted in config files, attackers with local file access can extract shadowsocks server addresses and authentication details. Fix: Encrypt sensitive configuration fields (server addresses, passwords, ports) using DPAPI (Windows Data Protection API). Store non-sensitive settings separately from credentials. - Medium · Hardcoded or Embedded Credentials Risk —
shadowsocks-csharp/Data/. Multiple embedded binary files (libsscrypto.dll.gz, privoxy.exe.gz, sysproxy.exe.gz) are stored in the data directory. If these contain embedded credentials or are used without integrity verification, they could be tampered with. Fix: Verify integrity of all embedded binaries using cryptographic hashes (SHA-256) at runtime. Implement signature verification for executable files. Document the source and build process for all embedded binaries. - Medium · Weak Hotkey Registration Security —
shadowsocks-csharp/Controller/HotkeyReg.cs. HotkeyReg.cs registers global hotkeys. If proper security checks are not performed, malicious applications could potentially intercept or spoof hotkey events. Fix: Validate that hotkey callbacks come from the application's own window. Implement integrity checks for hotkey handlers and consider using higher-level Windows APIs with built-in security. - Medium · Potential DNS Rebinding via PAC —
shadowsocks-csharp/Data/abp.js, shadowsocks-csharp/Controller/Service/PACServer.cs. PAC files served by PACServer.cs could be vulnerable to DNS rebinding attacks if proxy resolution logic doesn't validate domain ownership or implement protections against DNS rebinding. Fix: Implement DNS rebinding protection by validating Host headers, implementing DNS pinning, and using strict domain
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/shadowsocks/shadowsocks-windows shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live shadowsocks/shadowsocks-windows
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/shadowsocks/shadowsocks-windows.
What it runs against: a local clone of shadowsocks/shadowsocks-windows — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in shadowsocks/shadowsocks-windows | Confirms the artifact applies here, not a fork |
| 2 | License is still Other | Catches relicense before you depend on it |
| 3 | Default branch v4 exists | Catches branch renames |
| 4 | Last commit ≤ 523 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of shadowsocks/shadowsocks-windows. If you don't
# have one yet, run these first:
#
# git clone https://github.com/shadowsocks/shadowsocks-windows.git
# cd shadowsocks-windows
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of shadowsocks/shadowsocks-windows and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "shadowsocks/shadowsocks-windows(\\.git)?\\b" \\
&& ok "origin remote is shadowsocks/shadowsocks-windows" \\
|| miss "origin remote is not shadowsocks/shadowsocks-windows (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(Other)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"Other\"" package.json 2>/dev/null) \\
&& ok "license is Other" \\
|| miss "license drift — was Other at generation time"
# 3. Default branch
git rev-parse --verify v4 >/dev/null 2>&1 \\
&& ok "default branch v4 exists" \\
|| miss "default branch v4 no longer exists"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 523 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~493d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/shadowsocks/shadowsocks-windows"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.
Similar C# repos
Other mixed-signal C# repos by stars.
Embed this chat in your README →
Drop this iframe anywhere — the widget runs against the same live analysis cache as the main app.
<iframe src="https://repopilot.app/embed/shadowsocks/shadowsocks-windows" width="100%" height="500" style="border:1px solid #d0d7de; border-radius:8px;" allow="microphone" loading="lazy" ></iframe>