v4 891d971682ee cached
138 files
933.1 KB
209.3k tokens
986 symbols
1 requests
Download .txt
Showing preview only (981K chars total). Download the full file or copy to clipboard to get everything.
Repository: shadowsocks/shadowsocks-windows
Branch: v4
Commit: 891d971682ee
Files: 138
Total size: 933.1 KB

Directory structure:
gitextract_s4mmpmuw/

├── .gitattributes
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report_en.md
│   │   ├── bug_report_zh.md
│   │   └── feature_request.md
│   └── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── CHANGES
├── CONTRIBUTING.md
├── LICENSE.txt
├── OPENSSL-GUIDE
├── README.md
├── appveyor.yml
├── appveyor.yml.obsolete
├── appveyor.yml.sample
├── packaging/
│   └── upload.sh
├── shadowsocks-csharp/
│   ├── CommandLineOption.cs
│   ├── Controller/
│   │   ├── FileManager.cs
│   │   ├── HotkeyReg.cs
│   │   ├── I18N.cs
│   │   ├── LoggerExtension.cs
│   │   ├── Service/
│   │   │   ├── GeositeUpdater.cs
│   │   │   ├── IPCService.cs
│   │   │   ├── Listener.cs
│   │   │   ├── OnlineConfigResolver.cs
│   │   │   ├── PACDaemon.cs
│   │   │   ├── PACServer.cs
│   │   │   ├── PortForwarder.cs
│   │   │   ├── PrivoxyRunner.cs
│   │   │   ├── Sip003Plugin.cs
│   │   │   ├── TCPRelay.cs
│   │   │   ├── UDPRelay.cs
│   │   │   └── UpdateChecker.cs
│   │   ├── ShadowsocksController.cs
│   │   ├── Strategy/
│   │   │   ├── BalancingStrategy.cs
│   │   │   ├── HighAvailabilityStrategy.cs
│   │   │   ├── IStrategy.cs
│   │   │   └── StrategyManager.cs
│   │   └── System/
│   │       ├── AutoStartup.cs
│   │       ├── Hotkeys/
│   │       │   ├── HotkeyCallbacks.cs
│   │       │   └── Hotkeys.cs
│   │       ├── ProtocolHandler.cs
│   │       └── SystemProxy.cs
│   ├── Data/
│   │   ├── NLog.config
│   │   ├── abp.js
│   │   ├── i18n.csv
│   │   ├── privoxy_conf.txt
│   │   └── user-rule.txt
│   ├── Encryption/
│   │   ├── AEAD/
│   │   │   ├── AEADEncryptor.cs
│   │   │   ├── AEADMbedTLSEncryptor.cs
│   │   │   ├── AEADOpenSSLEncryptor.cs
│   │   │   └── AEADSodiumEncryptor.cs
│   │   ├── CircularBuffer/
│   │   │   └── ByteCircularBuffer.cs
│   │   ├── EncryptorBase.cs
│   │   ├── EncryptorFactory.cs
│   │   ├── Exception/
│   │   │   └── CryptoException.cs
│   │   ├── IEncryptor.cs
│   │   ├── MbedTLS.cs
│   │   ├── OpenSSL.cs
│   │   ├── RNG.cs
│   │   ├── Sodium.cs
│   │   └── Stream/
│   │       └── PlainEncryptor.cs
│   ├── FodyWeavers.xml
│   ├── FodyWeavers.xsd
│   ├── Localization/
│   │   ├── LocalizationProvider.cs
│   │   ├── Strings.Designer.cs
│   │   ├── Strings.fr.resx
│   │   ├── Strings.ja.resx
│   │   ├── Strings.ko.resx
│   │   ├── Strings.resx
│   │   ├── Strings.ru.resx
│   │   ├── Strings.zh-Hans.resx
│   │   └── Strings.zh-Hant.resx
│   ├── Model/
│   │   ├── Configuration.cs
│   │   ├── ForwardProxyConfig.cs
│   │   ├── Geosite/
│   │   │   ├── Geosite.cs
│   │   │   └── geosite.proto
│   │   ├── HotKeyConfig.cs
│   │   ├── LogViewerConfig.cs
│   │   ├── NlogConfig.cs
│   │   ├── Server.cs
│   │   └── SysproxyConfig.cs
│   ├── Program.cs
│   ├── Properties/
│   │   ├── AssemblyInfo.cs
│   │   ├── Resources.Designer.cs
│   │   ├── Resources.resx
│   │   ├── Settings.Designer.cs
│   │   └── Settings.settings
│   ├── Proxy/
│   │   ├── DirectConnect.cs
│   │   ├── HttpProxy.cs
│   │   ├── IProxy.cs
│   │   └── Socks5Proxy.cs
│   ├── Resources/
│   │   ├── ss128.pdn
│   │   └── ss32.pdn
│   ├── Settings.cs
│   ├── Util/
│   │   ├── ProcessManagement/
│   │   │   ├── Job.cs
│   │   │   └── ThreadUtil.cs
│   │   ├── Sockets/
│   │   │   ├── LineReader.cs
│   │   │   ├── SocketUtil.cs
│   │   │   └── WrappedSocket.cs
│   │   ├── SystemProxy/
│   │   │   ├── ProxyException.cs
│   │   │   └── Sysproxy.cs
│   │   ├── Util.cs
│   │   └── ViewUtils.cs
│   ├── View/
│   │   ├── ConfigForm.Designer.cs
│   │   ├── ConfigForm.cs
│   │   ├── ConfigForm.resx
│   │   ├── LogForm.Designer.cs
│   │   ├── LogForm.cs
│   │   ├── LogForm.resx
│   │   └── MenuViewController.cs
│   ├── ViewModels/
│   │   ├── ForwardProxyViewModel.cs
│   │   ├── HotkeysViewModel.cs
│   │   ├── OnlineConfigViewModel.cs
│   │   ├── ServerSharingViewModel.cs
│   │   └── VersionUpdatePromptViewModel.cs
│   ├── Views/
│   │   ├── ForwardProxyView.xaml
│   │   ├── ForwardProxyView.xaml.cs
│   │   ├── HotkeysView.xaml
│   │   ├── HotkeysView.xaml.cs
│   │   ├── OnlineConfigView.xaml
│   │   ├── OnlineConfigView.xaml.cs
│   │   ├── ServerSharingView.xaml
│   │   ├── ServerSharingView.xaml.cs
│   │   ├── VersionUpdatePromptView.xaml
│   │   └── VersionUpdatePromptView.xaml.cs
│   ├── app.config
│   ├── app.manifest
│   ├── packages.config
│   └── shadowsocks-csharp.csproj
├── shadowsocks-windows.sln
└── test/
    ├── ProcessEnvironment.cs
    ├── Properties/
    │   └── AssemblyInfo.cs
    ├── ShadowsocksTest.csproj
    ├── Sip003PluginTest.cs
    ├── UnitTest.cs
    ├── UrlTest.cs
    ├── app.config
    └── packages.config

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

================================================
FILE: .gitattributes
================================================
* text=auto

# geosite database
*.dat binary

================================================
FILE: .github/ISSUE_TEMPLATE/bug_report_en.md
================================================
---
name: Bug report (English)
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

<!--
- Shadowsocks is a non-profit open source project. If you bought the service from a provider, please contact them.
- If you have questions rather than Shadowsocks Windows client, please go to https://github.com/shadowsocks
- Please read Wiki carefully, especially https://github.com/shadowsocks/shadowsocks-windows/wiki/Troubleshooting
- And search from Issue Board https://github.com/shadowsocks/shadowsocks-windows/issues?utf8=%E2%9C%93&q=is%3Aissue
- Please include the following information. Questions lacking details will be closed.
-->

### Describe the bug

### Environment

- Shadowsocks client version:
- OS version:
- .NET version:

### Steps you have tried


### What did you expect to see?


### What did you see instead?


### Config and error log in detail (with all sensitive info masked)

```
PASTE LOG HERE
```


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report_zh.md
================================================
---
name: Bug报告 (中文)
about: 反馈Bug
title: ''
labels: bug report
assignees: ''

---

<!--
- 影梭(Shadowsocks)是一个开源非盈利项目,不提供任何托管服务。如果你是从服务提供商购买的服务,请联系他们。
- 如果你有非影梭Windows客户端相关的问题,请去 https://github.com/shadowsocks
- 提问前请先阅读wiki https://github.com/shadowsocks/shadowsocks-windows/wiki/Troubleshooting.
- 并在Issue Board中搜索 https://github.com/shadowsocks/shadowsocks-windows/issues?utf8=%E2%9C%93&q=is%3Aissue
- 请按照以下格式描述你的问题,描述不清的问题将会被关闭。
-->

### 简要描述问题

### 环境

- Shadowsocks客户端版本:
- 操作系统版本:
- .NET版本:

### 操作步骤


### 期望的结果


### 实际结果


### 配置文件和日志文件(请隐去敏感信息)

```
在此粘贴日志
```


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
## Please follow the guide below

- You will be asked some questions, please read them **carefully** and answer honestly
- Put an `x` into all the boxes [ ] relevant to your *pull request* (like that [x])
- Use *Preview* tab to see how your *pull request* will actually look like

- [ ] [Searched](https://github.com/shadowsocks/shadowsocks-windows/search?q=is%3Apr&type=Issues) for similar pull requests
- [ ] Compiled the code with Visual Studio
- [ ] Require translation update
- [ ] Require document update (readme.md, wikipage, etc)

### What is the purpose of your *pull request*?
- [ ] Bug fix
- [ ] Improvement
- [ ] New feature

---

### Description of your *pull request* and other information

Explanation of your *pull request* in arbitrary form goes here. Please make sure the description explains the purpose and effect of your *pull request* and is worded well enough to be understood. Provide as much context and examples as possible.

================================================
FILE: .gitignore
================================================
## Ignore Visual Studio and VSCode temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## and https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Mono auto generated files
mono_crash.*

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/

# ASP.NET Scaffolding
ScaffoldingReadMe.txt

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# Visual Studio Trace Files
*.e2e

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
# *.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak

# SQL Server files
*.mdf
*.ldf
*.ndf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# CodeRush personal settings
.cr/personal

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Local History for Visual Studio
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace


================================================
FILE: CHANGES
================================================
4.4.1.0 2022-02-08
- Add plain/none ciphers

4.4.0.0 2021-01-01
- Security: remove infrastructure of stream ciphers (#3048)
- Show warning message when importing from deprecated legacy ss:// links.
- Other minor bug fixes and improvements

4.3.3.0 2020-12-07
- PAC: Add option for custom sha256sum URL of custom geosite source (#3026)
- Update to .NET Framework 4.8
- Other minor bug fixes and improvements

4.3.2.0 2020-11-05
- PAC: direct connection for private IP ranges by @studentmain (#3008)
- Remove duplicate startup entries (#3012)
- Other minor bug fixes and improvements

4.3.1.0 2020-10-25
- Update abp.js (#2999)
- Separate QR code scanning from MenuViewController (#2995)
- Remove statistics strategy (#2994)
- Other minor bug fixes and improvements

4.3.0.0 2020-10-19
- Cleanup and update dependencies (#2983)
- Geosite group validation + PAC regeneration on version update (#2988)
- PAC: add options for direct and proxied groups (#2990)
- Transition to WPF: ForwardProxyView + HotkeysView + OnlineConfigView + VersionUpdatePromptView (#2991)

4.2.1.0 2020-10-12
- SIP008 support (#2942)
- Exclude @cn from PAC proxied list (#2982)
- Transition to WPF: ReactiveUI and ServerSharingView (#2959)
- User-Agent for OnlineConfigResolver and GeositeUpdater (#2978)

4.2.0.1 2020-09-26
- Fix domain rule handling in PAC script (#2956)

4.2.0.0 2020-09-10
- Update TCPHandler.lastActivity (#2858)
- Add Franch translation (#2861)
- New option for ss:// URL association (#2855)
- Updated Korean Language (#2871)
- Decouple statistic and TCPRelay (#2872)
- Fix nLogConfig NullReferenceExceltion (#2887)
- Use v2ray GeoSsite to replace GFWList (#2875)
- Optimize the updater and downloader (#2910)
- Update SIP002 (#2904)
- Update Japanese translations
- Fix improperly parsed remark section (#2935)
- Other minor bug fixes and improvements

4.1.10.0 2020-04-11
- Fix NLog config file issue (#2841, #2846)
- Tweak log level

4.1.9.3 2020-03-31
- Set default method to chacha20-ietf-poly1305
- Using hash in PAC URL (#2759)
- Rename and translate title of statistics form (#2768)
- Russian translation (#2767)
- Refine Updated Notification logic
- Using NLog (#2783)
- Bug fix: wrong server in tray menu (#2782)
- Deprecate unsafe encryption method (#2757, #2801)
- Bug fix: server config is overwritten by others when moving up/down (#2830)
- Other minor bug fixes and improvements

4.1.9.2 2019-12-25
- Fix i18n issues (#2740, #2741)

4.1.9.1 2019-12-22
- Fix #2739: PAC does not work
- Translate Show Plugin Option

4.1.9.0 2019-12-21
- Refine merge PAC+abp script logic (#2598)
- Format the proxy hostname in GfwListUpdater (#2616)
- Fix the trayIcon display issue under Win10 dark theme (#2658)
- Set default encryption method as chacha20-ietf-poly1305 (#2699)
- Translate statistics config form (#2698)
- Update .Net Framework download link (#2731)
- Use MD5 hash instead of timestamp for PAC URL parameter (#2705)
- Add option "Show Plugin Output" (#2722)
- Support custom GFWListUrl defined in config file (#2728)
- Implement new I18N csv structure (#2712)
- Refine message when plugin program file does not exist (#2730)
- Other minor bug fixes and improvements

4.1.8 2019-10-31
- Update the nuget configurations and packages
- Fix some crash about thread-safe in statistics (#2591)
- Fix server list index invalidation (#2543, #2542)
- Refine PAC server (#2539)
- Update the GFWList via IPv6Loopback when available
- Modify PAC request behavior (#2526)
- Fix .NET 4.7.2 on Win7 TLS compatibility (#2473)
- Other minor bug fixes and improvements

4.1.7.1 2019-07-14
- Fix unexpected server delete behavior (#2459)
- Reduce info log when checking Windows 10 Light Theme

4.1.7 2019-07-10
- Fix UDP relay (#2387)
- Support Windows 10 1903 Light Theme (#2379)
- Listening on local IPv6 interface (#2419) (Experimental)
- Turn off per-monitor DPI awareness as it is not supported (#2427)
- Fix a defect when parsing ss:// URL (#2364)
- Upgrade the development environment to VS2017 with .NET Framework 4.7.2
- Refactoring config form (#2410)
- Refactoring tray icon
- Other minor bug fixes and improvements

4.1.6 2019-04-17
- Add http proxy "basic access authentication"
- Add check box to toggle plugin argument input
- Add apply button for server configuration form
- Update UI of switching proxy mode
- Update exception handler for port assignment

4.1.5 2019-03-08
- Update nuget packages
- Update the PAC javascript to support user rules in a better way
- Other minor bug fixes and improvements

4.1.4 2019-02-04
- Update Privoxy to 3.0.28
- Enlarge Privoxy max client connections
- Update the system proxy when user-rule.txt is changed
- Register restart after system reboot

4.1.3.1 2018-12-09
- Fix error when usersettings bypasslist is null

4.1.3 2018-12-08
- Refine sysproxy exception handling
- Keep user bypass setting when use global proxy mode
- Update .Net download link
- Minor improvements

4.1.2 2018-09-13
- Fix plugin CLI argument environment variable issue (#1969 #1818)
- Other minor bug fixes and improvements (#1978 #1968 #1993)

4.1.1 2018-08-18
- Fix auto hotkey reg issue when OS wakeup
- Other minor bug fixes and improvements

4.1.0 2018-08-05
- Support portable mode Temp folder
- Register hotkeys on startup
- Fix sysproxy hanging issue
- Minor improvements

4.0.10 2018-05-10
- Add square bracket for SIP002 IPv6 (RFC3986)
- Add plugin CLI arguments support
- Bug fix: Server address should not be encoded (#1758)
- Bug fix: Wrong splash on multi display (#1729)
- Fix PerPixelAlphaForm's issue in designer
- Other minor bug fixes and improvements

4.0.9 2018-03-14
- Fix port occupied issue
- Add xchacha20-ietf-poly1305
- Update cryptographic libraries
- Bug fixes and improvements

4.0.8 2018-02-16
- Add OpenSSL 1.1.0g support #1671
- Update nuget packages
- Bug fixes and improvements

4.0.7 2017-12-09
- Fix QR code and ss:// protocol import issue
- Add an option to show password
- User rules have higher priority in PAC file
- Bug fixes and improvements

4.0.6 2017-09-09
- SIP002 support
- SIP003 support

4.0.5 2017-08-09
- Fix crash when user-wininet.json fail to parse. (#1178)
- Bug fixes and improvements.

4.0.4 2017-06-01
- Save user wininet settings as user-wininet.json
- Improve performance of aes-256-gcm

4.0.2 2017-05-19
- Fix legacy key derivation
- Bug fixes and improvements

4.0.1 2017-04-08
- Fix UDP relay
- Allow to add multiple servers via Shadowsocks URL
- Bug fixes and improvements

4.0 2017-04-04
- Add AEAD ciphers support, removed OTA
- I18N: add Japanese support, update Traditional Chinese strings
- sysproxy: restore user settings when system proxy is turned off
- Bug fixes and improvements

3.4.3 2017-1-11
- Make the previous portable mode as default
- Refine networking by Noisyfox
- Bug fixes and improvements

3.4.2.1 2016-12-30
- Refine Traditional Chinese translation by LNDDYL
- sysproxy: reduce false positives on virus detection
- sysproxy: set LAN proxy settings even if RAS query fails
- privoxy: drop obsolete tray area refreshing code
- Fix auto startup
- Bug fixes and improvements

3.4.2 2016-12-16
- Fix null ref in TCPRelay. (#940)
- Bring Privoxy back. (#948)
- Bug fixes and improvements.

3.4.1 (pre-release) 2016-12-13
- Fix crash if user input an invaild server address. (#933)
- Fix ERR_TOO_MANY_REDIRECTS with http proxy. (#937)
- Show SS URL in QRCode form.
- Add import URL from clipboard.
- Bug fixes and improvements.

3.4.0 (pre-release) 2016-12-9
- Replace Privoxy with built-in http proxy.
- Try fix system proxy settings on windows 10 insider preview.
- Secure local pac.
- Update bypass list.
- Bug fixes and improvements.

3.3.6 2016-12-6
- Refine system proxy mode switching logic,
  merge 'Switch to PAC' and 'Switch to Global' into
  'Switch system proxy mode'.
- Don't store LogViewer window size in config file,
  now you can sync config between devices with different
  resolutions.
- Add tag support for SS url
- Add pre-release channel in update checker
- Bug fixes and improvements

3.3.5 2016-11-7
- Improve system power mode handling
- Update mbed TLS to 2.4.0
- Check .NET Framework version on startup

3.3.4 2016-10-21
- Fix IE dial-up and VPN connection proxy settings
  not changed since release 3.3.3.
- Fix a UI bug

3.3.3 2016-10-10
- Add timeout support for server and forward proxy,
  only integer is allowed
- Use wininet API to setup system proxy
- Upgrade to .NET Framework 4.6.2

3.3.2 2016-10-03
- Add HTTP forward proxy support
- Bug fixes and improvements

3.3.1 2016-09-20
- Add global hotkey support
- Bug fixes and improvements

3.3 2016-09-09
- Update Privoxy to 3.0.26
- Change minimum system version explicitly to Windows Vista
  since we are using dual-mode socket
- Support running multiple instances of Privoxy for system proxy
- Improve networking
- New traffic chart and icon style
- I18N: Traditional Chinese support
- Bug fixes and improvements

3.2 2016-08-13
- Add AES-CTR, blowfish and camellia ciphers support,
  including aes-256-ctr, aes-192-ctr, aes-128-ctr,
  bf-cfb, camellia-128-cfb, camellia-192-cfb
  and camellia-256-cfb.
- Support one-time authentication in ss urls for sharing
- Support traffic chart and traffic icon
- Add proxy support
- Add verbose logging
- Improve LogForm
- Delete log file when clicking "Clean Logs" in the LogForm
- Bug fixes and improvements

3.1 2016-05-01
- Disable StatisticsStrategy by default

3.0 2016-03-02
- Update Privoxy to 3.0.24
- Replace Choose by Total Packet Loss with Choose by Statistics
- Support chacha20-ietf
- Support Onetime Authentication
- Optional checking updates
- Download updates automatically
- Improve log viewer
- Minor fixes
- Other improvements

2.5.8 2015-09-20
- Update GFWList url

2.5.7 2015-09-19
- Fix repeated IV

2.5.6 2015-08-19
- Add portable mode. Create shadowsocks_portable_mode.txt to use it
- Support server reorder

2.5.5 2015-08-17
- Fix crash when enabling Availability Statistics and some servers can not be resolved
- Allow multiple instances
- Other fixes

2.5.4 2015-08-16
- Hide Privoxy icon

2.5.3 2015-08-16
- Replace Polipo with Privoxy
- Add Choose by Total Packet Loss

2.5.2 2015-08-04
- Add log viewer

2.5.1 2015-07-26
- Prevent HA from switching servers too frequently
- Fix server settings can not be updated when using HA
- Fix server port can't be 8123
- Other minor fixes

2.5 2015-07-25
- Support load balance
- Support high availability

2.4 2015-07-11
- Support UDP relay
- Support online PAC
- Migrate update checker to GitHub releases
- Other fixes

2.3.1 2015-03-06
- Support user rule

2.3 2015-01-25
- Use the same port for every profile
- Use the same port for HTTP/Socks5/PAC
- Fix GFWList PAC compatibility issue with IE11
- Encourage users to report to GFWList when no update found
- Minor UI improvements

2.2.1 2015-01-18
- Fix QR Code compatibility

2.2 2015-01-14
- Support updating PAC from GFWList
- Support adding server by scanning QR Code
- Output timestamp in logs
- Minor fixes

2.1.6 2015-01-02
- Fix OPTIONS requests
- Improve logs

2.1.5 2014-12-25
- Fix QR Code compatibility with iOS
- Only left button will trigger double click on tray icon

2.1.4 2014-12-20
- Fix crash when remarks are too long

2.1.3 2014-12-20
- Add Chinese Language
- Fix some UI issues on Windows 8
- Fix some UI issues on high DPI screens
- Log bind error more friendly
- Stability issues

2.1.2 2014-12-14
- Fix sometimes Shadowsocks doesn't respond to requests

2.1.1 2014-12-14
- Add global proxy option

2.1 2014-12-12
- Add salsa20 and chacha20 support

2.0.11 2014-11-23
- Fix a crash
- Only switch the system proxy off if we have switched it on

2.0.10 2014-11-18
- Minor fixes
- Optimize code

2.0.9 2014-11-13
- Fix startup path
- Fix allowed port range for polipo

2.0.8 2014-11-12
- Fix data corruption
- Set proxy for PPPoE
- Auto Startup Option
- Support high DPI screens

2.0.7 2014-11-11
- Use OpenSSL for now

2.0.6 2014-11-10
- Minor bug fixes

2.0.5 2014-11-09
- Fix QRCode size
- Share over LAN option
- Log to temp path instead

2.0.4 2014-11-09
- Try to fix data corruption
- Remove all configuration except x86

2.0.3 2014-11-08
- Support QRCode generation
- Fix compatibility issues with some Chrome version

2.0.2 2014-11-08
- Add remarks
- Fix error when polipo is killed

2.0.1 2014-11-08
- Check already running

2.0 2014-11-08
- Initial release


================================================
FILE: CONTRIBUTING.md
================================================
How to Contribute
=================

Pull Requests
-------------

1. Pull requests are welcome.
2. Make sure to pass the unit tests. Write unit tests for new modules if
needed.
3. Search before sending new pull request.

Issues
------

1. **DO NOT post question about connection problem in issue tracker**, read [Troubleshooting].
2. Search before sending new issue.

[Troubleshooting]: https://github.com/shadowsocks/shadowsocks-windows/wiki/Troubleshooting


================================================
FILE: LICENSE.txt
================================================
shadowsocks-csharp
==================

                    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

Copyright (C) 2015 clowwindy <clowwindy42@gmail.com>
Copyright (C) 2020 Shadowsocks Project <https://shadowsocks.org>

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/>.


3rd party projects
==================

Privoxy
------------------

                    GNU GENERAL PUBLIC LICENSE
                       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.)  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
this service 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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  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.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

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

                    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

                            NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    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 2 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, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.


mbed TLS
--------

https://tls.mbed.org

License: https://raw.githubusercontent.com/ARMmbed/mbedtls/master/LICENSE


Newtonsoft.Json
----------

https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md

The MIT License (MIT)

Copyright (c) 2007 James Newton-King

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


ZXing
-----

Copyright 2007 ZXing authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

libsodium
---------

Copyright (c) 2013-2015
Frank Denis <j at pureftpd dot org>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


================================================
FILE: OPENSSL-GUIDE
================================================
OpenSSL library guide for VS2017

# Read NOTES.WIN and NOTES.PERL

# use Visual Studio native tools command prompt
# use activeperl, install NASM assembler
ppm install dmake

# Win32 x86
set PATH=D:\NASM-32;%PATH%
perl Configure VC-WIN32 --release --prefix=C:\Users\home\Downloads\openssl-1.1.0g\x86-build --openssldir=C:\Users\home\Downloads\openssl-1.1.0g\x86-install
nmake
nmake test
# to rebuild
nmake distclean


================================================
FILE: README.md
================================================
<img src="shadowsocks-csharp/Resources/ssw128.png" alt="[logo]" width="48"/> Shadowsocks for Windows
=======================

[![Build Status]][Appveyor]

[中文说明]

## Features

1. System proxy configuration
2. PAC mode and global mode
3. [GeoSite] and user rules
4. Supports HTTP proxy
5. Supports server auto switching
6. Supports UDP relay (see Usage)
7. Supports plugins

## Downloads

Download the latest release from [release page].

## Requirements

.NET Framework 4.8 or higher, Microsoft [Visual C++ 2015 Redistributable] (x86) .

## Basics

1. Find Shadowsocks icon in the notification tray
2. You can add multiple servers in servers menu
3. Select `Enable System Proxy` menu to enable system proxy. Please disable other
proxy addons in your browser, or set them to use system proxy
4. You can also configure your browser proxy manually if you don't want to enable
system proxy. Set Socks5 or HTTP proxy to 127.0.0.1:1080. You can change this
port in `Servers -> Edit Servers`

## PAC

- The PAC rules are generated from the geosite database in [v2fly/domain-list-community](https://github.com/v2fly/domain-list-community).
- Generation modes: whitelist mode and blacklist mode.
- Domain groups: `geositeDirectGroups` and `geositeProxiedGroups`.
    - `geositeDirectGroups` is initialized with `cn` and `geolocation-!cn@cn`.
    - `geositeProxiedGroups` is initialized with `geolocation-!cn`.
- To switch between different modes, modify the `geositePreferDirect` property in `gui-config.json`
    - When `geositePreferDirect` is false (default), PAC works in whitelist mode. Exception rules are generated from `geositeDirectGroups`. Unmatched domains goes through the proxy.
    - When `geositePreferDirect` is true, PAC works in blacklist mode. Blocking rules are generated from `geositeProxiedGroups`. Exception rules are generated from `geositeDirectGroups`. Unmatched domains are connected to directly.
- Starting from 4.3.0.0, shadowsocks-windows defaults to whitelist mode with Chinese domains excluded from connecting via the proxy.
- The new default values make sure that:
    - When in whitelist mode, Chinese domains, including non-Chinese companies' Chinese CDNs, are connected to directly.
    - When in blacklist mode, only non-Chinese domains goes through the proxy. Chinese domains, as well as non-Chinese companies' Chinese CDNs, are connected to directly.

### User-defined rules

- To define your own PAC rules, it's recommended to use the `user-rule.txt` file.
- You can also modify `pac.txt` directly. But your modifications won't persist after updating geosite from the upstream.

For Windows10 Store and related applications, please execute the following command under Admin privilege:
```
netsh winhttp import proxy source=ie
```

## Server Auto Switching

1. Load balance: choosing server randomly
2. High availability: choosing the best server (low latency and packet loss)
3. Choose By Total Package Loss: ping and choose. Please also enable
   `Availability Statistics` in the menu if you want to use this
4. Write your own strategy by implement IStrategy interface and send us a pull request!

## UDP

For UDP, you need to use SocksCap or ProxyCap to force programs you want
to be proxied to tunnel over Shadowsocks

## Multiple Instances

If you want to manage multiple servers using other tools like SwitchyOmega,
you can start multiple Shadowsocks instances. To avoid configuration conflicts,
copy Shadowsocks to a new directory and choose a different local port.

## Plugins

If you would like to connect to server via a plugin, please set the plugin's
path (relative or absolute) on Edit Servers form.
_Note_: Forward Proxy will not be used while a plugin is enabled.

Details:
[Working with non SIP003 standard Plugin].

## Global hotkeys

Hotkeys could be registered automatically on startup.
If you are using multiple instances of Shadowsocks,
you must set different key combination for each instance.

### How to input?

1. Put focus in the corresponding textbox.
2. Press the key combination that you want to use.
3. Release all keys when you think it is ready.
4. Your input appears in the textbox.

### How to change?

1. Put focus in the corresponding textbox.
2. Press BackSpace key to clear content.
3. Re-input new key combination.

### How to deactivate?

1. Clear content in the textbox that you want to deactivate,
if you want to deactivate all, please clear all textboxes.
2. Press OK button to confirm.

### Meaning of label color

- Green: This key combination is not occupied by other programs and register successfully.
- Yellow: This key combination is occupied by other programs and you have to change to another one.
- Transparent without color: The initial status.

## Server Configuration

Please visit [Servers] for more information.

## Experimental

[Experimental Features]

## Development

1. Visual Studio 2019 & .NET Framework 4.8 SDK are required.
2. It is recommended to share your idea on the Issue Board before you start to work,
especially for feature development.

## License

[GPLv3]

## Open Source Components / Libraries

```
Caseless.Fody (MIT)              https://github.com/Fody/Caseless
Costura.Fody (MIT)               https://github.com/Fody/Costura
Fody (MIT)                       https://github.com/Fody/Fody
GlobalHotKey (GPLv3)             https://github.com/kirmir/GlobalHotKey
MdXaml (MIT)                     https://github.com/whistyun/MdXaml
Newtonsoft.Json (MIT)            https://www.newtonsoft.com/json
ReactiveUI.WPF (MIT)             https://github.com/reactiveui/ReactiveUI
ReactiveUI.Events.WPF (MIT)      https://github.com/reactiveui/ReactiveUI
ReactiveUI.Fody (MIT)            https://github.com/reactiveui/ReactiveUI
ReactiveUI.Validation (MIT)      https://github.com/reactiveui/ReactiveUI.Validation
WPFLocalizationExtension (MS-PL) https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension/
ZXing.Net (Apache 2.0)           https://github.com/micjahn/ZXing.Net

libsscrypto (GPLv2)    https://github.com/shadowsocks/libsscrypto
Privoxy (GPLv2)        https://www.privoxy.org
Sysproxy ()            https://github.com/Noisyfox/sysproxy
```



[Appveyor]:     https://ci.appveyor.com/project/celeron533/shadowsocks-windows
[Build Status]: https://ci.appveyor.com/api/projects/status/tfw57q6eecippsl5/branch/master?svg=true
[release page]: https://github.com/shadowsocks/shadowsocks-csharp/releases
[GeoSite]:      https://github.com/v2fly/domain-list-community
[Servers]:      https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#linux--server-side
[中文说明]:     https://github.com/shadowsocks/shadowsocks-windows/wiki/Shadowsocks-Windows-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E
[Visual C++ 2015 Redistributable]:     https://www.microsoft.com/en-us/download/details.aspx?id=53840
[GPLv3]:        https://github.com/shadowsocks/shadowsocks-windows/blob/master/LICENSE.txt
[Working with non SIP003 standard Plugin]: https://github.com/shadowsocks/shadowsocks-windows/wiki/Working-with-non-SIP003-standard-Plugin
[Experimental Features]: https://github.com/shadowsocks/shadowsocks-windows/wiki/Experimental

================================================
FILE: appveyor.yml
================================================

# Notes:
#   - Minimal appveyor.yml file is an empty file. All sections are optional.
#   - Indent each level of configuration with 2 spaces. Do not use tabs!
#   - All section names are case-sensitive.
#   - Section names should be unique on each level.

#---------------------------------#
#      general configuration      #
#---------------------------------#

# version format
# Build version format is taken from UI if it is not set
version: 4.4.1.{build}

# # branches to build
# branches:
#   # whitelist
#   only:
#     - master
#     - production

#   # blacklist
#   except:
#     - gh-pages


#---------------------------------#
#    environment configuration    #
#---------------------------------#

# Build worker image (VM template)
image: Visual Studio 2019

# scripts that are called at very beginning, before repo cloning
# init:
#   - git config --global core.autocrlf false


# set clone depth
clone_depth: 5                      # clone entire repository history if not defined


# environment variables
environment:
  # my_var1: value1
  # # this is how to set encrypted variable. Go to "Settings" -> "Encrypt YAML" page in account menu to encrypt data.
  # my_secure_var1:
  #   secure: FW3tJ3fMncxvs58/ifSP7w==
  matrix:
    - platform: x86
      configuration: Debug
    - platform: x86
      configuration: Release

# this is how to allow failing jobs in the matrix
matrix:
  fast_finish: false     # set this flag to immediately finish build once one of the jobs fails.

# build cache to preserve files/folders between builds
cache:
  - packages -> **\packages.config  # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
  # - '%LocalAppData%\NuGet\Cache'    # NuGet < v3
  - '%LocalAppData%\NuGet\v3-cache' # NuGet v3


# Automatically register private account and/or project AppVeyor NuGet feeds.
# nuget:
  # account_feed: true
  # project_feed: true
  # disable_publish_on_pr: true     # disable publishing of .nupkg artifacts to account/project feeds for pull request builds
  # publish_wap_octopus: true       # disable publishing of Octopus Deploy .nupkg artifacts to account/project feeds

#---------------------------------#
#       build configuration       #
#---------------------------------#

# Build settings, not to be confused with "before_build" and "after_build".
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
build:
  # parallel: true                  # enable MSBuild parallel builds
  # publish_nuget: true             # package projects with .nuspec files and push to artifacts
  # publish_nuget_symbols: true     # generate and publish NuGet symbol packages
  # include_nuget_references: true  # add -IncludeReferencedProjects option while packaging NuGet artifacts

  # MSBuild verbosity level
  verbosity: normal  # quiet|minimal|normal|detailed


# scripts to run before build
before_build:
  - cmd: nuget restore

# to run your custom scripts instead of automatic MSBuild
# build_script:

# scripts to run after build (working directory and environment changes are persisted from the previous steps)
after_build:
- ps: |+
    function CalculateHash($file)
    {
        $newLine = "`r`n"
        $text = (Split-Path $file -Leaf) + $newLine
        $text += 'MD5' + $newLine
        $text += (Get-FileHash $file -Algorithm MD5).Hash + $newLine
        $text += 'SHA-1' + $newLine
        $text += (Get-FileHash $file -Algorithm SHA1).Hash + $newLine
        $text += 'SHA-256' + $newLine
        $text += (Get-FileHash $file -Algorithm SHA256).Hash + $newLine
        $text += 'SHA-512' + $newLine
        $text += (Get-FileHash $file -Algorithm SHA512).Hash
        return $text
    }

    $WorkingFolder = "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:PLATFORM\$env:CONFIGURATION"
    $ReleaseFile = "$WorkingFolder\Shadowsocks.exe"
    $ReleaseHashFile = "$ReleaseFile.hash"
    $ReleaseLocalizationFiles = "$WorkingFolder\*\"
    $ZipFile = "$WorkingFolder\Shadowsocks-$env:APPVEYOR_BUILD_VERSION.zip"
    $ZipHashFile = "$ZipFile.hash"

    CalculateHash -file "$ReleaseFile" | Out-File -FilePath "$ReleaseHashFile"
    7z a "$ZipFile" "$ReleaseFile" "$ReleaseHashFile" "$ReleaseLocalizationFiles"
    Push-AppveyorArtifact "$ZipFile"

    # Calculate packed zip Hash
    CalculateHash -file "$ZipFile" | Out-File -FilePath "$ZipHashFile"
    Push-AppveyorArtifact "$ZipHashFile"


# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
# before_package:

# to disable automatic builds
#build: off


#---------------------------------#
#     deployment configuration    #
#---------------------------------#

# providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment
# provider names are case-sensitive!
# deploy:

# # scripts to run before deployment
# before_deploy:

# # scripts to run after deployment
# after_deploy:

# # to run your custom scripts instead of provider deployments
# deploy_script:

# # to disable deployment
#deploy: off

================================================
FILE: appveyor.yml.obsolete
================================================
# Created by wongsyrone

version: 1.0.{build}
image: Visual Studio 2017
environment:
  matrix:
    - platform: x86
      configuration: Debug
    - platform: x86
      configuration: Release
matrix:
  fast_finish: false
nuget:
  project_feed: true
before_build:
- cmd: nuget restore
build:
  parallel: true
  verbosity: normal
artifacts:
- path: shadowsocks-csharp\bin\x86\Release\Shadowsocks.exe
  name: Shadowsocks-release.exe
- path: shadowsocks-csharp\bin\x86\Debug\Shadowsocks.exe
  name: Shadowsocks-debug.exe


================================================
FILE: appveyor.yml.sample
================================================

# Notes:
#   - Minimal appveyor.yml file is an empty file. All sections are optional.
#   - Indent each level of configuration with 2 spaces. Do not use tabs!
#   - All section names are case-sensitive.
#   - Section names should be unique on each level.

#---------------------------------#
#      general configuration      #
#---------------------------------#

# version format
version: 1.0.{build}

# you can use {branch} name in version format too
# version: 1.0.{build}-{branch}

# branches to build
branches:
  # whitelist
  only:
    - master
    - production

  # blacklist
  except:
    - gh-pages

# Do not build on tags (GitHub and BitBucket)
skip_tags: true

# Start builds on tags only (GitHub and BitBucket)
skip_non_tags: true

# Skipping commits with particular message or from specific user
skip_commits:
  message: /Created.*\.(png|jpg|jpeg|bmp|gif)/      # Regex for matching commit message
  author: John                                      # Commit author's username, name, email or regexp maching one of these.

# Including commits with particular message or from specific user
only_commits:
  message: /build/                # Start a new build if message contains 'build'
  author: jack@company.com        # Start a new build for commit of user with email jack@company.com

# Skipping commits affecting specific files (GitHub only). More details here: /docs/appveyor-yml
#skip_commits:
#  files:
#    - docs/*
#    - '**/*.html'

# Including commits affecting specific files (GitHub only). More details here: /docs/appveyor-yml
#only_commits:
#  files:
#    - Project-A/
#    - Project-B/

# Do not build feature branch with open Pull Requests
skip_branch_with_pr: true

# Maximum number of concurrent jobs for the project
max_jobs: 1

#---------------------------------#
#    environment configuration    #
#---------------------------------#

# Build worker image (VM template)
image: Visual Studio 2015

# scripts that are called at very beginning, before repo cloning
init:
  - git config --global core.autocrlf input

# clone directory
clone_folder: c:\projects\myproject

# fetch repository as zip archive
shallow_clone: true                 # default is "false"

# set clone depth
clone_depth: 5                      # clone entire repository history if not defined

# setting up etc\hosts file
hosts:
  queue-server: 127.0.0.1
  db.server.com: 127.0.0.2

# environment variables
environment:
  my_var1: value1
  my_var2: value2
  # this is how to set encrypted variable. Go to "Settings" -> "Encrypt YAML" page in account menu to encrypt data.
  my_secure_var1:
    secure: FW3tJ3fMncxvs58/ifSP7w==

# environment:
#  global:
#    connection_string: server=12;password=13;
#    service_url: https://127.0.0.1:8090
#
#  matrix:
#  - db: mysql
#    provider: mysql
#
#  - db: mssql
#    provider: mssql
#    password:
#      secure: $#(JFDA)jQ@#$

# this is how to allow failing jobs in the matrix
matrix:
  fast_finish: true     # set this flag to immediately finish build once one of the jobs fails.
  allow_failures:
    - platform: x86
      configuration: Debug
    - platform: x64
      configuration: Release

# exclude configuration from the matrix. Works similarly to 'allow_failures' but build not even being started for excluded combination.
  exclude:
    - platform: x86
      configuration: Debug

# build cache to preserve files/folders between builds
cache:
  - packages -> **\packages.config  # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
  - projectA\libs
  - node_modules                    # local npm modules
  - '%LocalAppData%\NuGet\Cache'    # NuGet < v3
  - '%LocalAppData%\NuGet\v3-cache' # NuGet v3

# enable service required for build/tests
services:
  - mssql2014           # start SQL Server 2014 Express
  - mssql2014rs         # start SQL Server 2014 Express and Reporting Services
  - mssql2012sp1        # start SQL Server 2012 SP1 Express
  - mssql2012sp1rs      # start SQL Server 2012 SP1 Express and Reporting Services
  - mssql2008r2sp2      # start SQL Server 2008 R2 SP2 Express
  - mssql2008r2sp2rs    # start SQL Server 2008 R2 SP2 Express and Reporting Services
  - mysql               # start MySQL 5.6 service
  - postgresql          # start PostgreSQL 9.5 service
  - iis                 # start IIS
  - msmq                # start Queuing services
  - mongodb             # start MongoDB

# scripts that run after cloning repository
install:
  # by default, all script lines are interpreted as batch
  - echo This is batch
  # to run script as a PowerShell command prepend it with ps:
  - ps: Write-Host 'This is PowerShell'
  # batch commands start from cmd:
  - cmd: echo This is batch again
  - cmd: set MY_VAR=12345

# enable patching of AssemblyInfo.* files
assembly_info:
  patch: true
  file: AssemblyInfo.*
  assembly_version: "2.2.{build}"
  assembly_file_version: "{version}"
  assembly_informational_version: "{version}"


# Automatically register private account and/or project AppVeyor NuGet feeds.
nuget:
  account_feed: true
  project_feed: true
  disable_publish_on_pr: true     # disable publishing of .nupkg artifacts to account/project feeds for pull request builds
  publish_wap_octopus: true       # disable publishing of Octopus Deploy .nupkg artifacts to account/project feeds

#---------------------------------#
#       build configuration       #
#---------------------------------#

# build platform, i.e. x86, x64, Any CPU. This setting is optional.
platform: Any CPU

# to add several platforms to build matrix:
#platform:
#  - x86
#  - Any CPU

# build Configuration, i.e. Debug, Release, etc.
configuration: Release

# to add several configurations to build matrix:
#configuration:
#  - Debug
#  - Release

# Build settings, not to be confused with "before_build" and "after_build".
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
build:
  parallel: true                  # enable MSBuild parallel builds
  project: MyTestAzureCS.sln      # path to Visual Studio solution or project
  publish_wap: true               # package Web Application Projects (WAP) for Web Deploy
  publish_wap_xcopy: true         # package Web Application Projects (WAP) for XCopy deployment
  publish_wap_beanstalk: true     # Package Web Applications for AWS Elastic Beanstalk deployment
  publish_wap_octopus: true       # Package Web Applications for Octopus deployment
  publish_azure_webjob: true      # Package Azure WebJobs for Zip Push deployment
  publish_azure: true             # package Azure Cloud Service projects and push to artifacts
  publish_aspnet_core: true       # Package ASP.NET Core projects
  publish_core_console: true      # Package .NET Core console projects
  publish_nuget: true             # package projects with .nuspec files and push to artifacts
  publish_nuget_symbols: true     # generate and publish NuGet symbol packages
  include_nuget_references: true  # add -IncludeReferencedProjects option while packaging NuGet artifacts

  # MSBuild verbosity level
  verbosity: quiet|minimal|normal|detailed


# scripts to run before build
before_build:

# to run your custom scripts instead of automatic MSBuild
build_script:

# scripts to run after build (working directory and environment changes are persisted from the previous steps)
after_build:

# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
before_package:

# to disable automatic builds
#build: off

#---------------------------------#
#       tests configuration       #
#---------------------------------#

# to run tests against only selected assemblies and/or categories
test:
  assemblies:
    only:
      - asm1.dll
      - asm2.dll

  categories:
    only:
      - UI
      - E2E

# to run tests against all except selected assemblies and/or categories
#test:
#  assemblies:
#    except:
#      - asm1.dll
#      - asm2.dll
#
#  categories:
#    except:
#      - UI
#      - E2E

# to run tests from different categories as separate jobs in parallel
#test:
#  categories:
#    - A            # A category common for all jobs
#    - [UI]         # 1st job
#    - [DAL, BL]    # 2nd job

# scripts to run before tests (working directory and environment changes are persisted from the previous steps such as "before_build")
before_test:
  - echo script1
  - ps: Write-Host "script1"

# to run your custom scripts instead of automatic tests
test_script:
  - echo This is my custom test script

# scripts to run after tests
after_test:

# to disable automatic tests
#test: off


#---------------------------------#
#      artifacts configuration    #
#---------------------------------#

artifacts:

  # pushing a single file
  - path: test.zip

  # pushing a single file with environment variable in path and "Deployment name" specified
  - path: MyProject\bin\$(configuration)
    name: myapp

  # pushing entire folder as a zip archive
  - path: logs

  # pushing all *.nupkg files in build directory recursively
  - path: '**\*.nupkg'


#---------------------------------#
#     deployment configuration    #
#---------------------------------#

# providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment
# provider names are case-sensitive!
deploy:

    # FTP deployment provider settings
  - provider: FTP
    protocol: ftp|ftps|sftp
    host: ftp.myserver.com
    username: admin
    password:
      secure: eYKZKFkkEvFYWX6NfjZIVw==
    folder:
    application:
    active_mode: false
    beta: true      # enable alternative FTP library for 'ftp' and 'ftps' modes
    debug: true     # show complete FTP log

    # Amazon S3 deployment provider settings
  - provider: S3
    access_key_id:
      secure: ABcd==
    secret_access_key:
      secure: ABcd==
    bucket: my_bucket
    folder:
    artifact:
    set_public: false

    # Azure Blob storage deployment provider settings
  - provider: AzureBlob
    storage_account_name:
      secure: ABcd==
    storage_access_key:
      secure: ABcd==
    container: my_container
    folder:
    artifact:

    # Web Deploy deployment provider settings
  - provider: WebDeploy
    server: http://www.deploy.com/myendpoint
    website: mywebsite
    username: user
    password:
      secure: eYKZKFkkEvFYWX6NfjZIVw==
    ntlm: false
    remove_files: false
    app_offline: false
    do_not_use_checksum: true           # do not use check sum for comparing source and destination files. By default checksums are used.
    sync_retry_attempts: 2              # sync attempts, max
    sync_retry_interval: 2000           # timeout between sync attempts, milliseconds
    aspnet_core: true                   # artifact zip contains ASP.NET Core application
    aspnet_core_force_restart: true     # poke app's web.config before deploy to force application restart
    skip_dirs: \\App_Data
    skip_files: web.config
    on:
      branch: release
      platform: x86
      configuration: debug

    # Deploying to Azure Cloud Service
  - provider: AzureCS
    subscription_id:
      secure: fjZIVw==
    subscription_certificate:
      secure: eYKZKFkkEv...FYWX6NfjZIVw==
    storage_account_name: my_storage
    storage_access_key:
      secure: ABcd==
    service: my_service
    slot: Production
    target_profile: Cloud
    artifact: MyPackage.cspkg

    # Deploying to NuGet feed
  - provider: NuGet
    server: https://my.nuget.server/feed
    api_key:
      secure: FYWX6NfjZIVw==
    skip_symbols: false
    symbol_server: https://your.symbol.server/feed
    artifact: MyPackage.nupkg

    # Deploy to GitHub Releases
  - provider: GitHub
    artifact: /.*\.nupkg/           # upload all NuGet packages to release assets
    draft: false
    prerelease: false
    on:
      branch: master                # release from master branch only
      APPVEYOR_REPO_TAG: true       # deploy on tag push only

    # Deploying to a named environment
  - provider: Environment
    name: staging
    on:
      branch: staging
      env_var1: value1
      env_var2: value2

# scripts to run before deployment
before_deploy:

# scripts to run after deployment
after_deploy:

# to run your custom scripts instead of provider deployments
deploy_script:

# to disable deployment
#deploy: off

#---------------------------------#
#        global handlers          #
#---------------------------------#

# on successful build
on_success:
  - do something

# on build failure
on_failure:
  - do something

# after build failure or success
on_finish:
  - do something


#---------------------------------#
#         notifications           #
#---------------------------------#

notifications:

  # Email
  - provider: Email
    to:
      - user1@email.com
      - user2@email.com
    subject: 'Build {{status}}'                  # optional
    message: "{{message}}, {{commitId}}, ..."    # optional
    on_build_status_changed: true

  # HipChat
  - provider: HipChat
    auth_token:
      secure: RbOnSMSFKYzxzFRrxM1+XA==
    room: ProjectA
    template: "{message}, {commitId}, ..."

  # Slack
  - provider: Slack
    incoming_webhook: http://incoming-webhook-url

  # ...or using auth token

  - provider: Slack
    auth_token:
      secure: kBl9BlxvRMr9liHmnBs14A==
    channel: development
    template: "{message}, {commitId}, ..."

  # Campfire
  - provider: Campfire
    account: appveyor
    auth_token:
      secure: RifLRG8Vfyol+sNhj9u2JA==
    room: ProjectA
    template: "{message}, {commitId}, ..."

  # Webhook
  - provider: Webhook
    url: http://www.myhook2.com
    headers:
      User-Agent: myapp 1.0
      Authorization:
        secure: GhD+5xhLz/tkYY6AO3fcfQ==
    on_build_success: false
    on_build_failure: true
    on_build_status_changed: true


================================================
FILE: packaging/upload.sh
================================================
#!/bin/bash

version=$1

rsync --progress -e ssh shadowsocks-csharp/bin/x86/Release/Shadowsocks-win-dotnet4.0-$1.zip frs.sourceforge.net:/home/frs/project/shadowsocksgui/dist/
rsync --progress -e ssh shadowsocks-csharp/bin/x86/Release/Shadowsocks-win-$1.zip frs.sourceforge.net:/home/frs/project/shadowsocksgui/dist/


================================================
FILE: shadowsocks-csharp/CommandLineOption.cs
================================================
using CommandLine;

namespace Shadowsocks
{
    public class CommandLineOption
    {
        [Option("open-url",Required = false,HelpText = "Add an ss:// URL")]
        public string OpenUrl { get; set; }
    }
}

================================================
FILE: shadowsocks-csharp/Controller/FileManager.cs
================================================
using NLog;
using System;
using System.IO;
using System.IO.Compression;
using System.Text;

namespace Shadowsocks.Controller
{
    public static class FileManager
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();

        public static bool ByteArrayToFile(string fileName, byte[] content)
        {
            try
            {
                using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
                    fs.Write(content, 0, content.Length);
                return true;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return false;
        }

        public static void UncompressFile(string fileName, byte[] content)
        {
            // Because the uncompressed size of the file is unknown,
            // we are using an arbitrary buffer size.
            byte[] buffer = new byte[4096];
            int n;

            using(var fs = File.Create(fileName))
            using (var input = new GZipStream(new MemoryStream(content),
                    CompressionMode.Decompress, false))
            {
                while ((n = input.Read(buffer, 0, buffer.Length)) > 0)
                {
                    fs.Write(buffer, 0, n);
                }
            }
        }

        public static string NonExclusiveReadAllText(string path)
        {
            return NonExclusiveReadAllText(path, Encoding.Default);
        }

        public static string NonExclusiveReadAllText(string path, Encoding encoding)
        {
            try
            {
                using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                using (var sr = new StreamReader(fs, encoding))
                {
                    return sr.ReadToEnd();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw ex;
            }
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/HotkeyReg.cs
================================================
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using NLog;
using Shadowsocks.Controller.Hotkeys;
using Shadowsocks.Model;

namespace Shadowsocks.Controller
{
    static class HotkeyReg
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();
        public static void RegAllHotkeys()
        {
            var hotkeyConfig = Program.MainController.GetCurrentConfiguration().hotkey;

            if (hotkeyConfig == null || !hotkeyConfig.RegHotkeysAtStartup)
                return;

            // if any of the hotkey reg fail, undo everything
            if (RegHotkeyFromString(hotkeyConfig.SwitchSystemProxy, "SwitchSystemProxyCallback")
                && RegHotkeyFromString(hotkeyConfig.SwitchSystemProxyMode, "SwitchSystemProxyModeCallback")
                && RegHotkeyFromString(hotkeyConfig.SwitchAllowLan, "SwitchAllowLanCallback")
                && RegHotkeyFromString(hotkeyConfig.ShowLogs, "ShowLogsCallback")
                && RegHotkeyFromString(hotkeyConfig.ServerMoveUp, "ServerMoveUpCallback")
                && RegHotkeyFromString(hotkeyConfig.ServerMoveDown, "ServerMoveDownCallback")
            )
            {
                // success
            }
            else
            {
                RegHotkeyFromString("", "SwitchSystemProxyCallback");
                RegHotkeyFromString("", "SwitchSystemProxyModeCallback");
                RegHotkeyFromString("", "SwitchAllowLanCallback");
                RegHotkeyFromString("", "ShowLogsCallback");
                RegHotkeyFromString("", "ServerMoveUpCallback");
                RegHotkeyFromString("", "ServerMoveDownCallback");
                MessageBox.Show(I18N.GetString("Register hotkey failed"), I18N.GetString("Shadowsocks"));
            }
        }

        public static bool RegHotkeyFromString(string hotkeyStr, string callbackName, Action<RegResult> onComplete = null)
        {
            var _callback = HotkeyCallbacks.GetCallback(callbackName);
            if (_callback == null)
            {
                throw new Exception($"{callbackName} not found");
            }

            var callback = _callback as HotKeys.HotKeyCallBackHandler;

            if (string.IsNullOrEmpty(hotkeyStr))
            {
                HotKeys.UnregExistingHotkey(callback);
                onComplete?.Invoke(RegResult.UnregSuccess);
                return true;
            }
            else
            {
                var hotkey = HotKeys.Str2HotKey(hotkeyStr);
                if (hotkey == null)
                {
                    logger.Error($"Cannot parse hotkey: {hotkeyStr}");
                    onComplete?.Invoke(RegResult.ParseError);
                    return false;
                }
                else
                {
                    bool regResult = (HotKeys.RegHotkey(hotkey, callback));
                    if (regResult)
                    {
                        onComplete?.Invoke(RegResult.RegSuccess);
                    }
                    else
                    {
                        onComplete?.Invoke(RegResult.RegFailure);
                    }
                    return regResult;
                }
            }
        }

        public enum RegResult
        {
            RegSuccess,
            RegFailure,
            ParseError,
            UnregSuccess,
            //UnregFailure
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/I18N.cs
================================================
using Microsoft.VisualBasic.FileIO;
using NLog;
using Shadowsocks.Properties;
using Shadowsocks.Util;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace Shadowsocks.Controller
{
    public static class I18N
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();

        public const string I18N_FILE = "i18n.csv";

        private static Dictionary<string, string> _strings = new Dictionary<string, string>();

        private static void Init(string res, string locale)
        {
            using (TextFieldParser csvParser = new TextFieldParser(new StringReader(res)))
            {
                csvParser.SetDelimiters(",");

                // search language index
                string[] localeNames = csvParser.ReadFields();

                int enIndex = 0;
                int targetIndex = -1;

                for (int i = 0; i < localeNames.Length; i++)
                {
                    if (localeNames[i] == "en")
                        enIndex = i;
                    if (localeNames[i] == locale)
                        targetIndex = i;
                }

                // Fallback to same language with different region
                if (targetIndex == -1)
                {
                    string localeNoRegion = locale.Split('-')[0];
                    for (int i = 0; i < localeNames.Length; i++)
                    {
                        if (localeNames[i].Split('-')[0] == localeNoRegion)
                            targetIndex = i;
                    }
                    if (targetIndex != -1 && enIndex != targetIndex)
                    {
                        logger.Info($"Using {localeNames[targetIndex]} translation for {locale}");
                    }
                    else
                    {
                        // Still not found, exit
                        logger.Info($"Translation for {locale} not found");
                        return;
                    }
                }

                // read translation lines
                while (!csvParser.EndOfData)
                {
                    string[] translations = csvParser.ReadFields();
                    string source = translations[enIndex];
                    string translation = translations[targetIndex];

                    // source string or translation empty
                    if (string.IsNullOrWhiteSpace(source) || string.IsNullOrWhiteSpace(translation)) continue;
                    // line start with comment
                    if (translations[0].TrimStart(' ')[0] == '#') continue;

                    _strings[source] = translation;
                }
            }
        }

        static I18N()
        {
            string i18n;
            string locale = CultureInfo.CurrentCulture.Name;
            if (!File.Exists(I18N_FILE))
            {
                i18n = Resources.i18n_csv;
                //File.WriteAllText(I18N_FILE, i18n, Encoding.UTF8);
            }
            else
            {
                logger.Info("Using external translation");
                i18n = File.ReadAllText(I18N_FILE, Encoding.UTF8);
            }
            logger.Info("Current language is: " + locale);
            Init(i18n, locale);
        }

        public static string GetString(string key, params object[] args)
        {
            return string.Format(_strings.TryGetValue(key.Trim(), out var value) ? value : key, args);
        }

        public static void TranslateForm(Form c)
        {
            if (c == null) return;
            c.Text = GetString(c.Text);
            foreach (var item in ViewUtils.GetChildControls<Control>(c))
            {
                if (item == null) continue;
                item.Text = GetString(item.Text);
            }
            TranslateMenu(c.Menu);
        }
        public static void TranslateMenu(Menu m)
        {
            if (m == null) return;
            foreach (var item in ViewUtils.GetMenuItems(m))
            {
                if (item == null) continue;
                item.Text = GetString(item.Text);
            }
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/LoggerExtension.cs
================================================
using System;
using System.ComponentModel;
using System.IO;
using System.Net.Sockets;
using System.Net;
using System.Diagnostics;
using System.Text;
using Shadowsocks.Util.SystemProxy;

namespace NLog
{
    public static class LoggerExtension
    {
        public static void Dump(this Logger logger, string tag, byte[] arr, int length)
        {
            if (logger.IsTraceEnabled)
            {
                var sb = new StringBuilder($"{Environment.NewLine}{tag}: ");
                for (int i = 0; i < length - 1; i++)
                {
                    sb.Append($"0x{arr[i]:X2}, ");
                }
                sb.Append($"0x{arr[length - 1]:X2}");
                sb.Append(Environment.NewLine);
                logger.Trace(sb.ToString());
            }
        }

        public static void Debug(this Logger logger, EndPoint local, EndPoint remote, int len, string header = null, string tailer = null)
        {
            if (logger.IsDebugEnabled)
            {
                if (header == null && tailer == null)
                    logger.Debug($"{local} => {remote} (size={len})");
                else if (header == null && tailer != null)
                    logger.Debug($"{local} => {remote} (size={len}), {tailer}");
                else if (header != null && tailer == null)
                    logger.Debug($"{header}: {local} => {remote} (size={len})");
                else
                    logger.Debug($"{header}: {local} => {remote} (size={len}), {tailer}");
            }
        }

        public static void Debug(this Logger logger, Socket sock, int len, string header = null, string tailer = null)
        {
            if (logger.IsDebugEnabled)
            {
                logger.Debug(sock.LocalEndPoint, sock.RemoteEndPoint, len, header, tailer);
            }
        }

        public static void LogUsefulException(this Logger logger, Exception e)
        {
            // just log useful exceptions, not all of them
            if (e is SocketException)
            {
                SocketException se = (SocketException)e;
                if (se.SocketErrorCode == SocketError.ConnectionAborted)
                {
                    // closed by browser when sending
                    // normally happens when download is canceled or a tab is closed before page is loaded
                }
                else if (se.SocketErrorCode == SocketError.ConnectionReset)
                {
                    // received rst
                }
                else if (se.SocketErrorCode == SocketError.NotConnected)
                {
                    // The application tried to send or receive data, and the System.Net.Sockets.Socket is not connected.
                }
                else if (se.SocketErrorCode == SocketError.HostUnreachable)
                {
                    // There is no network route to the specified host.
                }
                else if (se.SocketErrorCode == SocketError.TimedOut)
                {
                    // The connection attempt timed out, or the connected host has failed to respond.
                }
                else
                {
                    logger.Warn(e);
                }
            }
            else if (e is ObjectDisposedException)
            {
            }
            else if (e is Win32Exception)
            {
                var ex = (Win32Exception)e;

                // Win32Exception (0x80004005): A 32 bit processes cannot access modules of a 64 bit process.
                if ((uint)ex.ErrorCode != 0x80004005)
                {
                    logger.Warn(e);
                }
            }
            else if (e is ProxyException)
            {
                var ex = (ProxyException)e;
                switch (ex.Type)
                {
                    case ProxyExceptionType.FailToRun:
                    case ProxyExceptionType.QueryReturnMalformed:
                    case ProxyExceptionType.SysproxyExitError:
                        logger.Error($"sysproxy - {ex.Type.ToString()}:{ex.Message}");
                        break;
                    case ProxyExceptionType.QueryReturnEmpty:
                    case ProxyExceptionType.Unspecific:
                        logger.Error($"sysproxy - {ex.Type.ToString()}");
                        break;
                }
            }
            else
            {
                logger.Warn(e);
            }
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/GeositeUpdater.cs
================================================
using NLog;
using Shadowsocks.Properties;
using Shadowsocks.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Shadowsocks.Model;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Security.Cryptography;

namespace Shadowsocks.Controller
{
    public class GeositeResultEventArgs : EventArgs
    {
        public bool Success;

        public GeositeResultEventArgs(bool success)
        {
            this.Success = success;
        }
    }

    public static class GeositeUpdater
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();

        public static event EventHandler<GeositeResultEventArgs> UpdateCompleted;

        public static event ErrorEventHandler Error;

        private static readonly string DATABASE_PATH = Utils.GetTempPath("dlc.dat");

        private static readonly string GEOSITE_URL = "https://github.com/v2fly/domain-list-community/raw/release/dlc.dat";
        private static readonly string GEOSITE_SHA256SUM_URL = "https://github.com/v2fly/domain-list-community/raw/release/dlc.dat.sha256sum";
        private static byte[] geositeDB;

        public static readonly Dictionary<string, IList<DomainObject>> Geosites = new Dictionary<string, IList<DomainObject>>();

        static GeositeUpdater()
        {
            if (File.Exists(DATABASE_PATH) && new FileInfo(DATABASE_PATH).Length > 0)
            {
                geositeDB = File.ReadAllBytes(DATABASE_PATH);
            }
            else
            {
                geositeDB = Resources.dlc_dat;
                File.WriteAllBytes(DATABASE_PATH, Resources.dlc_dat);
            }
            LoadGeositeList();
        }

        /// <summary>
        /// load new GeoSite data from geositeDB
        /// </summary>
        static void LoadGeositeList()
        {
            var list = GeositeList.Parser.ParseFrom(geositeDB);
            foreach (var item in list.Entries)
            {
                Geosites[item.GroupName.ToLowerInvariant()] = item.Domains;
            }
        }

        public static void ResetEvent()
        {
            UpdateCompleted = null;
            Error = null;
        }

        public static async Task UpdatePACFromGeosite()
        {
            var geositeUrl = GEOSITE_URL;
            var geositeSha256sumUrl = GEOSITE_SHA256SUM_URL;
            var geositeVerifySha256 = true;
            var geositeSha256sum = "";
            var mySHA256 = SHA256.Create();
            var config = Program.MainController.GetCurrentConfiguration();
            var blacklist = config.geositePreferDirect;
            var httpClient = Program.MainController.GetHttpClient();

            if (!string.IsNullOrWhiteSpace(config.geositeUrl))
            {
                logger.Info("Found custom Geosite URL in config file");
                geositeUrl = config.geositeUrl;
                geositeSha256sumUrl = config.geositeSha256sumUrl;
                if (string.IsNullOrWhiteSpace(geositeSha256sumUrl))
                {
                    geositeVerifySha256 = false;
                    logger.Info("Geosite SHA256 verification is disabled.");
                }
            }
            logger.Info($"Checking Geosite from {geositeUrl}");

            try
            {
                // Use sha256sum to check if local database is already latest.
                if (geositeVerifySha256)
                {
                    // download checksum first
                    geositeSha256sum = await httpClient.GetStringAsync(geositeSha256sumUrl);
                    geositeSha256sum = geositeSha256sum.Substring(0, 64).ToUpper();
                    logger.Info($"Got Sha256sum: {geositeSha256sum}");
                    // compare downloaded checksum with local geositeDB
                    byte[] localDBHashBytes = mySHA256.ComputeHash(geositeDB);
                    string localDBHash = BitConverter.ToString(localDBHashBytes).Replace("-", String.Empty);
                    logger.Info($"Local Sha256sum: {localDBHash}");
                    // if already latest
                    if (geositeSha256sum == localDBHash)
                    {
                        logger.Info("Local GeoSite DB is up to date.");
                        UpdateCompleted?.Invoke(null, new GeositeResultEventArgs(false));
                        return;
                    }
                }

                // not latest. download new DB
                var downloadedBytes = await httpClient.GetByteArrayAsync(geositeUrl);

                // verify sha256sum
                if (geositeVerifySha256)
                {
                    byte[] downloadedDBHashBytes = mySHA256.ComputeHash(downloadedBytes);
                    string downloadedDBHash = BitConverter.ToString(downloadedDBHashBytes).Replace("-", String.Empty);
                    logger.Info($"Actual Sha256sum: {downloadedDBHash}");
                    if (geositeSha256sum != downloadedDBHash)
                    {
                        logger.Info("Sha256sum Verification: FAILED. Downloaded GeoSite DB is corrupted. Aborting the update.");
                        throw new Exception("Sha256sum mismatch");
                    }
                    else
                    {
                        logger.Info("Sha256sum Verification: PASSED. Applying to local GeoSite DB.");
                    }
                }

                // write to geosite file
                using (FileStream geositeFileStream = File.Create(DATABASE_PATH))
                    await geositeFileStream.WriteAsync(downloadedBytes, 0, downloadedBytes.Length);

                // update stuff
                geositeDB = downloadedBytes;
                LoadGeositeList();
                bool pacFileChanged = MergeAndWritePACFile(config.geositeDirectGroups, config.geositeProxiedGroups, blacklist);
                UpdateCompleted?.Invoke(null, new GeositeResultEventArgs(pacFileChanged));
            }
            catch (Exception ex)
            {
                Error?.Invoke(null, new ErrorEventArgs(ex));
            }
        }

        /// <summary>
        /// Merge and write pac.txt from geosite.
        /// Used at multiple places.
        /// </summary>
        /// <param name="directGroups">A list of geosite groups configured for direct connection.</param>
        /// <param name="proxiedGroups">A list of geosite groups configured for proxied connection.</param>
        /// <param name="blacklist">Whether to use blacklist mode. False for whitelist.</param>
        /// <returns></returns>
        public static bool MergeAndWritePACFile(List<string> directGroups, List<string> proxiedGroups, bool blacklist)
        {
            string abpContent = MergePACFile(directGroups, proxiedGroups, blacklist);
            if (File.Exists(PACDaemon.PAC_FILE))
            {
                string original = FileManager.NonExclusiveReadAllText(PACDaemon.PAC_FILE, Encoding.UTF8);
                if (original == abpContent)
                {
                    return false;
                }
            }
            File.WriteAllText(PACDaemon.PAC_FILE, abpContent, Encoding.UTF8);
            return true;
        }

        /// <summary>
        /// Checks if the specified group exists in GeoSite database.
        /// </summary>
        /// <param name="group">The group name to check for.</param>
        /// <returns>True if the group exists. False if the group doesn't exist.</returns>
        public static bool CheckGeositeGroup(string group) => SeparateAttributeFromGroupName(group, out string groupName, out _) && Geosites.ContainsKey(groupName);

        /// <summary>
        /// Separates the attribute (e.g. @cn) from a group name.
        /// No checks are performed.
        /// </summary>
        /// <param name="group">A group name potentially with a trailing attribute.</param>
        /// <param name="groupName">The group name with the attribute stripped.</param>
        /// <param name="attribute">The attribute.</param>
        /// <returns>True for success. False for more than one '@'.</returns>
        private static bool SeparateAttributeFromGroupName(string group, out string groupName, out string attribute)
        {
            var splitGroupAttributeList = group.Split('@');
            if (splitGroupAttributeList.Length == 1) // no attribute
            {
                groupName = splitGroupAttributeList[0];
                attribute = "";
            }
            else if (splitGroupAttributeList.Length == 2) // has attribute
            {
                groupName = splitGroupAttributeList[0];
                attribute = splitGroupAttributeList[1];
            }
            else
            {
                groupName = "";
                attribute = "";
                return false;
            }    
            return true;
        }

        private static string MergePACFile(List<string> directGroups, List<string> proxiedGroups, bool blacklist)
        {
            string abpContent;
            if (File.Exists(PACDaemon.USER_ABP_FILE))
            {
                abpContent = FileManager.NonExclusiveReadAllText(PACDaemon.USER_ABP_FILE, Encoding.UTF8);
            }
            else
            {
                abpContent = Resources.abp_js;
            }

            List<string> userruleLines = new List<string>();
            if (File.Exists(PACDaemon.USER_RULE_FILE))
            {
                string userrulesString = FileManager.NonExclusiveReadAllText(PACDaemon.USER_RULE_FILE, Encoding.UTF8);
                userruleLines = ProcessUserRules(userrulesString);
            }

            List<string> ruleLines = GenerateRules(directGroups, proxiedGroups, blacklist);
            abpContent =
$@"var __USERRULES__ = {JsonConvert.SerializeObject(userruleLines, Formatting.Indented)};
var __RULES__ = {JsonConvert.SerializeObject(ruleLines, Formatting.Indented)};
{abpContent}";
            return abpContent;
        }

        private static List<string> ProcessUserRules(string content)
        {
            List<string> valid_lines = new List<string>();
            using (var stringReader = new StringReader(content))
            {
                for (string line = stringReader.ReadLine(); line != null; line = stringReader.ReadLine())
                {
                    if (string.IsNullOrWhiteSpace(line) || line.StartsWith("!") || line.StartsWith("["))
                        continue;
                    valid_lines.Add(line);
                }
            }
            return valid_lines;
        }

        /// <summary>
        /// Generates rule lines based on user preference.
        /// </summary>
        /// <param name="directGroups">A list of geosite groups configured for direct connection.</param>
        /// <param name="proxiedGroups">A list of geosite groups configured for proxied connection.</param>
        /// <param name="blacklist">Whether to use blacklist mode. False for whitelist.</param>
        /// <returns>A list of rule lines.</returns>
        private static List<string> GenerateRules(List<string> directGroups, List<string> proxiedGroups, bool blacklist)
        {
            List<string> ruleLines;
            if (blacklist) // blocking + exception rules
            {
                ruleLines = GenerateBlockingRules(proxiedGroups);
                ruleLines.AddRange(GenerateExceptionRules(directGroups));
            }
            else // proxy all + exception rules
            {
                ruleLines = new List<string>()
                {
                    "/.*/" // block/proxy all unmatched domains
                };
                ruleLines.AddRange(GenerateExceptionRules(directGroups));
            }
            return ruleLines;
        }

        /// <summary>
        /// Generates rules that match domains that should be proxied.
        /// </summary>
        /// <param name="groups">A list of source groups.</param>
        /// <returns>A list of rule lines.</returns>
        private static List<string> GenerateBlockingRules(List<string> groups)
        {
            List<string> ruleLines = new List<string>();
            foreach (var group in groups)
            {
                // separate group name and attribute
                SeparateAttributeFromGroupName(group, out string groupName, out string attribute);
                var domainObjects = Geosites[groupName];
                if (!string.IsNullOrEmpty(attribute)) // has attribute
                {
                    var attributeObject = new DomainObject.Types.Attribute
                    {
                        Key = attribute,
                        BoolValue = true
                    };
                    foreach (var domainObject in domainObjects)
                    {
                        if (domainObject.Attribute.Contains(attributeObject))
                            switch (domainObject.Type)
                            {
                                case DomainObject.Types.Type.Plain:
                                    ruleLines.Add(domainObject.Value);
                                    break;
                                case DomainObject.Types.Type.Regex:
                                    ruleLines.Add($"/{domainObject.Value}/");
                                    break;
                                case DomainObject.Types.Type.Domain:
                                    ruleLines.Add($"||{domainObject.Value}");
                                    break;
                                case DomainObject.Types.Type.Full:
                                    ruleLines.Add($"|http://{domainObject.Value}");
                                    ruleLines.Add($"|https://{domainObject.Value}");
                                    break;
                            }
                    }
                }
                else // no attribute
                    foreach (var domainObject in domainObjects)
                    {
                        switch (domainObject.Type)
                        {
                            case DomainObject.Types.Type.Plain:
                                ruleLines.Add(domainObject.Value);
                                break;
                            case DomainObject.Types.Type.Regex:
                                ruleLines.Add($"/{domainObject.Value}/");
                                break;
                            case DomainObject.Types.Type.Domain:
                                ruleLines.Add($"||{domainObject.Value}");
                                break;
                            case DomainObject.Types.Type.Full:
                                ruleLines.Add($"|http://{domainObject.Value}");
                                ruleLines.Add($"|https://{domainObject.Value}");
                                break;
                        }
                    }
            }
            return ruleLines;
        }

        /// <summary>
        /// Generates rules that match domains that should be connected directly without a proxy.
        /// </summary>
        /// <param name="groups">A list of source groups.</param>
        /// <returns>A list of rule lines.</returns>
        private static List<string> GenerateExceptionRules(List<string> groups)
            => GenerateBlockingRules(groups)
                .Select(r => $"@@{r}") // convert blocking rules to exception rules
                .ToList();
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/IPCService.cs
================================================
using System;
using System.IO.Pipes;
using System.Net;
using System.Text;

namespace Shadowsocks.Controller
{
    class RequestAddUrlEventArgs : EventArgs
    {
        public readonly string Url;

        public RequestAddUrlEventArgs(string url)
        {
            this.Url = url;
        }
    }

    internal class IPCService
    {
        private const int INT32_LEN = 4;
        private const int OP_OPEN_URL = 1;
        private static readonly string PIPE_PATH = $"Shadowsocks\\{Program.ExecutablePath.GetHashCode()}";

        public event EventHandler<RequestAddUrlEventArgs> OpenUrlRequested;

        public async void RunServer()
        {
            byte[] buf = new byte[4096];
            while (true)
            {
                using (NamedPipeServerStream stream = new NamedPipeServerStream(PIPE_PATH))
                {
                    await stream.WaitForConnectionAsync();
                    await stream.ReadAsync(buf, 0, INT32_LEN);
                    int opcode = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(buf, 0));
                    if (opcode == OP_OPEN_URL)
                    {
                        await stream.ReadAsync(buf, 0, INT32_LEN);
                        int strlen = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(buf, 0));

                        await stream.ReadAsync(buf, 0, strlen);
                        string url = Encoding.UTF8.GetString(buf, 0, strlen);

                        OpenUrlRequested?.Invoke(this, new RequestAddUrlEventArgs(url));
                    }
                    stream.Close();
                }
            }
        }

        private static (NamedPipeClientStream, bool) TryConnect()
        {
            NamedPipeClientStream pipe = new NamedPipeClientStream(PIPE_PATH);
            bool exist;
            try
            {
                pipe.Connect(10);
                exist = true;
            }
            catch (TimeoutException)
            {
                exist = false;
            }
            return (pipe, exist);
        }

        public static bool AnotherInstanceRunning()
        {
            (NamedPipeClientStream pipe, bool exist) = TryConnect();
            pipe.Dispose();
            return exist;
        }

        public static void RequestOpenUrl(string url)
        {
            (NamedPipeClientStream pipe, bool exist) = TryConnect();
            if(!exist) return;
            byte[] opAddUrl = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(OP_OPEN_URL));
            pipe.Write(opAddUrl, 0, INT32_LEN); // opcode addurl
            byte[] b = Encoding.UTF8.GetBytes(url);
            byte[] blen = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(b.Length));
            pipe.Write(blen, 0, INT32_LEN);
            pipe.Write(b, 0, b.Length);
            pipe.Close();
            pipe.Dispose();
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/Listener.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using NLog;
using Shadowsocks.Model;

namespace Shadowsocks.Controller
{
    public class Listener
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();

        public interface IService
        {
            bool Handle(byte[] firstPacket, int length, Socket socket, object state);

            void Stop();
        }

        public abstract class Service : IService
        {
            public abstract bool Handle(byte[] firstPacket, int length, Socket socket, object state);

            public virtual void Stop() { }
        }

        public class UDPState
        {
            public UDPState(Socket s)
            {
                socket = s;
                remoteEndPoint = new IPEndPoint(s.AddressFamily == AddressFamily.InterNetworkV6 ? IPAddress.IPv6Any : IPAddress.Any, 0);
            }
            public Socket socket;
            public byte[] buffer = new byte[4096];
            public EndPoint remoteEndPoint;
        }

        Configuration _config;
        bool _shareOverLAN;
        Socket _tcpSocket;
        Socket _udpSocket;
        List<IService> _services;

        public Listener(List<IService> services)
        {
            this._services = services;
        }

        private bool CheckIfPortInUse(int port)
        {
            IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties();
            return ipProperties.GetActiveTcpListeners().Any(endPoint => endPoint.Port == port);
        }

        public void Start(Configuration config)
        {
            this._config = config;
            this._shareOverLAN = config.shareOverLan;

            if (CheckIfPortInUse(_config.localPort))
                throw new Exception(I18N.GetString("Port {0} already in use", _config.localPort));

            try
            {
                // Create a TCP/IP socket.
                _tcpSocket = new Socket(config.isIPv6Enabled ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                _udpSocket = new Socket(config.isIPv6Enabled ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                _tcpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
                _udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
                IPEndPoint localEndPoint = null;
                localEndPoint = _shareOverLAN
                    ? new IPEndPoint(config.isIPv6Enabled ? IPAddress.IPv6Any : IPAddress.Any, _config.localPort)
                    : new IPEndPoint(config.isIPv6Enabled ? IPAddress.IPv6Loopback : IPAddress.Loopback, _config.localPort);

                // Bind the socket to the local endpoint and listen for incoming connections.
                _tcpSocket.Bind(localEndPoint);
                _udpSocket.Bind(localEndPoint);
                _tcpSocket.Listen(1024);

                // Start an asynchronous socket to listen for connections.
                logger.Info($"Shadowsocks started ({UpdateChecker.Version})");
                logger.Debug(Encryption.EncryptorFactory.DumpRegisteredEncryptor());
                _tcpSocket.BeginAccept(new AsyncCallback(AcceptCallback), _tcpSocket);
                UDPState udpState = new UDPState(_udpSocket);
                _udpSocket.BeginReceiveFrom(udpState.buffer, 0, udpState.buffer.Length, 0, ref udpState.remoteEndPoint, new AsyncCallback(RecvFromCallback), udpState);
            }
            catch (SocketException)
            {
                _tcpSocket.Close();
                throw;
            }
        }

        public void Stop()
        {
            if (_tcpSocket != null)
            {
                _tcpSocket.Close();
                _tcpSocket = null;
            }
            if (_udpSocket != null)
            {
                _udpSocket.Close();
                _udpSocket = null;
            }

            _services.ForEach(s => s.Stop());
        }

        public void RecvFromCallback(IAsyncResult ar)
        {
            UDPState state = (UDPState)ar.AsyncState;
            var socket = state.socket;
            try
            {
                int bytesRead = socket.EndReceiveFrom(ar, ref state.remoteEndPoint);
                foreach (IService service in _services)
                {
                    if (service.Handle(state.buffer, bytesRead, socket, state))
                    {
                        break;
                    }
                }
            }
            catch (ObjectDisposedException)
            {
            }
            catch (Exception ex)
            {
                logger.Debug(ex);
            }
            finally
            {
                try
                {
                    socket.BeginReceiveFrom(state.buffer, 0, state.buffer.Length, 0, ref state.remoteEndPoint, new AsyncCallback(RecvFromCallback), state);
                }
                catch (ObjectDisposedException)
                {
                    // do nothing
                }
                catch (Exception)
                {
                }
            }
        }

        public void AcceptCallback(IAsyncResult ar)
        {
            Socket listener = (Socket)ar.AsyncState;
            try
            {
                Socket conn = listener.EndAccept(ar);

                byte[] buf = new byte[4096];
                object[] state = new object[] {
                    conn,
                    buf
                };

                conn.BeginReceive(buf, 0, buf.Length, 0,
                    new AsyncCallback(ReceiveCallback), state);
            }
            catch (ObjectDisposedException)
            {
            }
            catch (Exception e)
            {
                logger.LogUsefulException(e);
            }
            finally
            {
                try
                {
                    listener.BeginAccept(
                        new AsyncCallback(AcceptCallback),
                        listener);
                }
                catch (ObjectDisposedException)
                {
                    // do nothing
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                }
            }
        }

        private void ReceiveCallback(IAsyncResult ar)
        {
            object[] state = (object[])ar.AsyncState;

            Socket conn = (Socket)state[0];
            byte[] buf = (byte[])state[1];
            try
            {
                int bytesRead = conn.EndReceive(ar);
                if (bytesRead <= 0) goto Shutdown;
                foreach (IService service in _services)
                {
                    if (service.Handle(buf, bytesRead, conn, null))
                    {
                        return;
                    }
                }
                Shutdown:
                // no service found for this
                if (conn.ProtocolType == ProtocolType.Tcp)
                {
                    conn.Close();
                }
            }
            catch (Exception e)
            {
                logger.LogUsefulException(e);
                conn.Close();
            }
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/OnlineConfigResolver.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Shadowsocks.Model;

namespace Shadowsocks.Controller.Service
{
    public class OnlineConfigResolver
    {
        public static async Task<List<Server>> GetOnline(string url)
        {
            var httpClient = Program.MainController.GetHttpClient();
            string server_json = await httpClient.GetStringAsync(url);
            var servers = server_json.GetServers();
            foreach (var server in servers)
            {
                server.group = url;
            }
            return servers.ToList();
        }
    }

    internal static class OnlineConfigResolverEx
    {
        private static readonly string[] BASIC_FORMAT = new[] { "server", "server_port", "password", "method" };

        private static readonly IEnumerable<Server> EMPTY_SERVERS = Array.Empty<Server>();

        internal static IEnumerable<Server> GetServers(this string json) =>
            JToken.Parse(json).SearchJToken().AsEnumerable();

        private static IEnumerable<Server> SearchJArray(JArray array) =>
            array == null ? EMPTY_SERVERS : array.SelectMany(SearchJToken).ToList();

        private static IEnumerable<Server> SearchJObject(JObject obj)
        {
            if (obj == null)
                return EMPTY_SERVERS;

            if (BASIC_FORMAT.All(field => obj.ContainsKey(field)))
                return new[] { obj.ToObject<Server>() };

            var servers = new List<Server>();
            foreach (var kv in obj)
            {
                var token = kv.Value;
                servers.AddRange(SearchJToken(token));
            }
            return servers;
        }

        private static IEnumerable<Server> SearchJToken(this JToken token)
        {
            switch (token.Type)
            {
                default:
                    return Array.Empty<Server>();
                case JTokenType.Object:
                    return SearchJObject(token as JObject);
                case JTokenType.Array:
                    return SearchJArray(token as JArray);
            }
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/PACDaemon.cs
================================================
using NLog;
using Shadowsocks.Model;
using Shadowsocks.Properties;
using Shadowsocks.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Shadowsocks.Controller
{

    /// <summary>
    /// Processing the PAC file content
    /// </summary>
    public class PACDaemon
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();

        public const string PAC_FILE = "pac.txt";
        public const string USER_RULE_FILE = "user-rule.txt";
        public const string USER_ABP_FILE = "abp.txt";
        private Configuration config;

        FileSystemWatcher PACFileWatcher;
        FileSystemWatcher UserRuleFileWatcher;

        public event EventHandler PACFileChanged;
        public event EventHandler UserRuleFileChanged;

        public PACDaemon(Configuration config)
        {
            this.config = config;
            TouchPACFile();
            TouchUserRuleFile();

            this.WatchPacFile();
            this.WatchUserRuleFile();
        }


        public string TouchPACFile()
        {
            if (!File.Exists(PAC_FILE))
            {
                GeositeUpdater.MergeAndWritePACFile(config.geositeDirectGroups, config.geositeProxiedGroups, config.geositePreferDirect);
            }
            return PAC_FILE;
        }

        internal string TouchUserRuleFile()
        {
            if (!File.Exists(USER_RULE_FILE))
            {
                File.WriteAllText(USER_RULE_FILE, Resources.user_rule);
            }
            return USER_RULE_FILE;
        }

        internal string GetPACContent()
        {
            if (!File.Exists(PAC_FILE))
            {
                GeositeUpdater.MergeAndWritePACFile(config.geositeDirectGroups, config.geositeProxiedGroups, config.geositePreferDirect);
            }
            return File.ReadAllText(PAC_FILE, Encoding.UTF8);
        }


        private void WatchPacFile()
        {
            PACFileWatcher?.Dispose();
            PACFileWatcher = new FileSystemWatcher(Program.WorkingDirectory);
            PACFileWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
            PACFileWatcher.Filter = PAC_FILE;
            PACFileWatcher.Changed += PACFileWatcher_Changed;
            PACFileWatcher.Created += PACFileWatcher_Changed;
            PACFileWatcher.Deleted += PACFileWatcher_Changed;
            PACFileWatcher.Renamed += PACFileWatcher_Changed;
            PACFileWatcher.EnableRaisingEvents = true;
        }

        private void WatchUserRuleFile()
        {
            UserRuleFileWatcher?.Dispose();
            UserRuleFileWatcher = new FileSystemWatcher(Program.WorkingDirectory);
            UserRuleFileWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
            UserRuleFileWatcher.Filter = USER_RULE_FILE;
            UserRuleFileWatcher.Changed += UserRuleFileWatcher_Changed;
            UserRuleFileWatcher.Created += UserRuleFileWatcher_Changed;
            UserRuleFileWatcher.Deleted += UserRuleFileWatcher_Changed;
            UserRuleFileWatcher.Renamed += UserRuleFileWatcher_Changed;
            UserRuleFileWatcher.EnableRaisingEvents = true;
        }

        #region FileSystemWatcher.OnChanged()
        // FileSystemWatcher Changed event is raised twice
        // http://stackoverflow.com/questions/1764809/filesystemwatcher-changed-event-is-raised-twice
        // Add a short delay to avoid raise event twice in a short period
        private void PACFileWatcher_Changed(object sender, FileSystemEventArgs e)
        {
            if (PACFileChanged != null)
            {
                logger.Info($"Detected: PAC file '{e.Name}' was {e.ChangeType.ToString().ToLower()}.");
                Task.Factory.StartNew(() =>
                {
                    ((FileSystemWatcher)sender).EnableRaisingEvents = false;
                    System.Threading.Thread.Sleep(10);
                    PACFileChanged(this, new EventArgs());
                    ((FileSystemWatcher)sender).EnableRaisingEvents = true;
                });
            }
        }

        private void UserRuleFileWatcher_Changed(object sender, FileSystemEventArgs e)
        {
            if (UserRuleFileChanged != null)
            {
                logger.Info($"Detected: User Rule file '{e.Name}' was {e.ChangeType.ToString().ToLower()}.");
                Task.Factory.StartNew(() =>
                {
                    ((FileSystemWatcher)sender).EnableRaisingEvents = false;
                    System.Threading.Thread.Sleep(10);
                    UserRuleFileChanged(this, new EventArgs());
                    ((FileSystemWatcher)sender).EnableRaisingEvents = true;
                });
            }
        }
        #endregion
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/PACServer.cs
================================================
using Shadowsocks.Encryption;
using Shadowsocks.Model;
using Shadowsocks.Util;
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Web;
using NLog;

namespace Shadowsocks.Controller
{
    public class PACServer : Listener.Service
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();

        public const string RESOURCE_NAME = "pac";

        private string PacSecret
        {
            get
            {
                if (string.IsNullOrEmpty(_cachedPacSecret))
                {
                    var rd = new byte[32];
                    RNG.GetBytes(rd);
                    _cachedPacSecret = HttpServerUtility.UrlTokenEncode(rd);
                }
                return _cachedPacSecret;
            }
        }
        private string _cachedPacSecret = "";
        public string PacUrl { get; private set; } = "";

        private Configuration _config;
        private PACDaemon _pacDaemon;

        public PACServer(PACDaemon pacDaemon)
        {
            _pacDaemon = pacDaemon;
        }

        public void UpdatePACURL(Configuration config)
        {
            _config = config;
            string usedSecret = _config.secureLocalPac ? $"&secret={PacSecret}" : "";
            string contentHash = GetHash(_pacDaemon.GetPACContent());
            PacUrl = $"http://{config.LocalHost}:{config.localPort}/{RESOURCE_NAME}?hash={contentHash}{usedSecret}";
            logger.Debug("Set PAC URL:" + PacUrl);
        }

        private static string GetHash(string content)
        {
            return HttpServerUtility.UrlTokenEncode(MbedTLS.MD5(Encoding.ASCII.GetBytes(content)));
        }

        public override bool Handle(byte[] firstPacket, int length, Socket socket, object state)
        {
            if (socket.ProtocolType != ProtocolType.Tcp)
            {
                return false;
            }

            try
            {
                /*
                 *  RFC 7230
                 *  
                    GET /hello.txt HTTP/1.1
                    User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
                    Host: www.example.com
                    Accept-Language: en, mi 
                 */

                string request = Encoding.UTF8.GetString(firstPacket, 0, length);
                string[] lines = request.Split('\r', '\n');
                bool hostMatch = false, pathMatch = false, useSocks = false;
                bool secretMatch = !_config.secureLocalPac;

                if (lines.Length < 2)   // need at lease RequestLine + Host
                {
                    return false;
                }

                // parse request line
                string requestLine = lines[0];
                // GET /pac?t=yyyyMMddHHmmssfff&secret=foobar HTTP/1.1
                string[] requestItems = requestLine.Split(' ');
                if (requestItems.Length == 3 && requestItems[0] == "GET")
                {
                    int index = requestItems[1].IndexOf('?');
                    if (index < 0)
                    {
                        index = requestItems[1].Length;
                    }
                    string resourceString = requestItems[1].Substring(0, index).Remove(0, 1);
                    if (string.Equals(resourceString, RESOURCE_NAME, StringComparison.OrdinalIgnoreCase))
                    {
                        pathMatch = true;
                        if (!secretMatch)
                        {
                            string queryString = requestItems[1].Substring(index);
                            if (queryString.Contains(PacSecret))
                            {
                                secretMatch = true;
                            }
                        }
                    }
                }

                // parse request header
                for (int i = 1; i < lines.Length; i++)
                {
                    if (string.IsNullOrEmpty(lines[i]))
                        continue;

                    string[] kv = lines[i].Split(new char[] { ':' }, 2);
                    if (kv.Length == 2)
                    {
                        if (kv[0] == "Host")
                        {
                            if (kv[1].Trim() == ((IPEndPoint)socket.LocalEndPoint).ToString())
                            {
                                hostMatch = true;
                            }
                        }
                        //else if (kv[0] == "User-Agent")
                        //{
                        //    // we need to drop connections when changing servers
                        //    if (kv[1].IndexOf("Chrome") >= 0)
                        //    {
                        //        useSocks = true;
                        //    }
                        //}
                    }
                }

                if (hostMatch && pathMatch)
                {
                    if (!secretMatch)
                    {
                        socket.Close(); // Close immediately
                    }
                    else
                    {
                        SendResponse(socket, useSocks);
                    }
                    return true;
                }
                return false;
            }
            catch (ArgumentException)
            {
                return false;
            }
        }



        public void SendResponse(Socket socket, bool useSocks)
        {
            try
            {
                IPEndPoint localEndPoint = (IPEndPoint)socket.LocalEndPoint;

                string proxy = GetPACAddress(localEndPoint, useSocks);

                string pacContent = $"var __PROXY__ = '{proxy}';\n" + _pacDaemon.GetPACContent();
                string responseHead =
$@"HTTP/1.1 200 OK
Server: ShadowsocksWindows/{UpdateChecker.Version}
Content-Type: application/x-ns-proxy-autoconfig
Content-Length: { Encoding.UTF8.GetBytes(pacContent).Length}
Connection: Close

";
                byte[] response = Encoding.UTF8.GetBytes(responseHead + pacContent);
                socket.BeginSend(response, 0, response.Length, 0, new AsyncCallback(SendCallback), socket);
            }
            catch (Exception e)
            {
                logger.LogUsefulException(e);
                socket.Close();
            }
        }

        private void SendCallback(IAsyncResult ar)
        {
            Socket conn = (Socket)ar.AsyncState;
            try
            {
                conn.Shutdown(SocketShutdown.Send);
            }
            catch
            { }
        }


        private string GetPACAddress(IPEndPoint localEndPoint, bool useSocks)
        {
            return localEndPoint.AddressFamily == AddressFamily.InterNetworkV6
                ? $"{(useSocks ? "SOCKS5" : "PROXY")} [{localEndPoint.Address}]:{_config.localPort};"
                : $"{(useSocks ? "SOCKS5" : "PROXY")} {localEndPoint.Address}:{_config.localPort};";
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/PortForwarder.cs
================================================
using System;
using System.Net;
using System.Net.Sockets;
using NLog;
using Shadowsocks.Util.Sockets;

namespace Shadowsocks.Controller
{
    class PortForwarder : Listener.Service
    {
        private readonly int _targetPort;

        public PortForwarder(int targetPort)
        {
            _targetPort = targetPort;
        }

        public override bool Handle(byte[] firstPacket, int length, Socket socket, object state)
        {
            if (socket.ProtocolType != ProtocolType.Tcp)
            {
                return false;
            }
            new Handler().Start(firstPacket, length, socket, _targetPort);
            return true;
        }

        private class Handler
        {
            private static Logger logger = LogManager.GetCurrentClassLogger();

            private byte[] _firstPacket;
            private int _firstPacketLength;
            private Socket _local;
            private WrappedSocket _remote;
            private bool _closed = false;
            private bool _localShutdown = false;
            private bool _remoteShutdown = false;
            private const int RecvSize = 2048;
            // remote receive buffer
            private byte[] remoteRecvBuffer = new byte[RecvSize];
            // connection receive buffer
            private byte[] connetionRecvBuffer = new byte[RecvSize];

            // instance-based lock
            private readonly object _Lock = new object();

            public void Start(byte[] firstPacket, int length, Socket socket, int targetPort)
            {
                _firstPacket = firstPacket;
                _firstPacketLength = length;
                _local = socket;
                try
                {
                    // Local Port Forward use IP as is
                    EndPoint remoteEP = SocketUtil.GetEndPoint(_local.AddressFamily == AddressFamily.InterNetworkV6 ? "[::1]" : "127.0.0.1", targetPort);

                    // Connect to the remote endpoint.
                    _remote = new WrappedSocket();
                    _remote.BeginConnect(remoteEP, ConnectCallback, null);
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }

            private void ConnectCallback(IAsyncResult ar)
            {
                if (_closed)
                {
                    return;
                }
                try
                {
                    _remote.EndConnect(ar);
                    _remote.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
                    HandshakeReceive();
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }

            private void HandshakeReceive()
            {
                if (_closed)
                {
                    return;
                }
                try
                {
                    _remote.BeginSend(_firstPacket, 0, _firstPacketLength, 0, StartPipe, null);
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }

            private void StartPipe(IAsyncResult ar)
            {
                if (_closed)
                {
                    return;
                }
                try
                {
                    _remote.EndSend(ar);
                    _remote.BeginReceive(remoteRecvBuffer, 0, RecvSize, 0,
                        PipeRemoteReceiveCallback, null);
                    _local.BeginReceive(connetionRecvBuffer, 0, RecvSize, 0,
                        PipeConnectionReceiveCallback, null);
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }

            private void PipeRemoteReceiveCallback(IAsyncResult ar)
            {
                if (_closed)
                {
                    return;
                }
                try
                {
                    int bytesRead = _remote.EndReceive(ar);
                    if (bytesRead > 0)
                    {
                        _local.BeginSend(remoteRecvBuffer, 0, bytesRead, 0, PipeConnectionSendCallback, null);
                    }
                    else
                    {
                        _local.Shutdown(SocketShutdown.Send);
                        _localShutdown = true;
                        CheckClose();
                    }
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }

            private void PipeConnectionReceiveCallback(IAsyncResult ar)
            {
                if (_closed)
                {
                    return;
                }
                try
                {
                    int bytesRead = _local.EndReceive(ar);
                    if (bytesRead > 0)
                    {
                        _remote.BeginSend(connetionRecvBuffer, 0, bytesRead, 0, PipeRemoteSendCallback, null);
                    }
                    else
                    {
                        _remote.Shutdown(SocketShutdown.Send);
                        _remoteShutdown = true;
                        CheckClose();
                    }
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }

            private void PipeRemoteSendCallback(IAsyncResult ar)
            {
                if (_closed)
                {
                    return;
                }
                try
                {
                    _remote.EndSend(ar);
                    _local.BeginReceive(connetionRecvBuffer, 0, RecvSize, 0,
                        PipeConnectionReceiveCallback, null);
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }

            private void PipeConnectionSendCallback(IAsyncResult ar)
            {
                if (_closed)
                {
                    return;
                }
                try
                {
                    _local.EndSend(ar);
                    _remote.BeginReceive(remoteRecvBuffer, 0, RecvSize, 0,
                        PipeRemoteReceiveCallback, null);
                }
                catch (Exception e)
                {
                    logger.LogUsefulException(e);
                    Close();
                }
            }

            private void CheckClose()
            {
                if (_localShutdown && _remoteShutdown)
                {
                    Close();
                }
            }

            public void Close()
            {
                lock (_Lock)
                {
                    if (_closed)
                    {
                        return;
                    }
                    _closed = true;
                }
                if (_local != null)
                {
                    try
                    {
                        _local.Shutdown(SocketShutdown.Both);
                        _local.Close();
                    }
                    catch (Exception e)
                    {
                        logger.LogUsefulException(e);
                    }
                }
                if (_remote != null)
                {
                    try
                    {
                        _remote.Shutdown(SocketShutdown.Both);
                        _remote.Dispose();
                    }
                    catch (SocketException e)
                    {
                        logger.LogUsefulException(e);
                    }
                }
            }
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs
================================================
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Windows.Forms;
using NLog;
using Shadowsocks.Model;
using Shadowsocks.Properties;
using Shadowsocks.Util;
using Shadowsocks.Util.ProcessManagement;

namespace Shadowsocks.Controller
{
    class PrivoxyRunner
    {
        private static Logger logger = LogManager.GetCurrentClassLogger();

        private static int _uid;
        private static string _uniqueConfigFile;
        private static Job _privoxyJob;
        private Process _process;
        private int _runningPort;

        static PrivoxyRunner()
        {
            try
            {
                _uid = Program.WorkingDirectory.GetHashCode(); // Currently we use ss's StartupPath to identify different Privoxy instance.
                _uniqueConfigFile = $"privoxy_{_uid}.conf";
                _privoxyJob = new Job();

                FileManager.UncompressFile(Utils.GetTempPath("ss_privoxy.exe"), Resources.privoxy_exe);
            }
            catch (IOException e)
            {
                logger.LogUsefulException(e);
            }
        }

        public int RunningPort => _runningPort;

        public void Start(Configuration configuration)
        {
            if (_process == null)
            {
                Process[] existingPrivoxy = Process.GetProcessesByName("ss_privoxy");
                foreach (Process p in existingPrivoxy.Where(IsChildProcess))
                {
                    KillProcess(p);
                }
                string privoxyConfig = Resources.privoxy_conf;
                _runningPort = GetFreePort(configuration.isIPv6Enabled);
                privoxyConfig = privoxyConfig.Replace("__SOCKS_PORT__", configuration.localPort.ToString());
                privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_PORT__", _runningPort.ToString());
                privoxyConfig = configuration.isIPv6Enabled
                    ? privoxyConfig.Replace("__PRIVOXY_BIND_IP__", configuration.shareOverLan ? "[::]" : "[::1]")
                    .Replace("__SOCKS_HOST__", "[::1]")
                    : privoxyConfig.Replace("__PRIVOXY_BIND_IP__", configuration.shareOverLan ? "0.0.0.0" : "127.0.0.1")
                    .Replace("__SOCKS_HOST__", "127.0.0.1");
                FileManager.ByteArrayToFile(Utils.GetTempPath(_uniqueConfigFile), Encoding.UTF8.GetBytes(privoxyConfig));

                _process = new Process
                {
                    // Configure the process using the StartInfo properties.
                    StartInfo =
                    {
                        FileName = "ss_privoxy.exe",
                        Arguments = _uniqueConfigFile,
                        WorkingDirectory = Utils.GetTempPath(),
                        WindowStyle = ProcessWindowStyle.Hidden,
                        UseShellExecute = true,
                        CreateNoWindow = true
                    }
                };
                _process.Start();

                /*
                 * Add this process to job obj associated with this ss process, so that
                 * when ss exit unexpectedly, this process will be forced killed by system.
                 */
                _privoxyJob.AddProcess(_process.Handle);
            }
        }

        public void Stop()
        {
            if (_process != null)
            {
                KillProcess(_process);
                _process.Dispose();
                _process = null;
            }
        }

        private static void KillProcess(Process p)
        {
            try
            {
                p.CloseMainWindow();
                p.WaitForExit(100);
                if (!p.HasExited)
                {
                    p.Kill();
                    p.WaitForExit();
                }
            }
            catch (Exception e)
            {
                logger.LogUsefulException(e);
            }
        }

        /*
         * We won't like to kill other ss instances' ss_privoxy.exe.
         * This function will check whether the given process is created
         * by this process by checking the module path or command line.
         * 
         * Since it's required to put ss in different dirs to run muti instances,
         * different instance will create their unique "privoxy_UID.conf" where
         * UID is hash of ss's location.
         */

        private static bool IsChildProcess(Process process)
        {
            try
            {
                /*
                 * Under PortableMode, we could identify it by the path of ss_privoxy.exe.
                 */
                var path = process.MainModule.FileName;

                return Utils.GetTempPath("ss_privoxy.exe").Equals(path);

            }
            catch (Exception ex)
            {
                /*
                 * Sometimes Process.GetProcessesByName will return some processes that
                 * are already dead, and that will cause exceptions here.
                 * We could simply ignore those exceptions.
                 */
                logger.LogUsefulException(ex);
                return false;
            }
        }

        private int GetFreePort(bool isIPv6 = false)
        {
            int defaultPort = 8123;
            try
            {
                // TCP stack please do me a favor
                TcpListener l = new TcpListener(isIPv6 ? IPAddress.IPv6Loopback : IPAddress.Loopback, 0);
                l.Start();
                var port = ((IPEndPoint)l.LocalEndpoint).Port;
                l.Stop();
                return port;
            }
            catch (Exception e)
            {
                // in case access denied
                logger.LogUsefulException(e);
                return defaultPort;
            }
        }
    }
}


================================================
FILE: shadowsocks-csharp/Controller/Service/Sip003Plugin.cs
================================================
using System;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using Shadowsocks.Model;
using Shadowsocks.Util.ProcessManagement;

namespace Shadowsocks.Controller.Service
{
    // https://github.com/shadowsocks/shadowsocks-org/wiki/Plugin
    public sealed class Sip003Plugin : IDisposable
    {
        public IPEndPoint LocalEndPoint { get; private set; }
        public int ProcessId => _started ? _pluginProcess.Id : 0;

        private readonly object _startProcessLock = new object();
        private readonly Job _pluginJob;
        private readonly Process _pluginProcess;
        private bool _started;
        private bool _disposed;

        public static Sip003Plugin CreateIfConfigured(Server server, bool showPluginOutput)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            if (string.IsNullOrWhiteSpace(server.plugin))
            {
                return null;
            }

            return new Sip003Plugin(
                server.plugin,
                server.plugin_opts,
                server.plugin_args,
                server.server,
                server.server_port,
                showPluginOutput);
        }

        private Sip003Plugin(string plugin, string pluginOpts, string pluginArgs, string serverAddress, int serverPort, bool showPluginOutput)
        {
            if (plugin == null) throw new ArgumentNullException(nameof(plugin));
            if (string.IsNullOrWhiteSpace(serverAddress))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(serverAddress));
            }
            if (serverPort <= 0 || serverPort > 65535)
            {
                throw new ArgumentOutOfRangeException("serverPort");
            }

            _pluginProcess = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName = plugin,
                    Arguments = pluginArgs,
                    UseShellExecute = false,
                    CreateNoWindow = !showPluginOutput,
                    ErrorDialog = false,
                    WindowStyle = ProcessWindowStyle.Hidden,
                    WorkingDirectory = Program.WorkingDirectory ?? Environment.CurrentDirectory,
                    Environment =
                    {
                        ["SS_REMOTE_HOST"] = serverAddress,
                        ["SS_REMOTE_PORT"] = serverPort.ToString(),
                        ["SS_PLUGIN_OPTIONS"] = pluginOpts
                    }
                }
            };

            _pluginJob = new Job();
        }

        public bool StartIfNeeded()
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            lock (_startProcessLock)
            {
                if (_started && !_pluginProcess.HasExited)
                {
                    return false;
                }

                var localPort = GetNextFreeTcpPort();
                LocalEndPoint = new IPEndPoint(IPAddress.Loopback, localPort);

                _pluginProcess.StartInfo.Environment["SS_LOCAL_HOST"] = LocalEndPoint.Address.ToString();
                _pluginProcess.StartInfo.Environment["SS_LOCAL_PORT"] = LocalEndPoint.Port.ToString();
                _pluginProcess.StartInfo.Arguments = ExpandEnvironmentVariables(_pluginProcess.StartInfo.Arguments, _pluginProcess.StartInfo.EnvironmentVariables);
                try
                {
                    _pluginProcess.Start();
                }
                catch (System.ComponentModel.Win32Exception ex)
                {
                    // do not use File.Exists(...), it can not handle the scenarios when the plugin file is in system environment path.
                    // https://docs.microsoft.com/en-us/windows/win32/seccrypto/common-hresult-values
                    //if ((uint)ex.ErrorCode == 0x80004005)
                    //  https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d
                    if (ex.NativeErrorCode == 0x00000002)
                    {
                        throw new FileNotFoundException(I18N.GetString("Cannot find the plugin program file"), _pluginProcess.StartInfo.FileName, ex);
                    }
                    throw new ApplicationException(I18N.GetString("Plugin Program"), ex);
                }
                _pluginJob.AddProcess(_pluginProcess.Handle);
                _started = true;
            }

            return true;
        }

        public string ExpandEnvironmentVariables(string name, StringDictionary environmentVariables = null)
        {
            // Expand the environment variables from the new process itself
            if (environmentVariables != null)
            {
                foreach(string key in environmentVariables.Keys)
                {
                    name = name.Replace($"%{key}%", environmentVariables[key]);
                }
            }
            // Also expand the environment variables from current main process (system)
            name = Environment.ExpandEnvironmentVariables(name);
            return name;
        }

        static int GetNextFreeTcpPort()
        {
            var l = new TcpListener(IPAddress.Loopback, 0);
            l.Start();
            int port = ((IPEndPoint)l.LocalEndpoint).Port;
            l.Stop();
            return port;
        }

        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            try
            {
                if (!_pluginProcess.HasExited)
                {
                    _pluginProcess.Kill();
                    _pluginProcess.WaitForExit();
                }
            }
            catch (Exception) { }
            finally
            {
                try
                {
                    _pluginProcess.Dispose();
                    _pluginJob.Dispose();
                }
                catch (Exception) { }

                _disposed = true;
            }
        }
    }
}

================================================
FILE: shadowsocks-csharp/Controller/Service/TCPRelay.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Timers;

using NLog;

using Shadowsocks.Controller.Strategy;
using Shadowsocks.Encryption;
using Shadowsocks.Encryption.AEAD;
using Shadowsocks.Encryption.Exception;
using Shadowsocks.Model;
using Shadowsocks.Proxy;
using Shadowsocks.Util.Sockets;

using static Shadowsocks.Encryption.EncryptorBase;

namespace Shadowsocks.Controller
{
    internal class TCPRelay : Listener.Service
    {
        public event EventHandler<SSTCPConnectedEventArgs> OnConnected;
        public event EventHandler<SSTransmitEventArgs> OnInbound;
        public event EventHandler<SSTransmitEventArgs> OnOutbound;
        public event EventHandler<SSRelayEventArgs> OnFailed;

        private static readonly Logger logger = LogManager.GetCurrentClassLogger();
        private readonly ShadowsocksController _controller;
        private DateTime _lastSweepTime;
        private readonly Configuration _config;

        public ISet<TCPHandler> Handlers { get; set; }

        public TCPRelay(ShadowsocksController controller, Configuration conf)
        {
            _controller = controller;
            _config = conf;
            Handlers = new HashSet<TCPHandler>();
            _lastSweepTime = DateTime.Now;
        }

        public override bool Handle(byte[] firstPacket, int length, Socket socket, object state)
        {
            if (socket.ProtocolType != ProtocolType.Tcp
                || (length < 2 || firstPacket[0] != 5))
            {
                return false;
            }

            socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
            TCPHandler handler = new TCPHandler(_controller, _config, socket);

            handler.OnConnected += OnConnected;
            handler.OnInbound += OnInbound;
            handler.OnOutbound += OnOutbound;
            handler.OnFailed += OnFailed;
            handler.OnClosed += (h, arg) =>
            {
                lock (Handlers)
                {
                    Handlers.Remove(handler);
                }
            };

            IList<TCPHandler> handlersToClose = new List<TCPHandler>();
            lock (Handlers)
            {
                Handlers.Add(handler);
                DateTime now = DateTime.Now;
                if (now - _lastSweepTime > TimeSpan.FromSeconds(1))
                {
                    _lastSweepTime = now;
                    foreach (TCPHandler handler1 in Handlers)
                    {
                        if (now - handler1.lastActivity > TimeSpan.FromSeconds(900))
                        {
                            handlersToClose.Add(handler1);
                        }
                    }
                }
            }
            foreach (TCPHandler handler1 in handlersToClose)
            {
                logger.Debug("Closing timed out TCP connection.");
                handler1.Close();
            }

            /*
             * Start after we put it into Handlers set. Otherwise if it failed in handler.Start()
             * then it will call handler.Close() before we add it into the set.
             * Then the handler will never release until the next Handle call. Sometimes it will
             * cause odd problems (especially during memory profiling).
             */
            handler.Start(firstPacket, length);

            return true;
        }

        public override void Stop()
        {
            List<TCPHandler> handlersToClose = new List<TCPHandler>();
            lock (Handlers)
            {
                handlersToClose.AddRange(Handlers);
            }
            handlersToClose.ForEach(h => h.Close());
        }
    }

    public class SSRelayEventArgs : EventArgs
    {
        public readonly Server server;

        public SSRelayEventArgs(Server server)
        {
            this.server = server;
        }
    }

    public class SSTransmitEventArgs : SSRelayEventArgs
    {
        public readonly long length;
        public SSTransmitEventArgs(Server server, long length) : base(server)
        {
            this.length = length;
        }
    }

    public class SSTCPConnectedEventArgs : SSRelayEventArgs
    {
        public readonly TimeSpan latency;

        public SSTCPConnectedEventArgs(Server server, TimeSpan latency) : base(server)
        {
            this.latency = latency;
        }
    }

    internal class TCPHandler
    {
        public event EventHandler<SSTCPConnectedEventArgs> OnConnected;
        public event EventHandler<SSTransmitEventArgs> OnInbound;
        public event EventHandler<SSTransmitEventArgs> OnOutbound;
        public event EventHandler<SSRelayEventArgs> OnClosed;
        public event EventHandler<SSRelayEventArgs> OnFailed;

        private class AsyncSession
        {
            public IProxy Remote { get; }

            public AsyncSession(IProxy remote)
            {
                Remote = remote;
            }
        }

        private class AsyncSession<T> : AsyncSession
        {
            public T State { get; set; }

            public AsyncSession(IProxy remote, T state) : base(remote)
            {
                State = state;
            }

            public AsyncSession(AsyncSession session, T state) : base(session.Remote)
            {
                State = state;
            }
        }

        private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

        private readonly int _serverTimeout;
        private readonly int _proxyTimeout;

        // each recv size.
        public const int RecvSize = 2048;

        // overhead of one chunk, reserved for AEAD ciphers
        public const int ChunkOverheadSize = 16 * 2 /* two tags */ + AEADEncryptor.CHUNK_LEN_BYTES;

        // max chunk size
        public const uint MaxChunkSize = AEADEncryptor.CHUNK_LEN_MASK + AEADEncryptor.CHUNK_LEN_BYTES + 16 * 2;

        // In general, the ciphertext length, we should take overhead into account
        public const int BufferSize = RecvSize + (int)MaxChunkSize + 32 /* max salt len */;

        public DateTime lastActivity;

        private readonly ShadowsocksController _controller;
        private readonly ForwardProxyConfig _config;
        private readonly Socket _connection;

        private IEncryptor _encryptor;
        private Server _server;

        private AsyncSession _currentRemoteSession;

        private bool _proxyConnected;
        private bool _destConnected;

        private byte _command;
        private byte[] _firstPacket;
        private int _firstPacketLength;

        private const int CMD_CONNECT = 0x01;
        private const int CMD_BIND = 0x02;
        private const int CMD_UDP_ASSOC = 0x03;

        private int _addrBufLength = -1;

        private int _totalRead = 0;
        private int _totalWrite = 0;

        // remote -> local proxy (ciphertext, before decrypt)
        private readonly byte[] _remoteRecvBuffer = new byte[BufferSize];

        // client -> local proxy (plaintext, before encrypt)
        private readonly byte[] _connetionRecvBuffer = new byte[BufferSize];

        // local proxy -> remote (plaintext, after decrypt)
        private readonly byte[] _remoteSendBuffer = new byte[BufferSize];

        // local proxy -> client (ciphertext, before decrypt)
        private readonly byte[] _connetionSendBuffer = new byte[BufferSize];

        private bool _connectionShutdown = false;
        private bool _remoteShutdown = false;
        private bool _closed = false;

        // instance-based lock without static
        private readonly object _encryptionLock = new object();

        private readonly object _decryptionLock = new object();
        private readonly object _closeConnLock = new object();

        private DateTime _startConnectTime;
        private DateTime _startReceivingTime;
        private DateTime _startSendingTime;

        private EndPoint _destEndPoint = null;

        // TODO: decouple controller
        public TCPHandler(ShadowsocksController controller, Configuration config, Socket socket)
        {
            _controller = controller;
            _config = config.proxy;
            _connection = socket;
            _proxyTimeout = config.proxy.proxyTimeout * 1000;
            _serverTimeout = config.GetCurrentServer().timeout * 1000;

            lastActivity = DateTime.Now;
        }

        public void CreateRemote()
        {
            Server server = _controller.GetAServer(IStrategyCallerType.TCP, (IPEndPoint)_connection.RemoteEndPoint,
                _destEndPoint);
            if (server == null || server.server == "")
            {
                throw new ArgumentException("No server configured");
            }

            _encryptor = EncryptorFactory.GetEncryptor(server.method, server.password);

            _server = server;

            /* prepare address buffer length for AEAD */
            Logger.Trace($"_addrBufLength={_addrBufLength}");
            _encryptor.AddrBufLength = _addrBufLength;
        }

        public void Start(byte[] firstPacket, int length)
        {
            _firstPacket = firstPacket;
            _firstPacketLength = length;
            HandshakeReceive();
        }

        private void CheckClose()
        {
            if (_connectionShutdown && _remoteShutdown)
            {
                Close();
            }
        }

        private void ErrorClose(Exception e)
        {
            Logger.LogUsefulException(e);
            Close();
        }

        public void Close()
        {
            lock (_closeConnLock)
            {
                if (_closed)
                {
                    return;
                }

                _closed = true;
            }

            OnClosed?.Invoke(this, new SSRelayEventArgs(_server));

            try
            {
                _connection.Shutdown(SocketShutdown.Both);
                _connection.Close();
            }
            catch (Exception e)
            {
                Logger.LogUsefulException(e);
            }

            if (_currentRemoteSession != null)
            {
                try
                {
                    IProxy remote = _currentRemoteSession.Remote;
                    remote.Shutdown(SocketShutdown.Both);
                    remote.Close();
                }
                catch (Exception e)
                {
                    Logger.LogUsefulException(e);
                }
            }

            lock (_encryptionLock)
            {
                lock (_decryptionLock)
                {
                    _encryptor?.Dispose();
                }
            }
        }

        private void HandshakeReceive()
        {
            if (_closed)
            {
                return;
            }

            try
            {
                int bytesRead = _firstPacketLength;
                if (bytesRead > 1)
                {
                    byte[] response = { 5, 0 };
                    if (_firstPacket[0] != 5)
                    {
                        // reject socks 4
                        response = new byte[] { 0, 91 };
                        Logger.Error("socks 5 protocol error");
                    }
                    _connection.BeginSend(response, 0, response.Length, SocketFlags.None,
                        HandshakeSendCallback, null);
                }
                else
                {
                    Close();
                }
            }
            catch (Exception e)
            {
                ErrorClose(e);
            }
        }

        private void HandshakeSendCallback(IAsyncResult ar)
        {
            if (_closed)
            {
                return;
            }

            try
            {
                _connection.EndSend(ar);

                // +-----+-----+-------+------+----------+----------+
                // | VER | CMD |  RSV  | ATYP | DST.ADDR | DST.PORT |
                // +-----+-----+-------+------+----------+----------+
                // |  1  |  1  | X'00' |  1   | Variable |    2     |
                // +-----+-----+-------+------+----------+----------+
                // Skip first 3 bytes, and read 2 more bytes to analysis the address.
                // 2 more bytes is designed if address is domain then we don't need to read once more to get the addr length.
                // validate is unnecessary, we did it in first packet, but we can do it in future version
                _connection.BeginReceive(_connetionRecvBuffer, 0, 3 + ADDR_ATYP_LEN + 1, SocketFlags.None,
                    AddressReceiveCallback, null);
            }
            catch (Exception e)
            {
                ErrorClose(e);
            }
        }

        private void AddressReceiveCallback(IAsyncResult ar)
        {
            if (_closed)
            {
                return;
            }

            try
            {
                int bytesRead = _connection.EndReceive(ar);
                if (bytesRead >= 5)
                {
                    _command = _connetionRecvBuffer[1];
                    swit
Download .txt
gitextract_s4mmpmuw/

├── .gitattributes
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report_en.md
│   │   ├── bug_report_zh.md
│   │   └── feature_request.md
│   └── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── CHANGES
├── CONTRIBUTING.md
├── LICENSE.txt
├── OPENSSL-GUIDE
├── README.md
├── appveyor.yml
├── appveyor.yml.obsolete
├── appveyor.yml.sample
├── packaging/
│   └── upload.sh
├── shadowsocks-csharp/
│   ├── CommandLineOption.cs
│   ├── Controller/
│   │   ├── FileManager.cs
│   │   ├── HotkeyReg.cs
│   │   ├── I18N.cs
│   │   ├── LoggerExtension.cs
│   │   ├── Service/
│   │   │   ├── GeositeUpdater.cs
│   │   │   ├── IPCService.cs
│   │   │   ├── Listener.cs
│   │   │   ├── OnlineConfigResolver.cs
│   │   │   ├── PACDaemon.cs
│   │   │   ├── PACServer.cs
│   │   │   ├── PortForwarder.cs
│   │   │   ├── PrivoxyRunner.cs
│   │   │   ├── Sip003Plugin.cs
│   │   │   ├── TCPRelay.cs
│   │   │   ├── UDPRelay.cs
│   │   │   └── UpdateChecker.cs
│   │   ├── ShadowsocksController.cs
│   │   ├── Strategy/
│   │   │   ├── BalancingStrategy.cs
│   │   │   ├── HighAvailabilityStrategy.cs
│   │   │   ├── IStrategy.cs
│   │   │   └── StrategyManager.cs
│   │   └── System/
│   │       ├── AutoStartup.cs
│   │       ├── Hotkeys/
│   │       │   ├── HotkeyCallbacks.cs
│   │       │   └── Hotkeys.cs
│   │       ├── ProtocolHandler.cs
│   │       └── SystemProxy.cs
│   ├── Data/
│   │   ├── NLog.config
│   │   ├── abp.js
│   │   ├── i18n.csv
│   │   ├── privoxy_conf.txt
│   │   └── user-rule.txt
│   ├── Encryption/
│   │   ├── AEAD/
│   │   │   ├── AEADEncryptor.cs
│   │   │   ├── AEADMbedTLSEncryptor.cs
│   │   │   ├── AEADOpenSSLEncryptor.cs
│   │   │   └── AEADSodiumEncryptor.cs
│   │   ├── CircularBuffer/
│   │   │   └── ByteCircularBuffer.cs
│   │   ├── EncryptorBase.cs
│   │   ├── EncryptorFactory.cs
│   │   ├── Exception/
│   │   │   └── CryptoException.cs
│   │   ├── IEncryptor.cs
│   │   ├── MbedTLS.cs
│   │   ├── OpenSSL.cs
│   │   ├── RNG.cs
│   │   ├── Sodium.cs
│   │   └── Stream/
│   │       └── PlainEncryptor.cs
│   ├── FodyWeavers.xml
│   ├── FodyWeavers.xsd
│   ├── Localization/
│   │   ├── LocalizationProvider.cs
│   │   ├── Strings.Designer.cs
│   │   ├── Strings.fr.resx
│   │   ├── Strings.ja.resx
│   │   ├── Strings.ko.resx
│   │   ├── Strings.resx
│   │   ├── Strings.ru.resx
│   │   ├── Strings.zh-Hans.resx
│   │   └── Strings.zh-Hant.resx
│   ├── Model/
│   │   ├── Configuration.cs
│   │   ├── ForwardProxyConfig.cs
│   │   ├── Geosite/
│   │   │   ├── Geosite.cs
│   │   │   └── geosite.proto
│   │   ├── HotKeyConfig.cs
│   │   ├── LogViewerConfig.cs
│   │   ├── NlogConfig.cs
│   │   ├── Server.cs
│   │   └── SysproxyConfig.cs
│   ├── Program.cs
│   ├── Properties/
│   │   ├── AssemblyInfo.cs
│   │   ├── Resources.Designer.cs
│   │   ├── Resources.resx
│   │   ├── Settings.Designer.cs
│   │   └── Settings.settings
│   ├── Proxy/
│   │   ├── DirectConnect.cs
│   │   ├── HttpProxy.cs
│   │   ├── IProxy.cs
│   │   └── Socks5Proxy.cs
│   ├── Resources/
│   │   ├── ss128.pdn
│   │   └── ss32.pdn
│   ├── Settings.cs
│   ├── Util/
│   │   ├── ProcessManagement/
│   │   │   ├── Job.cs
│   │   │   └── ThreadUtil.cs
│   │   ├── Sockets/
│   │   │   ├── LineReader.cs
│   │   │   ├── SocketUtil.cs
│   │   │   └── WrappedSocket.cs
│   │   ├── SystemProxy/
│   │   │   ├── ProxyException.cs
│   │   │   └── Sysproxy.cs
│   │   ├── Util.cs
│   │   └── ViewUtils.cs
│   ├── View/
│   │   ├── ConfigForm.Designer.cs
│   │   ├── ConfigForm.cs
│   │   ├── ConfigForm.resx
│   │   ├── LogForm.Designer.cs
│   │   ├── LogForm.cs
│   │   ├── LogForm.resx
│   │   └── MenuViewController.cs
│   ├── ViewModels/
│   │   ├── ForwardProxyViewModel.cs
│   │   ├── HotkeysViewModel.cs
│   │   ├── OnlineConfigViewModel.cs
│   │   ├── ServerSharingViewModel.cs
│   │   └── VersionUpdatePromptViewModel.cs
│   ├── Views/
│   │   ├── ForwardProxyView.xaml
│   │   ├── ForwardProxyView.xaml.cs
│   │   ├── HotkeysView.xaml
│   │   ├── HotkeysView.xaml.cs
│   │   ├── OnlineConfigView.xaml
│   │   ├── OnlineConfigView.xaml.cs
│   │   ├── ServerSharingView.xaml
│   │   ├── ServerSharingView.xaml.cs
│   │   ├── VersionUpdatePromptView.xaml
│   │   └── VersionUpdatePromptView.xaml.cs
│   ├── app.config
│   ├── app.manifest
│   ├── packages.config
│   └── shadowsocks-csharp.csproj
├── shadowsocks-windows.sln
└── test/
    ├── ProcessEnvironment.cs
    ├── Properties/
    │   └── AssemblyInfo.cs
    ├── ShadowsocksTest.csproj
    ├── Sip003PluginTest.cs
    ├── UnitTest.cs
    ├── UrlTest.cs
    ├── app.config
    └── packages.config
Download .txt
SYMBOL INDEX (986 symbols across 88 files)

FILE: shadowsocks-csharp/CommandLineOption.cs
  class CommandLineOption (line 5) | public class CommandLineOption

FILE: shadowsocks-csharp/Controller/FileManager.cs
  class FileManager (line 9) | public static class FileManager
    method ByteArrayToFile (line 13) | public static bool ByteArrayToFile(string fileName, byte[] content)
    method UncompressFile (line 28) | public static void UncompressFile(string fileName, byte[] content)
    method NonExclusiveReadAllText (line 46) | public static string NonExclusiveReadAllText(string path)
    method NonExclusiveReadAllText (line 51) | public static string NonExclusiveReadAllText(string path, Encoding enc...

FILE: shadowsocks-csharp/Controller/HotkeyReg.cs
  class HotkeyReg (line 10) | static class HotkeyReg
    method RegAllHotkeys (line 13) | public static void RegAllHotkeys()
    method RegHotkeyFromString (line 43) | public static bool RegHotkeyFromString(string hotkeyStr, string callba...
    type RegResult (line 84) | public enum RegResult

FILE: shadowsocks-csharp/Controller/I18N.cs
  class I18N (line 13) | public static class I18N
    method Init (line 21) | private static void Init(string res, string locale)
    method I18N (line 79) | static I18N()
    method GetString (line 97) | public static string GetString(string key, params object[] args)
    method TranslateForm (line 102) | public static void TranslateForm(Form c)
    method TranslateMenu (line 113) | public static void TranslateMenu(Menu m)

FILE: shadowsocks-csharp/Controller/LoggerExtension.cs
  class LoggerExtension (line 12) | public static class LoggerExtension
    method Dump (line 14) | public static void Dump(this Logger logger, string tag, byte[] arr, in...
    method Debug (line 29) | public static void Debug(this Logger logger, EndPoint local, EndPoint ...
    method Debug (line 44) | public static void Debug(this Logger logger, Socket sock, int len, str...
    method LogUsefulException (line 52) | public static void LogUsefulException(this Logger logger, Exception e)

FILE: shadowsocks-csharp/Controller/Service/GeositeUpdater.cs
  class GeositeResultEventArgs (line 18) | public class GeositeResultEventArgs : EventArgs
    method GeositeResultEventArgs (line 22) | public GeositeResultEventArgs(bool success)
  class GeositeUpdater (line 28) | public static class GeositeUpdater
    method GeositeUpdater (line 44) | static GeositeUpdater()
    method LoadGeositeList (line 61) | static void LoadGeositeList()
    method ResetEvent (line 70) | public static void ResetEvent()
    method UpdatePACFromGeosite (line 76) | public static async Task UpdatePACFromGeosite()
    method MergeAndWritePACFile (line 166) | public static bool MergeAndWritePACFile(List<string> directGroups, Lis...
    method CheckGeositeGroup (line 186) | public static bool CheckGeositeGroup(string group) => SeparateAttribut...
    method SeparateAttributeFromGroupName (line 196) | private static bool SeparateAttributeFromGroupName(string group, out s...
    method MergePACFile (line 218) | private static string MergePACFile(List<string> directGroups, List<str...
    method ProcessUserRules (line 245) | private static List<string> ProcessUserRules(string content)
    method GenerateRules (line 267) | private static List<string> GenerateRules(List<string> directGroups, L...
    method GenerateBlockingRules (line 291) | private static List<string> GenerateBlockingRules(List<string> groups)
    method GenerateExceptionRules (line 356) | private static List<string> GenerateExceptionRules(List<string> groups)

FILE: shadowsocks-csharp/Controller/Service/IPCService.cs
  class RequestAddUrlEventArgs (line 8) | class RequestAddUrlEventArgs : EventArgs
    method RequestAddUrlEventArgs (line 12) | public RequestAddUrlEventArgs(string url)
  class IPCService (line 18) | internal class IPCService
    method RunServer (line 26) | public async void RunServer()
    method TryConnect (line 51) | private static (NamedPipeClientStream, bool) TryConnect()
    method AnotherInstanceRunning (line 67) | public static bool AnotherInstanceRunning()
    method RequestOpenUrl (line 74) | public static void RequestOpenUrl(string url)

FILE: shadowsocks-csharp/Controller/Service/Listener.cs
  class Listener (line 12) | public class Listener
    type IService (line 16) | public interface IService
      method Handle (line 18) | bool Handle(byte[] firstPacket, int length, Socket socket, object st...
      method Stop (line 20) | void Stop();
    class Service (line 23) | public abstract class Service : IService
      method Handle (line 25) | public abstract bool Handle(byte[] firstPacket, int length, Socket s...
      method Stop (line 27) | public virtual void Stop() { }
    class UDPState (line 30) | public class UDPState
      method UDPState (line 32) | public UDPState(Socket s)
    method Listener (line 48) | public Listener(List<IService> services)
    method CheckIfPortInUse (line 53) | private bool CheckIfPortInUse(int port)
    method Start (line 59) | public void Start(Configuration config)
    method Stop (line 98) | public void Stop()
    method RecvFromCallback (line 114) | public void RecvFromCallback(IAsyncResult ar)
    method AcceptCallback (line 152) | public void AcceptCallback(IAsyncResult ar)
    method ReceiveCallback (line 194) | private void ReceiveCallback(IAsyncResult ar)

FILE: shadowsocks-csharp/Controller/Service/OnlineConfigResolver.cs
  class OnlineConfigResolver (line 12) | public class OnlineConfigResolver
    method GetOnline (line 14) | public static async Task<List<Server>> GetOnline(string url)
  class OnlineConfigResolverEx (line 27) | internal static class OnlineConfigResolverEx
    method GetServers (line 33) | internal static IEnumerable<Server> GetServers(this string json) =>
    method SearchJArray (line 36) | private static IEnumerable<Server> SearchJArray(JArray array) =>
    method SearchJObject (line 39) | private static IEnumerable<Server> SearchJObject(JObject obj)
    method SearchJToken (line 56) | private static IEnumerable<Server> SearchJToken(this JToken token)

FILE: shadowsocks-csharp/Controller/Service/PACDaemon.cs
  class PACDaemon (line 18) | public class PACDaemon
    method PACDaemon (line 33) | public PACDaemon(Configuration config)
    method TouchPACFile (line 44) | public string TouchPACFile()
    method TouchUserRuleFile (line 53) | internal string TouchUserRuleFile()
    method GetPACContent (line 62) | internal string GetPACContent()
    method WatchPacFile (line 72) | private void WatchPacFile()
    method WatchUserRuleFile (line 85) | private void WatchUserRuleFile()
    method PACFileWatcher_Changed (line 102) | private void PACFileWatcher_Changed(object sender, FileSystemEventArgs e)
    method UserRuleFileWatcher_Changed (line 117) | private void UserRuleFileWatcher_Changed(object sender, FileSystemEven...

FILE: shadowsocks-csharp/Controller/Service/PACServer.cs
  class PACServer (line 13) | public class PACServer : Listener.Service
    method PACServer (line 38) | public PACServer(PACDaemon pacDaemon)
    method UpdatePACURL (line 43) | public void UpdatePACURL(Configuration config)
    method GetHash (line 52) | private static string GetHash(string content)
    method Handle (line 57) | public override bool Handle(byte[] firstPacket, int length, Socket soc...
    method SendResponse (line 160) | public void SendResponse(Socket socket, bool useSocks)
    method SendCallback (line 187) | private void SendCallback(IAsyncResult ar)
    method GetPACAddress (line 199) | private string GetPACAddress(IPEndPoint localEndPoint, bool useSocks)

FILE: shadowsocks-csharp/Controller/Service/PortForwarder.cs
  class PortForwarder (line 9) | class PortForwarder : Listener.Service
    method PortForwarder (line 13) | public PortForwarder(int targetPort)
    method Handle (line 18) | public override bool Handle(byte[] firstPacket, int length, Socket soc...
    class Handler (line 28) | private class Handler
      method Start (line 48) | public void Start(byte[] firstPacket, int length, Socket socket, int...
      method ConnectCallback (line 69) | private void ConnectCallback(IAsyncResult ar)
      method HandshakeReceive (line 88) | private void HandshakeReceive()
      method StartPipe (line 105) | private void StartPipe(IAsyncResult ar)
      method PipeRemoteReceiveCallback (line 126) | private void PipeRemoteReceiveCallback(IAsyncResult ar)
      method PipeConnectionReceiveCallback (line 153) | private void PipeConnectionReceiveCallback(IAsyncResult ar)
      method PipeRemoteSendCallback (line 180) | private void PipeRemoteSendCallback(IAsyncResult ar)
      method PipeConnectionSendCallback (line 199) | private void PipeConnectionSendCallback(IAsyncResult ar)
      method CheckClose (line 218) | private void CheckClose()
      method Close (line 226) | public void Close()

FILE: shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs
  class PrivoxyRunner (line 17) | class PrivoxyRunner
    method PrivoxyRunner (line 27) | static PrivoxyRunner()
    method Start (line 45) | public void Start(Configuration configuration)
    method Stop (line 88) | public void Stop()
    method KillProcess (line 98) | private static void KillProcess(Process p)
    method IsChildProcess (line 126) | private static bool IsChildProcess(Process process)
    method GetFreePort (line 150) | private int GetFreePort(bool isIPv6 = false)

FILE: shadowsocks-csharp/Controller/Service/Sip003Plugin.cs
  class Sip003Plugin (line 13) | public sealed class Sip003Plugin : IDisposable
    method CreateIfConfigured (line 24) | public static Sip003Plugin CreateIfConfigured(Server server, bool show...
    method Sip003Plugin (line 45) | private Sip003Plugin(string plugin, string pluginOpts, string pluginAr...
    method StartIfNeeded (line 80) | public bool StartIfNeeded()
    method ExpandEnvironmentVariables (line 123) | public string ExpandEnvironmentVariables(string name, StringDictionary...
    method GetNextFreeTcpPort (line 138) | static int GetNextFreeTcpPort()
    method Dispose (line 147) | public void Dispose()

FILE: shadowsocks-csharp/Controller/Service/TCPRelay.cs
  class TCPRelay (line 22) | internal class TCPRelay : Listener.Service
    method TCPRelay (line 36) | public TCPRelay(ShadowsocksController controller, Configuration conf)
    method Handle (line 44) | public override bool Handle(byte[] firstPacket, int length, Socket soc...
    method Stop (line 101) | public override void Stop()
  class SSRelayEventArgs (line 112) | public class SSRelayEventArgs : EventArgs
    method SSRelayEventArgs (line 116) | public SSRelayEventArgs(Server server)
  class SSTransmitEventArgs (line 122) | public class SSTransmitEventArgs : SSRelayEventArgs
    method SSTransmitEventArgs (line 125) | public SSTransmitEventArgs(Server server, long length) : base(server)
  class SSTCPConnectedEventArgs (line 131) | public class SSTCPConnectedEventArgs : SSRelayEventArgs
    method SSTCPConnectedEventArgs (line 135) | public SSTCPConnectedEventArgs(Server server, TimeSpan latency) : base...
  class TCPHandler (line 141) | internal class TCPHandler
    class AsyncSession (line 149) | private class AsyncSession
      method AsyncSession (line 153) | public AsyncSession(IProxy remote)
      method AsyncSession (line 163) | public AsyncSession(IProxy remote, T state) : base(remote)
      method AsyncSession (line 168) | public AsyncSession(AsyncSession session, T state) : base(session.Re...
    class AsyncSession (line 159) | private class AsyncSession<T> : AsyncSession
      method AsyncSession (line 153) | public AsyncSession(IProxy remote)
      method AsyncSession (line 163) | public AsyncSession(IProxy remote, T state) : base(remote)
      method AsyncSession (line 168) | public AsyncSession(AsyncSession session, T state) : base(session.Re...
    method TCPHandler (line 247) | public TCPHandler(ShadowsocksController controller, Configuration conf...
    method CreateRemote (line 258) | public void CreateRemote()
    method Start (line 276) | public void Start(byte[] firstPacket, int length)
    method CheckClose (line 283) | private void CheckClose()
    method ErrorClose (line 291) | private void ErrorClose(Exception e)
    method Close (line 297) | public void Close()
    method HandshakeReceive (line 344) | private void HandshakeReceive()
    method HandshakeSendCallback (line 377) | private void HandshakeSendCallback(IAsyncResult ar)
    method AddressReceiveCallback (line 405) | private void AddressReceiveCallback(IAsyncResult ar)
    method ConnectResponseCallback (line 454) | private void ConnectResponseCallback(IAsyncResult ar)
    method ReadAddress (line 468) | private void ReadAddress(Action onSuccess)
    method ReadAddress (line 491) | private void ReadAddress(int bytesRemain, Action onSuccess)
    method OnAddressFullyRead (line 501) | private void OnAddressFullyRead(IAsyncResult ar)
    method HandleUDPAssociate (line 566) | private void HandleUDPAssociate()
    method ReadAll (line 588) | private void ReadAll(IAsyncResult ar)
    class ProxyTimer (line 624) | private class ProxyTimer : Timer
      method ProxyTimer (line 631) | public ProxyTimer(int p) : base(p)
    class ServerTimer (line 636) | private class ServerTimer : Timer
      method ServerTimer (line 642) | public ServerTimer(int p) : base(p)
    method StartConnect (line 647) | private void StartConnect()
    method ProxyConnectTimer_Elapsed (line 716) | private void ProxyConnectTimer_Elapsed(object sender, ElapsedEventArgs e)
    method ProxyConnectCallback (line 735) | private void ProxyConnectCallback(IAsyncResult ar)
    method DestConnectTimer_Elapsed (line 791) | private void DestConnectTimer_Elapsed(object sender, ElapsedEventArgs e)
    method ConnectCallback (line 811) | private void ConnectCallback(IAsyncResult ar)
    method TryReadAvailableData (line 854) | private void TryReadAvailableData()
    method StartPipe (line 866) | private void StartPipe(AsyncSession session)
    method PipeRemoteReceiveCallback (line 889) | private void PipeRemoteReceiveCallback(IAsyncResult ar)
    method PipeConnectionReceiveCallback (line 945) | private void PipeConnectionReceiveCallback(IAsyncResult ar)
    method SendToServer (line 976) | private void SendToServer(int length, AsyncSession session)
    method PipeRemoteSendCallback (line 1000) | private void PipeRemoteSendCallback(IAsyncResult ar)
    method PipeConnectionSendCallback (line 1038) | private void PipeConnectionSendCallback(IAsyncResult ar)

FILE: shadowsocks-csharp/Controller/Service/UDPRelay.cs
  class UDPRelay (line 13) | class UDPRelay : Listener.Service
    method UDPRelay (line 23) | public UDPRelay(ShadowsocksController controller)
    method Handle (line 28) | public override bool Handle(byte[] firstPacket, int length, Socket soc...
    class UDPHandler (line 51) | public class UDPHandler
      method GetIPAddress (line 64) | private IPAddress GetIPAddress()
      method UDPHandler (line 77) | public UDPHandler(Socket local, Server server, IPEndPoint localEndPo...
      method Send (line 96) | public void Send(byte[] data, int length)
      method Receive (line 108) | public void Receive()
      method RecvFromCallback (line 115) | public void RecvFromCallback(IAsyncResult ar)
      method Close (line 152) | public void Close()
  class LRUCache (line 173) | class LRUCache<K, V> where V : UDPRelay.UDPHandler
    method LRUCache (line 179) | public LRUCache(int capacity)
    method get (line 184) | [MethodImpl(MethodImplOptions.Synchronized)]
    method add (line 198) | [MethodImpl(MethodImplOptions.Synchronized)]
    method RemoveFirst (line 212) | private void RemoveFirst()
  class LRUCacheItem (line 224) | class LRUCacheItem<K, V>
    method LRUCacheItem (line 226) | public LRUCacheItem(K k, V v)

FILE: shadowsocks-csharp/Controller/Service/UpdateChecker.cs
  class UpdateChecker (line 19) | public class UpdateChecker
    method UpdateChecker (line 39) | public UpdateChecker()
    method CheckForVersionUpdate (line 52) | public async Task CheckForVersionUpdate(int millisecondsDelay = 0)
    method AskToUpdate (line 96) | private void AskToUpdate(JToken releaseObject)
    method VersionUpdatePromptWindow_Closed (line 115) | private void VersionUpdatePromptWindow_Closed(object sender, EventArgs e)
    method DoUpdate (line 124) | public async Task DoUpdate()
    method SkipUpdate (line 156) | public void SkipUpdate()
    method CloseVersionUpdatePromptWindow (line 168) | public void CloseVersionUpdatePromptWindow()

FILE: shadowsocks-csharp/Controller/ShadowsocksController.cs
  class ShadowsocksController (line 23) | public class ShadowsocksController
    class PathEventArgs (line 51) | public class PathEventArgs : EventArgs
    class UpdatedEventArgs (line 56) | public class UpdatedEventArgs : EventArgs
    class TrafficPerSecond (line 62) | public class TrafficPerSecond
    method ShadowsocksController (line 92) | public ShadowsocksController()
    method Start (line 114) | public void Start(bool systemWakeUp = false)
    method Stop (line 144) | public void Stop()
    method Reload (line 167) | protected void Reload()
    method SaveConfig (line 258) | protected void SaveConfig(Configuration newConfig)
    method ReportError (line 264) | protected void ReportError(Exception e)
    method GetHttpClient (line 269) | public HttpClient GetHttpClient() => httpClient;
    method GetCurrentServer (line 270) | public Server GetCurrentServer() => _config.GetCurrentServer();
    method GetCurrentConfiguration (line 271) | public Configuration GetCurrentConfiguration() => _config;
    method GetAServer (line 273) | public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPE...
    method SaveServers (line 287) | public void SaveServers(List<Server> servers, int localPort, bool port...
    method SelectServerIndex (line 295) | public void SelectServerIndex(int index)
    method ToggleShareOverLAN (line 302) | public void ToggleShareOverLAN(bool enabled)
    method ToggleEnable (line 314) | public void ToggleEnable(bool enabled)
    method ToggleGlobal (line 322) | public void ToggleGlobal(bool global)
    method SaveProxy (line 330) | public void SaveProxy(ForwardProxyConfig proxyConfig)
    method UpdateSystemProxy (line 336) | private void UpdateSystemProxy()
    method PacDaemon_PACFileChanged (line 345) | private void PacDaemon_PACFileChanged(object sender, EventArgs e)
    method PacServer_PACUpdateCompleted (line 350) | private void PacServer_PACUpdateCompleted(object sender, GeositeResult...
    method PacServer_PACUpdateError (line 355) | private void PacServer_PACUpdateError(object sender, ErrorEventArgs e)
    method PacDaemon_UserRuleFileChanged (line 361) | private void PacDaemon_UserRuleFileChanged(object sender, EventArgs e)
    method CopyPacUrl (line 367) | public void CopyPacUrl()
    method SavePACUrl (line 372) | public void SavePACUrl(string pacUrl)
    method UseOnlinePAC (line 380) | public void UseOnlinePAC(bool useOnlinePac)
    method TouchPACFile (line 388) | public void TouchPACFile()
    method TouchUserRuleFile (line 395) | public void TouchUserRuleFile()
    method ToggleSecureLocalPac (line 402) | public void ToggleSecureLocalPac(bool enabled)
    method ToggleRegeneratePacOnUpdate (line 410) | public void ToggleRegeneratePacOnUpdate(bool enabled)
    method AskAddServerBySSURL (line 421) | public bool AskAddServerBySSURL(string ssURL)
    method AddServerBySSURL (line 439) | public bool AddServerBySSURL(string ssURL)
    method GetServerURLForCurrentServer (line 467) | public string GetServerURLForCurrentServer()
    method ToggleVerboseLogging (line 476) | public void ToggleVerboseLogging(bool enabled)
    method ToggleCheckingUpdate (line 485) | public void ToggleCheckingUpdate(bool enabled)
    method ToggleCheckingPreRelease (line 493) | public void ToggleCheckingPreRelease(bool enabled)
    method SaveSkippedUpdateVerion (line 500) | public void SaveSkippedUpdateVerion(string version)
    method SaveLogViewerConfig (line 506) | public void SaveLogViewerConfig(LogViewerConfig newConfig)
    method SaveHotkeyConfig (line 515) | public void SaveHotkeyConfig(HotkeyConfig newConfig)
    method SelectStrategy (line 527) | public void SelectStrategy(string strategyID)
    method GetStrategies (line 534) | public IList<IStrategy> GetStrategies()
    method GetCurrentStrategy (line 539) | public IStrategy GetCurrentStrategy()
    method UpdateInboundCounter (line 551) | public void UpdateInboundCounter(object sender, SSTransmitEventArgs args)
    method UpdateOutboundCounter (line 557) | public void UpdateOutboundCounter(object sender, SSTransmitEventArgs a...
    method StartPlugin (line 567) | private void StartPlugin()
    method StopPlugins (line 573) | private void StopPlugins()
    method GetPluginLocalEndPointIfConfigured (line 582) | public EndPoint GetPluginLocalEndPointIfConfigured(Server server)
    method ToggleShowPluginOutput (line 610) | public void ToggleShowPluginOutput(bool enabled)
    method StartTrafficStatistics (line 622) | private void StartTrafficStatistics(int queueMaxSize)
    method TrafficStatistics (line 636) | private void TrafficStatistics(int queueMaxSize)
    method UpdateOnlineConfigInternal (line 665) | public async Task<int> UpdateOnlineConfigInternal(string url)
    method UpdateOnlineConfig (line 677) | public async Task<bool> UpdateOnlineConfig(string url)
    method UpdateAllOnlineConfig (line 694) | public async Task<List<string>> UpdateAllOnlineConfig()
    method SaveOnlineConfigSource (line 716) | public void SaveOnlineConfigSource(List<string> sources)
    method RemoveOnlineConfig (line 722) | public void RemoveOnlineConfig(string url)

FILE: shadowsocks-csharp/Controller/Strategy/BalancingStrategy.cs
  class BalancingStrategy (line 10) | class BalancingStrategy : IStrategy
    method BalancingStrategy (line 15) | public BalancingStrategy(ShadowsocksController controller)
    method ReloadServers (line 31) | public void ReloadServers()
    method GetAServer (line 36) | public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPE...
    method UpdateLatency (line 51) | public void UpdateLatency(Model.Server server, TimeSpan latency)
    method UpdateLastRead (line 56) | public void UpdateLastRead(Model.Server server)
    method UpdateLastWrite (line 61) | public void UpdateLastWrite(Model.Server server)
    method SetFailure (line 66) | public void SetFailure(Model.Server server)

FILE: shadowsocks-csharp/Controller/Strategy/HighAvailabilityStrategy.cs
  class HighAvailabilityStrategy (line 10) | class HighAvailabilityStrategy : IStrategy
    class ServerStatus (line 19) | public class ServerStatus
    method HighAvailabilityStrategy (line 39) | public HighAvailabilityStrategy(ShadowsocksController controller)
    method ReloadServers (line 56) | public void ReloadServers()
    method GetAServer (line 85) | public Server GetAServer(IStrategyCallerType type, System.Net.IPEndPoi...
    method ChooseNewServer (line 104) | public void ChooseNewServer()
    method UpdateLatency (line 144) | public void UpdateLatency(Model.Server server, TimeSpan latency)
    method UpdateLastRead (line 156) | public void UpdateLastRead(Model.Server server)
    method UpdateLastWrite (line 167) | public void UpdateLastWrite(Model.Server server)
    method SetFailure (line 178) | public void SetFailure(Model.Server server)

FILE: shadowsocks-csharp/Controller/Strategy/IStrategy.cs
  type IStrategyCallerType (line 9) | public enum IStrategyCallerType
  type IStrategy (line 20) | public interface IStrategy
    method ReloadServers (line 29) | void ReloadServers();
    method GetAServer (line 34) | Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint...
    method UpdateLatency (line 39) | void UpdateLatency(Server server, TimeSpan latency);
    method UpdateLastRead (line 44) | void UpdateLastRead(Server server);
    method UpdateLastWrite (line 49) | void UpdateLastWrite(Server server);
    method SetFailure (line 54) | void SetFailure(Server server);

FILE: shadowsocks-csharp/Controller/Strategy/StrategyManager.cs
  class StrategyManager (line 8) | class StrategyManager
    method StrategyManager (line 11) | public StrategyManager(ShadowsocksController controller)
    method GetStrategies (line 18) | public IList<IStrategy> GetStrategies()

FILE: shadowsocks-csharp/Controller/System/AutoStartup.cs
  class AutoStartup (line 11) | static class AutoStartup
    method Set (line 20) | public static bool Set(bool enabled)
    method Check (line 63) | public static bool Check()
    method RegisterApplicationRestart (line 113) | [DllImport("kernel32.dll", SetLastError = true)]
    method UnregisterApplicationRestart (line 116) | [DllImport("kernel32.dll", SetLastError = true)]
    type ApplicationRestartFlags (line 119) | [Flags]
    method RegisterForRestart (line 130) | public static void RegisterForRestart(bool register)

FILE: shadowsocks-csharp/Controller/System/Hotkeys/HotkeyCallbacks.cs
  class HotkeyCallbacks (line 6) | public class HotkeyCallbacks
    method InitInstance (line 9) | public static void InitInstance(ShadowsocksController controller)
    method GetCallback (line 24) | public static Delegate GetCallback(string methodname)
    method HotkeyCallbacks (line 38) | private HotkeyCallbacks(ShadowsocksController controller)
    method SwitchSystemProxyCallback (line 47) | private void SwitchSystemProxyCallback()
    method SwitchSystemProxyModeCallback (line 53) | private void SwitchSystemProxyModeCallback()
    method SwitchAllowLanCallback (line 60) | private void SwitchAllowLanCallback()
    method ShowLogsCallback (line 66) | private void ShowLogsCallback()
    method ServerMoveUpCallback (line 71) | private void ServerMoveUpCallback()
    method ServerMoveDownCallback (line 88) | private void ServerMoveDownCallback()
    method GetCurrServerInfo (line 105) | private void GetCurrServerInfo(out int currIndex, out int serverCount)

FILE: shadowsocks-csharp/Controller/System/Hotkeys/Hotkeys.cs
  class HotKeys (line 10) | public static class HotKeys
    method Init (line 18) | public static void Init(ShadowsocksController controller)
    method Destroy (line 26) | public static void Destroy()
    method HotKeyManagerPressed (line 32) | private static void HotKeyManagerPressed(object sender, KeyPressedEven...
    method RegHotkey (line 40) | public static bool RegHotkey(HotKey hotkey, HotKeyCallBackHandler call...
    method UnregExistingHotkey (line 46) | public static bool UnregExistingHotkey(HotKeys.HotKeyCallBackHandler cb)
    method IsHotkeyExists (line 61) | public static bool IsHotkeyExists( HotKey hotKey )
    method IsCallbackExists (line 67) | public static bool IsCallbackExists( HotKeyCallBackHandler cb, out Hot...
    method HotKey2Str (line 84) | public static string HotKey2Str( HotKey key )
    method HotKey2Str (line 90) | public static string HotKey2Str( Key key, ModifierKeys modifier )
    method Str2HotKey (line 109) | public static HotKey Str2HotKey(string s)
    method Register (line 139) | private static bool Register(HotKey key, HotKeyCallBackHandler callBack)
    method Unregister (line 165) | private static void Unregister(HotKey key)

FILE: shadowsocks-csharp/Controller/System/ProtocolHandler.cs
  class ProtocolHandler (line 12) | static class ProtocolHandler
    method Set (line 18) | public static bool Set(bool enabled)
    method Check (line 65) | public static bool Check()

FILE: shadowsocks-csharp/Controller/System/SystemProxy.cs
  class SystemProxy (line 9) | public static class SystemProxy
    method GetTimestamp (line 13) | private static string GetTimestamp(DateTime value)
    method Update (line 18) | public static void Update(Configuration config, bool forceDisable, PAC...

FILE: shadowsocks-csharp/Data/abp.js
  function createDict (line 43) | function createDict()
  function getOwnPropertyDescriptor (line 50) | function getOwnPropertyDescriptor(obj, key)
  function extend (line 59) | function extend(subclass, superclass, definition)
  function Filter (line 82) | function Filter(text)
  function InvalidFilter (line 118) | function InvalidFilter(text, reason)
  function CommentFilter (line 127) | function CommentFilter(text)
  function ActiveFilter (line 134) | function ActiveFilter(text, domains)
  function RegExpFilter (line 264) | function RegExpFilter(text, regexpSource, contentType, matchCase, domain...
  function BlockingFilter (line 471) | function BlockingFilter(text, regexpSource, contentType, matchCase, doma...
  function WhitelistFilter (line 480) | function WhitelistFilter(text, regexpSource, contentType, matchCase, dom...
  function Matcher (line 487) | function Matcher()
  function CombinedMatcher (line 641) | function CombinedMatcher()
  function FindProxyForURL (line 806) | function FindProxyForURL(url, host) {

FILE: shadowsocks-csharp/Encryption/AEAD/AEADEncryptor.cs
  class AEADEncryptor (line 13) | public abstract class AEADEncryptor
    method AEADEncryptor (line 58) | public AEADEncryptor(string method, string password)
    method getCiphers (line 68) | protected abstract Dictionary<string, EncryptorInfo> getCiphers();
    method InitEncryptorInfo (line 70) | protected void InitEncryptorInfo(string method)
    method InitKey (line 87) | protected void InitKey(string password)
    method DeriveKey (line 98) | public void DeriveKey(byte[] password, byte[] key, int keylen)
    method DeriveSessionKey (line 120) | public void DeriveSessionKey(byte[] salt, byte[] masterKey, byte[] ses...
    method IncrementNonce (line 127) | protected void IncrementNonce(bool isEncrypt)
    method InitCipher (line 134) | public virtual void InitCipher(byte[] salt, bool isEncrypt, bool isUdp)
    method randBytes (line 146) | public static void randBytes(byte[] buf, int length) { RNG.GetBytes(bu...
    method cipherEncrypt (line 148) | public abstract void cipherEncrypt(byte[] plaintext, uint plen, byte[]...
    method cipherDecrypt (line 150) | public abstract void cipherDecrypt(byte[] ciphertext, uint clen, byte[...
    method Encrypt (line 154) | public override void Encrypt(byte[] buf, int length, byte[] outbuf, ou...
    method Decrypt (line 212) | public override void Decrypt(byte[] buf, int length, byte[] outbuf, ou...
    method EncryptUDP (line 307) | public override void EncryptUDP(byte[] buf, int length, byte[] outbuf,...
    method DecryptUDP (line 321) | public override void DecryptUDP(byte[] buf, int length, byte[] outbuf,...
    method ChunkEncrypt (line 337) | private void ChunkEncrypt(byte[] plaintext, int plainLen, byte[] ciphe...

FILE: shadowsocks-csharp/Encryption/AEAD/AEADMbedTLSEncryptor.cs
  class AEADMbedTLSEncryptor (line 9) | public class AEADMbedTLSEncryptor
    method AEADMbedTLSEncryptor (line 17) | public AEADMbedTLSEncryptor(string method, string password)
    method SupportedCiphers (line 29) | public static List<string> SupportedCiphers()
    method getCiphers (line 34) | protected override Dictionary<string, EncryptorInfo> getCiphers()
    method InitCipher (line 39) | public override void InitCipher(byte[] salt, bool isEncrypt, bool isUdp)
    method CipherSetKey (line 61) | private void CipherSetKey(bool isEncrypt, byte[] key)
    method cipherEncrypt (line 71) | public override void cipherEncrypt(byte[] plaintext, uint plen, byte[]...
    method cipherDecrypt (line 102) | public override void cipherDecrypt(byte[] ciphertext, uint clen, byte[...
    method Dispose (line 136) | public override void Dispose()
    method Dispose (line 147) | protected virtual void Dispose(bool disposing)

FILE: shadowsocks-csharp/Encryption/AEAD/AEADOpenSSLEncryptor.cs
  class AEADOpenSSLEncryptor (line 7) | public class AEADOpenSSLEncryptor
    method AEADOpenSSLEncryptor (line 21) | public AEADOpenSSLEncryptor(string method, string password)
    method SupportedCiphers (line 36) | public static List<string> SupportedCiphers()
    method getCiphers (line 41) | protected override Dictionary<string, EncryptorInfo> getCiphers()
    method InitCipher (line 46) | public override void InitCipher(byte[] salt, bool isEncrypt, bool isUdp)
    method cipherEncrypt (line 85) | public override void cipherEncrypt(byte[] plaintext, uint plen, byte[]...
    method cipherDecrypt (line 112) | public override void cipherDecrypt(byte[] ciphertext, uint clen, byte[...
    method Dispose (line 152) | public override void Dispose()
    method Dispose (line 163) | protected virtual void Dispose(bool disposing)

FILE: shadowsocks-csharp/Encryption/AEAD/AEADSodiumEncryptor.cs
  class AEADSodiumEncryptor (line 10) | public class AEADSodiumEncryptor
    method AEADSodiumEncryptor (line 22) | public AEADSodiumEncryptor(string method, string password)
    method SupportedCiphers (line 36) | public static List<string> SupportedCiphers()
    method getCiphers (line 41) | protected override Dictionary<string, EncryptorInfo> getCiphers()
    method InitCipher (line 46) | public override void InitCipher(byte[] salt, bool isEncrypt, bool isUdp)
    method cipherEncrypt (line 54) | public override void cipherEncrypt(byte[] plaintext, uint plen, byte[]...
    method cipherDecrypt (line 95) | public override void cipherDecrypt(byte[] ciphertext, uint clen, byte[...
    method Dispose (line 137) | public override void Dispose()

FILE: shadowsocks-csharp/Encryption/CircularBuffer/ByteCircularBuffer.cs
  class ByteCircularBuffer (line 46) | public class ByteCircularBuffer
    method ByteCircularBuffer (line 69) | public ByteCircularBuffer(int capacity)
    method Clear (line 157) | public void Clear()
    method Contains (line 170) | public bool Contains(byte item)
    method CopyTo (line 197) | public void CopyTo(byte[] array)
    method CopyTo (line 207) | public void CopyTo(byte[] array, int arrayIndex)
    method CopyTo (line 219) | public virtual void CopyTo(int index, byte[] array, int arrayIndex, in...
    method Get (line 245) | public byte[] Get(int count)
    method Get (line 260) | public int Get(byte[] array)
    method Get (line 273) | public virtual int Get(byte[] array, int arrayIndex, int count)
    method Get (line 312) | public virtual byte Get()
    method Peek (line 334) | public virtual byte Peek()
    method Peek (line 352) | public virtual byte[] Peek(int count)
    method PeekLast (line 370) | public virtual byte PeekLast()
    method Put (line 399) | public int Put(byte[] array)
    method Put (line 412) | public virtual int Put(byte[] array, int arrayIndex, int count)
    method Put (line 444) | public virtual void Put(byte item)
    method Skip (line 478) | public void Skip(int count)
    method ToArray (line 499) | public byte[] ToArray()

FILE: shadowsocks-csharp/Encryption/EncryptorBase.cs
  class EncryptorInfo (line 3) | public class EncryptorInfo
    method EncryptorInfo (line 18) | public EncryptorInfo(string innerLibName, int keySize, int ivSize, int...
    method EncryptorInfo (line 26) | public EncryptorInfo(int keySize, int ivSize, int type)
    method EncryptorInfo (line 38) | public EncryptorInfo(string innerLibName, int keySize, int saltSize, i...
    method EncryptorInfo (line 48) | public EncryptorInfo(int keySize, int saltSize, int nonceSize, int tag...
  class EncryptorBase (line 61) | public abstract class EncryptorBase
    method EncryptorBase (line 76) | protected EncryptorBase(string method, string password)
    method Encrypt (line 85) | public abstract void Encrypt(byte[] buf, int length, byte[] outbuf, ou...
    method Decrypt (line 87) | public abstract void Decrypt(byte[] buf, int length, byte[] outbuf, ou...
    method EncryptUDP (line 89) | public abstract void EncryptUDP(byte[] buf, int length, byte[] outbuf,...
    method DecryptUDP (line 91) | public abstract void DecryptUDP(byte[] buf, int length, byte[] outbuf,...
    method Dispose (line 93) | public abstract void Dispose();

FILE: shadowsocks-csharp/Encryption/EncryptorFactory.cs
  class EncryptorFactory (line 10) | public static class EncryptorFactory
    method EncryptorFactory (line 16) | static EncryptorFactory()
    method GetEncryptor (line 57) | public static IEncryptor GetEncryptor(string method, string password)
    method DumpRegisteredEncryptor (line 73) | public static string DumpRegisteredEncryptor()

FILE: shadowsocks-csharp/Encryption/Exception/CryptoException.cs
  class CryptoErrorException (line 3) | public class CryptoErrorException : System.Exception
    method CryptoErrorException (line 5) | public CryptoErrorException()
    method CryptoErrorException (line 9) | public CryptoErrorException(string msg) : base(msg)
    method CryptoErrorException (line 13) | public CryptoErrorException(string message, System.Exception innerExce...

FILE: shadowsocks-csharp/Encryption/IEncryptor.cs
  type IEncryptor (line 5) | public interface IEncryptor : IDisposable
    method Encrypt (line 9) | void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength);
    method Decrypt (line 10) | void Decrypt(byte[] buf, int length, byte[] outbuf, out int outlength);
    method EncryptUDP (line 11) | void EncryptUDP(byte[] buf, int length, byte[] outbuf, out int outleng...
    method DecryptUDP (line 12) | void DecryptUDP(byte[] buf, int length, byte[] outbuf, out int outleng...

FILE: shadowsocks-csharp/Encryption/MbedTLS.cs
  class MbedTLS (line 11) | public static class MbedTLS
    method MbedTLS (line 20) | static MbedTLS()
    method MD5 (line 37) | public static byte[] MD5(byte[] input)
    method LoadLibrary (line 45) | [DllImport("Kernel32.dll")]
    method md5_ret (line 48) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_get_size_ex (line 55) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_info_from_string (line 60) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_init (line 63) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_setup (line 66) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_setkey (line 70) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_set_iv (line 73) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_reset (line 76) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_update (line 79) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_free (line 82) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_auth_encrypt (line 85) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method cipher_auth_decrypt (line 93) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method hkdf (line 101) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]

FILE: shadowsocks-csharp/Encryption/OpenSSL.cs
  class OpenSSL (line 15) | public static class OpenSSL
    method OpenSSL (line 28) | static OpenSSL()
    method GetCipherInfo (line 45) | public static IntPtr GetCipherInfo(string cipherName)
    method SetCtxNonce (line 58) | public static void SetCtxNonce(IntPtr ctx, byte[] nonce, bool isEncrypt)
    method AEADGetTag (line 67) | public static void AEADGetTag(IntPtr ctx, byte[] tagbuf, int taglen)
    method AEADSetTag (line 88) | public static void AEADSetTag(IntPtr ctx, byte[] tagbuf, int taglen)
    method LoadLibrary (line 114) | [DllImport("Kernel32.dll")]
    method EVP_CIPHER_CTX_new (line 117) | [SuppressUnmanagedCodeSecurity]
    method EVP_CIPHER_CTX_free (line 121) | [SuppressUnmanagedCodeSecurity]
    method EVP_CIPHER_CTX_reset (line 125) | [SuppressUnmanagedCodeSecurity]
    method EVP_CipherInit_ex (line 129) | [SuppressUnmanagedCodeSecurity]
    method EVP_CipherUpdate (line 134) | [SuppressUnmanagedCodeSecurity]
    method EVP_CipherFinal_ex (line 139) | [SuppressUnmanagedCodeSecurity]
    method EVP_CIPHER_CTX_set_padding (line 143) | [SuppressUnmanagedCodeSecurity]
    method EVP_CIPHER_CTX_set_key_length (line 147) | [SuppressUnmanagedCodeSecurity]
    method EVP_CIPHER_CTX_ctrl (line 151) | [SuppressUnmanagedCodeSecurity]
    method EVP_get_cipherbyname (line 160) | [SuppressUnmanagedCodeSecurity]

FILE: shadowsocks-csharp/Encryption/RNG.cs
  class RNG (line 6) | public static class RNG
    method Init (line 10) | public static void Init()
    method Close (line 15) | public static void Close()
    method Reload (line 21) | public static void Reload()
    method GetBytes (line 27) | public static void GetBytes(byte[] buf)
    method GetBytes (line 32) | public static void GetBytes(byte[] buf, int len)

FILE: shadowsocks-csharp/Encryption/Sodium.cs
  class Sodium (line 11) | public static class Sodium
    method Sodium (line 22) | static Sodium()
    method LoadLibrary (line 57) | [DllImport("Kernel32.dll")]
    method sodium_init (line 60) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_aead_aes256gcm_is_available (line 63) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method sodium_increment (line 68) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_aead_chacha20poly1305_ietf_encrypt (line 71) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_aead_chacha20poly1305_ietf_decrypt (line 75) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_aead_xchacha20poly1305_ietf_encrypt (line 79) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_aead_xchacha20poly1305_ietf_decrypt (line 83) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_aead_aes256gcm_encrypt (line 87) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_aead_aes256gcm_decrypt (line 91) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_stream_salsa20_xor_ic (line 99) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_stream_chacha20_xor_ic (line 103) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
    method crypto_stream_chacha20_ietf_xor_ic (line 107) | [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]

FILE: shadowsocks-csharp/Encryption/Stream/PlainEncryptor.cs
  class PlainEncryptor (line 6) | class PlainEncryptor
    method PlainEncryptor (line 16) | public PlainEncryptor(string method, string password) : base(method, p...
    method SupportedCiphers (line 20) | public static List<string> SupportedCiphers()
    method getCiphers (line 25) | protected Dictionary<string, EncryptorInfo> getCiphers()
    method Encrypt (line 32) | public override void Encrypt(byte[] buf, int length, byte[] outbuf, ou...
    method Decrypt (line 38) | public override void Decrypt(byte[] buf, int length, byte[] outbuf, ou...
    method EncryptUDP (line 48) | public override void EncryptUDP(byte[] buf, int length, byte[] outbuf,...
    method DecryptUDP (line 54) | public override void DecryptUDP(byte[] buf, int length, byte[] outbuf,...
    method Dispose (line 70) | public override void Dispose()
    method Dispose (line 81) | protected virtual void Dispose(bool disposing)

FILE: shadowsocks-csharp/Localization/LocalizationProvider.cs
  class LocalizationProvider (line 6) | public static class LocalizationProvider
    method GetLocalizedValue (line 8) | public static T GetLocalizedValue<T>(string key)

FILE: shadowsocks-csharp/Localization/Strings.Designer.cs
  class Strings (line 22) | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resource...
    method Strings (line 31) | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Mic...

FILE: shadowsocks-csharp/Model/Configuration.cs
  class Configuration (line 13) | [Serializable]
    method Configuration (line 63) | public Configuration()
    method GetCurrentServer (line 128) | public Server GetCurrentServer()
    method CheckServer (line 149) | public static void CheckServer(Server server)
    method Load (line 161) | public static Configuration Load()
    method Process (line 189) | public static void Process(ref Configuration config)
    method Save (line 248) | public static void Save(Configuration config)
    method SortByOnlineConfig (line 278) | public static List<Server> SortByOnlineConfig(IEnumerable<Server> serv...
    method ValidateGeositeGroupList (line 295) | public static bool ValidateGeositeGroupList(List<string> groups)
    method ResetGeositeDirectGroup (line 311) | public static void ResetGeositeDirectGroup(ref List<string> geositeDir...
    method ResetGeositeProxiedGroup (line 319) | public static void ResetGeositeProxiedGroup(ref List<string> geositePr...
    method ResetUserAgent (line 325) | public static void ResetUserAgent(Configuration config)
    method AddDefaultServerOrServer (line 331) | public static Server AddDefaultServerOrServer(Configuration config, Se...
    method GetDefaultServer (line 347) | public static Server GetDefaultServer()
    method CheckPort (line 352) | public static void CheckPort(int port)
    method CheckLocalPort (line 358) | public static void CheckLocalPort(int port)
    method CheckPassword (line 365) | private static void CheckPassword(string password)
    method CheckServer (line 371) | public static void CheckServer(string server)
    method CheckTimeout (line 377) | public static void CheckTimeout(int timeout, int maxTimeout)

FILE: shadowsocks-csharp/Model/ForwardProxyConfig.cs
  class ForwardProxyConfig (line 5) | [Serializable]
    method ForwardProxyConfig (line 23) | public ForwardProxyConfig()
    method CheckConfig (line 35) | public void CheckConfig()

FILE: shadowsocks-csharp/Model/Geosite/Geosite.cs
  class GeositeReflection (line 13) | public static partial class GeositeReflection {
    method GeositeReflection (line 22) | static GeositeReflection() {
  class DomainObject (line 49) | public sealed partial class DomainObject : pb::IMessage<DomainObject> {
    method DomainObject (line 65) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method OnConstruction (line 70) | partial void OnConstruction();
    method DomainObject (line 72) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Clone (line 80) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Equals (line 126) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Equals (line 131) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method GetHashCode (line 145) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method ToString (line 157) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method WriteTo (line 162) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method CalculateSize (line 178) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method MergeFrom (line 194) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method MergeFrom (line 209) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    class Types (line 235) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
      type Type (line 240) | public enum Type {
      class Attribute (line 259) | public sealed partial class Attribute : pb::IMessage<Attribute> {
        method Attribute (line 275) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method OnConstruction (line 280) | partial void OnConstruction();
        method Attribute (line 282) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method Clone (line 297) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        type TypedValueOneofCase (line 337) | public enum TypedValueOneofCase {
        method ClearTypedValue (line 348) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method Equals (line 354) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method Equals (line 359) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method GetHashCode (line 374) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method ToString (line 387) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method WriteTo (line 392) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method CalculateSize (line 411) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method MergeFrom (line 429) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
        method MergeFrom (line 449) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  class Geosite (line 480) | public sealed partial class Geosite : pb::IMessage<Geosite> {
    method Geosite (line 496) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method OnConstruction (line 501) | partial void OnConstruction();
    method Geosite (line 503) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Clone (line 510) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Equals (line 536) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Equals (line 541) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method GetHashCode (line 554) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method ToString (line 565) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method WriteTo (line 570) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method CalculateSize (line 582) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method MergeFrom (line 595) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method MergeFrom (line 607) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
  class GeositeList (line 629) | public sealed partial class GeositeList : pb::IMessage<GeositeList> {
    method GeositeList (line 645) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method OnConstruction (line 650) | partial void OnConstruction();
    method GeositeList (line 652) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Clone (line 658) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Equals (line 673) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method Equals (line 678) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method GetHashCode (line 690) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method ToString (line 700) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method WriteTo (line 705) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method CalculateSize (line 713) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method MergeFrom (line 723) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    method MergeFrom (line 732) | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]

FILE: shadowsocks-csharp/Model/HotKeyConfig.cs
  class HotkeyConfig (line 11) | [Serializable]
    method HotkeyConfig (line 22) | public HotkeyConfig()

FILE: shadowsocks-csharp/Model/LogViewerConfig.cs
  class LogViewerConfig (line 8) | [Serializable]
    method LogViewerConfig (line 21) | public LogViewerConfig()
    method SaveSize (line 31) | public void SaveSize()

FILE: shadowsocks-csharp/Model/NlogConfig.cs
  class NLogConfig (line 12) | public class NLogConfig
    type LogLevel (line 14) | public enum LogLevel
    method LoadXML (line 35) | public static NLogConfig LoadXML()
    method SaveXML (line 47) | public static void SaveXML(NLogConfig nLogConfig)
    method GetLogLevel (line 57) | public LogLevel GetLogLevel()
    method GetLogFileName (line 69) | public string GetLogFileName()
    method SetLogLevel (line 78) | public void SetLogLevel(LogLevel logLevel)
    method SetLogFileName (line 87) | public void SetLogFileName(string fileName)
    method SelectSingleNode (line 98) | private static XmlNode SelectSingleNode(XmlDocument doc, string xpath)
    method TouchAndApplyNLogConfig (line 109) | public static void TouchAndApplyNLogConfig()
    method LoadConfiguration (line 130) | public static void LoadConfiguration()

FILE: shadowsocks-csharp/Model/Server.cs
  class Server (line 14) | [Serializable]
    method GetHashCode (line 55) | public override int GetHashCode()
    method Equals (line 60) | public override bool Equals(object obj) => obj is Server o2 && server ...
    method ToString (line 62) | public override string ToString()
    method GetURL (line 75) | public string GetURL(bool legacyUrl = false)
    method Server (line 137) | public Server()
    method ParseLegacyURL (line 150) | private static Server ParseLegacyURL(string ssURL)
    method ParseURL (line 183) | public static Server ParseURL(string serverUrl)
    method GetServers (line 252) | public static List<Server> GetServers(string ssURL)
    method Identifier (line 261) | public string Identifier()

FILE: shadowsocks-csharp/Model/SysproxyConfig.cs
  class SysproxyConfig (line 9) | [Serializable]
    method SysproxyConfig (line 18) | public SysproxyConfig()

FILE: shadowsocks-csharp/Program.cs
  class Program (line 24) | internal static class Program
    method Main (line 43) | [STAThread]
    method CurrentDomain_UnhandledException (line 161) | private static void CurrentDomain_UnhandledException(object sender, Un...
    method Application_ThreadException (line 174) | private static void Application_ThreadException(object sender, ThreadE...
    method SystemEvents_PowerModeChanged (line 187) | private static void SystemEvents_PowerModeChanged(object sender, Power...
    method Application_ApplicationExit (line 221) | private static void Application_ApplicationExit(object sender, EventAr...

FILE: shadowsocks-csharp/Properties/Resources.Designer.cs
  class Resources (line 22) | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resource...
    method Resources (line 31) | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Mic...

FILE: shadowsocks-csharp/Properties/Settings.Designer.cs
  class Settings (line 14) | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]

FILE: shadowsocks-csharp/Proxy/DirectConnect.cs
  class DirectConnect (line 9) | public class DirectConnect : IProxy
    class FakeAsyncResult (line 11) | private class FakeAsyncResult : IAsyncResult
      method FakeAsyncResult (line 13) | public FakeAsyncResult(object state)
    class FakeEndPoint (line 24) | private class FakeEndPoint : EndPoint
      method ToString (line 28) | public override string ToString()
    method BeginConnectProxy (line 41) | public void BeginConnectProxy(EndPoint remoteEP, AsyncCallback callbac...
    method EndConnectProxy (line 49) | public void EndConnectProxy(IAsyncResult asyncResult)
    method BeginConnectDest (line 54) | public void BeginConnectDest(EndPoint destEndPoint, AsyncCallback call...
    method EndConnectDest (line 61) | public void EndConnectDest(IAsyncResult asyncResult)
    method BeginSend (line 67) | public void BeginSend(byte[] buffer, int offset, int size, SocketFlags...
    method EndSend (line 73) | public int EndSend(IAsyncResult asyncResult)
    method BeginReceive (line 78) | public void BeginReceive(byte[] buffer, int offset, int size, SocketFl...
    method EndReceive (line 84) | public int EndReceive(IAsyncResult asyncResult)
    method Shutdown (line 89) | public void Shutdown(SocketShutdown how)
    method Close (line 94) | public void Close()

FILE: shadowsocks-csharp/Proxy/HttpProxy.cs
  class HttpProxy (line 13) | public class HttpProxy : IProxy
    class FakeAsyncResult (line 17) | private class FakeAsyncResult : IAsyncResult
      method FakeAsyncResult (line 23) | public FakeAsyncResult(IAsyncResult orig, HttpState state)
    class HttpState (line 35) | private class HttpState
    method BeginConnectProxy (line 53) | public void BeginConnectProxy(EndPoint remoteEP, AsyncCallback callbac...
    method EndConnectProxy (line 60) | public void EndConnectProxy(IAsyncResult asyncResult)
    method BeginConnectDest (line 76) | public void BeginConnectDest(EndPoint destEndPoint, AsyncCallback call...
    method EndConnectDest (line 96) | public void EndConnectDest(IAsyncResult asyncResult)
    method BeginSend (line 106) | public void BeginSend(byte[] buffer, int offset, int size, SocketFlags...
    method EndSend (line 112) | public int EndSend(IAsyncResult asyncResult)
    method BeginReceive (line 117) | public void BeginReceive(byte[] buffer, int offset, int size, SocketFl...
    method EndReceive (line 123) | public int EndReceive(IAsyncResult asyncResult)
    method Shutdown (line 128) | public void Shutdown(SocketShutdown how)
    method Close (line 133) | public void Close()
    method HttpRequestSendCallback (line 138) | private void HttpRequestSendCallback(IAsyncResult ar)
    method OnFinish (line 155) | private void OnFinish(byte[] lastBytes, int index, int length, object ...
    method OnException (line 170) | private void OnException(Exception ex, object state)
    method OnLineRead (line 181) | private bool OnLineRead(string line, object state)

FILE: shadowsocks-csharp/Proxy/IProxy.cs
  type IProxy (line 8) | public interface IProxy
    method BeginConnectProxy (line 16) | void BeginConnectProxy(EndPoint remoteEP, AsyncCallback callback, obje...
    method EndConnectProxy (line 18) | void EndConnectProxy(IAsyncResult asyncResult);
    method BeginConnectDest (line 20) | void BeginConnectDest(EndPoint destEndPoint, AsyncCallback callback, o...
    method EndConnectDest (line 22) | void EndConnectDest(IAsyncResult asyncResult);
    method BeginSend (line 24) | void BeginSend(byte[] buffer, int offset, int size, SocketFlags socket...
    method EndSend (line 27) | int EndSend(IAsyncResult asyncResult);
    method BeginReceive (line 29) | void BeginReceive(byte[] buffer, int offset, int size, SocketFlags soc...
    method EndReceive (line 32) | int EndReceive(IAsyncResult asyncResult);
    method Shutdown (line 34) | void Shutdown(SocketShutdown how);
    method Close (line 36) | void Close();

FILE: shadowsocks-csharp/Proxy/Socks5Proxy.cs
  class Socks5Proxy (line 11) | public class Socks5Proxy : IProxy
    class FakeAsyncResult (line 13) | private class FakeAsyncResult : IAsyncResult
      method FakeAsyncResult (line 19) | public FakeAsyncResult(IAsyncResult orig, Socks5State state)
    class Socks5State (line 31) | private class Socks5State
    method BeginConnectProxy (line 51) | public void BeginConnectProxy(EndPoint remoteEP, AsyncCallback callbac...
    method EndConnectProxy (line 62) | public void EndConnectProxy(IAsyncResult asyncResult)
    method BeginConnectDest (line 72) | public void BeginConnectDest(EndPoint destEndPoint, AsyncCallback call...
    method EndConnectDest (line 131) | public void EndConnectDest(IAsyncResult asyncResult)
    method BeginSend (line 141) | public void BeginSend(byte[] buffer, int offset, int size, SocketFlags...
    method EndSend (line 147) | public int EndSend(IAsyncResult asyncResult)
    method BeginReceive (line 152) | public void BeginReceive(byte[] buffer, int offset, int size, SocketFl...
    method EndReceive (line 158) | public int EndReceive(IAsyncResult asyncResult)
    method Shutdown (line 163) | public void Shutdown(SocketShutdown how)
    method Close (line 168) | public void Close()
    method ConnectCallback (line 174) | private void ConnectCallback(IAsyncResult ar)
    method Socks5HandshakeSendCallback (line 193) | private void Socks5HandshakeSendCallback(IAsyncResult ar)
    method Socks5HandshakeReceiveCallback (line 209) | private void Socks5HandshakeReceiveCallback(IAsyncResult ar)
    method Socks5RequestSendCallback (line 237) | private void Socks5RequestSendCallback(IAsyncResult ar)
    method Socks5ReplyReceiveCallback (line 253) | private void Socks5ReplyReceiveCallback(IAsyncResult ar)
    method Socks5ReplyReceiveCallback2 (line 300) | private void Socks5ReplyReceiveCallback2(IAsyncResult ar)

FILE: shadowsocks-csharp/Settings.cs
  class Settings (line 9) | internal sealed partial class Settings {
    method Settings (line 11) | public Settings() {
    method SettingChangingEventHandler (line 20) | private void SettingChangingEventHandler(object sender, System.Configu...
    method SettingsSavingEventHandler (line 24) | private void SettingsSavingEventHandler(object sender, System.Componen...

FILE: shadowsocks-csharp/Util/ProcessManagement/Job.cs
  class Job (line 13) | public class Job : IDisposable
    method Job (line 19) | public Job()
    method AddProcess (line 54) | public bool AddProcess(IntPtr processHandle)
    method AddProcess (line 66) | public bool AddProcess(int processId)
    method Dispose (line 75) | public void Dispose()
    method Dispose (line 81) | protected virtual void Dispose(bool disposing)
    method CreateJobObject (line 107) | [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
    method SetInformationJobObject (line 110) | [DllImport("kernel32.dll", SetLastError = true)]
    method AssignProcessToJobObject (line 113) | [DllImport("kernel32.dll", SetLastError = true)]
    method CloseHandle (line 116) | [DllImport("kernel32.dll", SetLastError = true)]
  type IO_COUNTERS (line 125) | [StructLayout(LayoutKind.Sequential)]
  type JOBOBJECT_BASIC_LIMIT_INFORMATION (line 137) | [StructLayout(LayoutKind.Sequential)]
  type SECURITY_ATTRIBUTES (line 151) | [StructLayout(LayoutKind.Sequential)]
  type JOBOBJECT_EXTENDED_LIMIT_INFORMATION (line 159) | [StructLayout(LayoutKind.Sequential)]
  type JobObjectInfoType (line 170) | public enum JobObjectInfoType

FILE: shadowsocks-csharp/Util/ProcessManagement/ThreadUtil.cs
  class ThreadUtil (line 7) | static class ThreadUtil
    method GetCommandLine (line 14) | public static string GetCommandLine(this Process process)

FILE: shadowsocks-csharp/Util/Sockets/LineReader.cs
  class LineReader (line 6) | public class LineReader
    method LineReader (line 23) | public LineReader(WrappedSocket socket, Func<string, object, bool> onL...
    method ReceiveCallback (line 73) | private void ReceiveCallback(IAsyncResult ar)
    method OnException (line 129) | private void OnException(Exception ex)
    method OnFinish (line 134) | private void OnFinish(int length)
    method IndexOf (line 141) | public static int IndexOf(byte[] haystack, int index, int length, byte...
    method MakeCharTable (line 162) | private static int[] MakeCharTable(byte[] needle)
    method MakeOffsetTable (line 180) | private static int[] MakeOffsetTable(byte[] needle)
    method IsPrefix (line 203) | private static bool IsPrefix(byte[] needle, int p)
    method SuffixLength (line 218) | private static int SuffixLength(byte[] needle, int p)

FILE: shadowsocks-csharp/Util/Sockets/SocketUtil.cs
  class SocketUtil (line 7) | public static class SocketUtil
    class DnsEndPoint2 (line 9) | private class DnsEndPoint2 : DnsEndPoint
      method DnsEndPoint2 (line 11) | public DnsEndPoint2(string host, int port) : base(host, port)
      method DnsEndPoint2 (line 15) | public DnsEndPoint2(string host, int port, AddressFamily addressFami...
      method ToString (line 19) | public override string ToString()
    method GetEndPoint (line 25) | public static EndPoint GetEndPoint(string host, int port)
    method FullClose (line 39) | public static void FullClose(this System.Net.Sockets.Socket s)

FILE: shadowsocks-csharp/Util/Sockets/WrappedSocket.cs
  class WrappedSocket (line 17) | public class WrappedSocket
    method BeginConnect (line 29) | public void BeginConnect(EndPoint remoteEP, AsyncCallback callback, ob...
    class FakeAsyncResult (line 51) | private class FakeAsyncResult : IAsyncResult
    class TcpUserToken (line 60) | private class TcpUserToken
      method TcpUserToken (line 65) | public TcpUserToken(AsyncCallback callback, object state)
    method OnTcpConnectCompleted (line 72) | private void OnTcpConnectCompleted(object sender, SocketAsyncEventArgs...
    method EndConnect (line 130) | public void EndConnect(IAsyncResult asyncResult)
    method Dispose (line 149) | public void Dispose()
    method BeginSend (line 175) | public IAsyncResult BeginSend(byte[] buffer, int offset, int size, Soc...
    method EndSend (line 191) | public int EndSend(IAsyncResult asyncResult)
    method BeginReceive (line 205) | public IAsyncResult BeginReceive(byte[] buffer, int offset, int size, ...
    method EndReceive (line 221) | public int EndReceive(IAsyncResult asyncResult)
    method Shutdown (line 235) | public void Shutdown(SocketShutdown how)
    method SetSocketOption (line 249) | public void SetSocketOption(SocketOptionLevel optionLevel, SocketOptio...
    method SetSocketOption (line 254) | public void SetSocketOption(SocketOptionLevel optionLevel, SocketOptio...

FILE: shadowsocks-csharp/Util/SystemProxy/ProxyException.cs
  type ProxyExceptionType (line 10) | enum ProxyExceptionType
  class ProxyException (line 19) | class ProxyException : Exception
    method ProxyException (line 24) | public ProxyException()
    method ProxyException (line 28) | public ProxyException(string message) : base(message)
    method ProxyException (line 32) | public ProxyException(string message, Exception innerException) : base...
    method ProxyException (line 36) | protected ProxyException(SerializationInfo info, StreamingContext cont...
    method ProxyException (line 39) | public ProxyException(ProxyExceptionType type)
    method ProxyException (line 44) | public ProxyException(ProxyExceptionType type, string message) : base(...
    method ProxyException (line 49) | public ProxyException(ProxyExceptionType type, string message, Excepti...
    method ProxyException (line 54) | protected ProxyException(ProxyExceptionType type, SerializationInfo in...

FILE: shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs
  class Sysproxy (line 16) | public static class Sysproxy
    type RET_ERRORS (line 57) | enum RET_ERRORS : int
    method Sysproxy (line 67) | static Sysproxy()
    method SetIEProxy (line 80) | public static void SetIEProxy(bool enable, bool global, string proxySe...
    method ResetIEProxy (line 122) | public static bool ResetIEProxy()
    method ExecSysproxy (line 140) | private static void ExecSysproxy(string arguments)
    method Save (line 226) | private static void Save()
    method Read (line 243) | private static void Read()
    method ParseQueryStr (line 260) | private static void ParseQueryStr(string str)

FILE: shadowsocks-csharp/Util/Util.cs
  type BandwidthScaleInfo (line 18) | public struct BandwidthScaleInfo
    method BandwidthScaleInfo (line 24) | public BandwidthScaleInfo(float value, string unitName, long unit)
  class Utils (line 32) | public static class Utils
    method GetTempPath (line 39) | public static string GetTempPath()
    type WindowsThemeMode (line 65) | public enum WindowsThemeMode { Dark, Light }
    method GetWindows10SystemThemeSetting (line 68) | public static WindowsThemeMode GetWindows10SystemThemeSetting()
    method GetTempPath (line 97) | public static string GetTempPath(string filename)
    method UnGzip (line 102) | public static string UnGzip(byte[] buf)
    method FormatBandwidth (line 121) | public static string FormatBandwidth(long n)
    method FormatBytes (line 127) | public static string FormatBytes(long bytes)
    method GetBandwidthScale (line 172) | public static BandwidthScaleInfo GetBandwidthScale(long n)
    method OpenRegKey (line 204) | public static RegistryKey OpenRegKey(string name, bool writable, Regis...
    method IsWinVistaOrHigher (line 229) | public static bool IsWinVistaOrHigher()
    method ScanQRCodeFromScreen (line 234) | public static string ScanQRCodeFromScreen()
    method IsSupportedRuntimeVersion (line 277) | public static bool IsSupportedRuntimeVersion()

FILE: shadowsocks-csharp/Util/ViewUtils.cs
  class ViewUtils (line 13) | public static class ViewUtils
    method GetChildControls (line 15) | public static IEnumerable<TControl> GetChildControls<TControl>(this Co...
    method GetMenuItems (line 25) | public static IEnumerable<MenuItem> GetMenuItems(Menu m)
    method SetNotifyIconText (line 38) | public static void SetNotifyIconText(NotifyIcon ni, string text)
    method AddBitmapOverlay (line 49) | public static Bitmap AddBitmapOverlay(Bitmap original, params Bitmap[]...
    method ChangeBitmapColor (line 62) | public static Bitmap ChangeBitmapColor(Bitmap original, Color colorMask)
    method ResizeBitmap (line 88) | public static Bitmap ResizeBitmap(Bitmap original, int width, int height)
    method GetScreenDpi (line 102) | public static int GetScreenDpi()

FILE: shadowsocks-csharp/View/ConfigForm.Designer.cs
  class ConfigForm (line 3) | partial class ConfigForm
    method Dispose (line 14) | protected override void Dispose(bool disposing)
    method InitializeComponent (line 29) | private void InitializeComponent()

FILE: shadowsocks-csharp/View/ConfigForm.cs
  class ConfigForm (line 12) | public partial class ConfigForm : Form
    class EncryptionMethod (line 22) | private class EncryptionMethod
      method Init (line 49) | private static void Init()
      method GetMethod (line 63) | public static EncryptionMethod GetMethod(string name)
      method EncryptionMethod (line 76) | private EncryptionMethod(string name, bool deprecated)
      method ToString (line 82) | public override string ToString()
    method ConfigForm (line 88) | public ConfigForm(ShadowsocksController controller)
    method UpdateTexts (line 106) | private void UpdateTexts()
    method SetupValueChangedListeners (line 112) | private void SetupValueChangedListeners()
    method Controller_ConfigChanged (line 127) | private void Controller_ConfigChanged(object sender, EventArgs e)
    method ConfigValueChanged (line 132) | private void ConfigValueChanged(object sender, EventArgs e)
    method ValidateAndSaveSelectedServerDetails (line 138) | private bool ValidateAndSaveSelectedServerDetails(bool isSave = false,...
    method GetServerDetailsFromUI (line 165) | private bool GetServerDetailsFromUI(out Server server, bool isSave = f...
    method CheckIPTextBox (line 216) | private bool? CheckIPTextBox(out string address, bool isSave, bool isC...
    method CheckServerPortTextBox (line 255) | private bool? CheckServerPortTextBox(out int? addressPort, bool isSave...
    method CheckPasswordTextBox (line 293) | private bool? CheckPasswordTextBox(out string password, bool isSave, b...
    method CheckTimeoutTextBox (line 332) | private bool? CheckTimeoutTextBox(out int? timeout, bool isSave, bool ...
    method LoadSelectedServerDetails (line 372) | private void LoadSelectedServerDetails()
    method SetServerDetailsToUI (line 381) | private void SetServerDetailsToUI(Server server)
    method ShowHidePluginArgInput (line 403) | private void ShowHidePluginArgInput(bool show)
    method LoadServerNameListToUI (line 409) | private void LoadServerNameListToUI(Configuration configuration)
    method LoadCurrentConfiguration (line 418) | private void LoadCurrentConfiguration()
    method SaveValidConfiguration (line 439) | private bool SaveValidConfiguration()
    method ConfigForm_KeyDown (line 460) | private void ConfigForm_KeyDown(object sender, KeyEventArgs e)
    method ServersListBox_SelectedIndexChanged (line 470) | private void ServersListBox_SelectedIndexChanged(object sender, EventA...
    method AddButton_Click (line 496) | private void AddButton_Click(object sender, EventArgs e)
    method DuplicateButton_Click (line 506) | private void DuplicateButton_Click(object sender, EventArgs e)
    method DeleteButton_Click (line 517) | private void DeleteButton_Click(object sender, EventArgs e)
    method UpdateButtons (line 537) | private void UpdateButtons()
    method MoveUpButton_Click (line 544) | private void MoveUpButton_Click(object sender, EventArgs e)
    method MoveDownButton_Click (line 552) | private void MoveDownButton_Click(object sender, EventArgs e)
    method MoveConfigItem (line 560) | private void MoveConfigItem(int step)
    method OKButton_Click (line 579) | private void OKButton_Click(object sender, EventArgs e)
    method CancelButton_Click (line 587) | private void CancelButton_Click(object sender, EventArgs e)
    method ApplyButton_Click (line 592) | private void ApplyButton_Click(object sender, EventArgs e)
    method ConfigForm_Shown (line 597) | private void ConfigForm_Shown(object sender, EventArgs e)
    method ConfigForm_FormClosed (line 602) | private void ConfigForm_FormClosed(object sender, FormClosedEventArgs e)
    method ShowPasswdCheckBox_CheckedChanged (line 607) | private void ShowPasswdCheckBox_CheckedChanged(object sender, EventArg...
    method UsePluginArgCheckBox_CheckedChanged (line 612) | private void UsePluginArgCheckBox_CheckedChanged(object sender, EventA...
    method EncryptionSelect_SelectedIndexChanged (line 617) | private void EncryptionSelect_SelectedIndexChanged(object sender, Even...

FILE: shadowsocks-csharp/View/LogForm.Designer.cs
  class LogForm (line 3) | partial class LogForm
    method Dispose (line 14) | protected override void Dispose(bool disposing)
    method InitializeComponent (line 29) | private void InitializeComponent()

FILE: shadowsocks-csharp/View/LogForm.cs
  class LogForm (line 18) | public partial class LogForm : Form
    method LogForm (line 44) | public LogForm(ShadowsocksController controller)
    method UpdateTrafficChart (line 79) | private void UpdateTrafficChart()
    method controller_TrafficChanged (line 132) | private void controller_TrafficChanged(object sender, EventArgs e)
    method UpdateTexts (line 163) | private void UpdateTexts()
    method Timer_Tick (line 170) | private void Timer_Tick(object sender, EventArgs e)
    method InitContent (line 176) | private void InitContent()
    method UpdateContent (line 201) | private void UpdateContent()
    method LogForm_Load (line 238) | private void LogForm_Load(object sender, EventArgs e)
    method LogForm_FormClosing (line 269) | private void LogForm_FormClosing(object sender, FormClosingEventArgs e)
    method OpenLocationMenuItem_Click (line 291) | private void OpenLocationMenuItem_Click(object sender, EventArgs e)
    method ExitMenuItem_Click (line 298) | private void ExitMenuItem_Click(object sender, EventArgs e)
    method LogForm_Shown (line 303) | private void LogForm_Shown(object sender, EventArgs e)
    method DoClearLogs (line 309) | private void DoClearLogs()
    method ClearLogsMenuItem_Click (line 320) | private void ClearLogsMenuItem_Click(object sender, EventArgs e)
    method ClearLogsButton_Click (line 325) | private void ClearLogsButton_Click(object sender, EventArgs e)
    method DoChangeFont (line 332) | private void DoChangeFont()
    method ChangeFontMenuItem_Click (line 350) | private void ChangeFontMenuItem_Click(object sender, EventArgs e)
    method ChangeFontButton_Click (line 355) | private void ChangeFontButton_Click(object sender, EventArgs e)
    method TriggerWrapText (line 365) | private void TriggerWrapText()
    method WrapTextMenuItem_Click (line 377) | private void WrapTextMenuItem_Click(object sender, EventArgs e)
    method WrapTextCheckBox_CheckedChanged (line 385) | private void WrapTextCheckBox_CheckedChanged(object sender, EventArgs e)
    method TriggerTopMost (line 398) | private void TriggerTopMost()
    method TopMostCheckBox_CheckedChanged (line 409) | private void TopMostCheckBox_CheckedChanged(object sender, EventArgs e)
    method TopMostMenuItem_Click (line 417) | private void TopMostMenuItem_Click(object sender, EventArgs e)
    method ShowToolbarMenuItem_Click (line 428) | private void ShowToolbarMenuItem_Click(object sender, EventArgs e)
    class TrafficInfo (line 435) | private class TrafficInfo
      method TrafficInfo (line 440) | public TrafficInfo(long inbound, long outbound)

FILE: shadowsocks-csharp/View/MenuViewController.cs
  class MenuViewController (line 23) | public class MenuViewController
    method MenuViewController (line 77) | public MenuViewController(ShadowsocksController controller)
    method UpdateTrayIconAndNotifyText (line 125) | private void UpdateTrayIconAndNotifyText()
    method SelectIconSize (line 166) | private Size SelectIconSize()
    method SelectColorMask (line 193) | private Color SelectColorMask(bool isProxyEnabled, bool isGlobalProxy)
    method UpdateIconSet (line 228) | private void UpdateIconSet(Color colorMask, Size size,
    method CreateMenuItem (line 247) | private MenuItem CreateMenuItem(string text, EventHandler click)
    method CreateMenuGroup (line 252) | private MenuItem CreateMenuGroup(string text, MenuItem[] items)
    method LoadMenu (line 257) | private void LoadMenu()
    method controller_TrafficChanged (line 313) | private void controller_TrafficChanged(object sender, EventArgs e)
    method controller_Errored (line 339) | void controller_Errored(object sender, ErrorEventArgs e)
    method controller_ConfigChanged (line 344) | private void controller_ConfigChanged(object sender, EventArgs e)
    method LoadCurrentConfiguration (line 350) | private void LoadCurrentConfiguration()
    method ShowConfigForm (line 370) | private void ShowConfigForm()
    method ShowLogForm (line 385) | private void ShowLogForm()
    method logForm_FormClosed (line 400) | void logForm_FormClosed(object sender, FormClosedEventArgs e)
    method configForm_FormClosed (line 406) | void configForm_FormClosed(object sender, FormClosedEventArgs e)
    method ShowBalloonTip (line 428) | void ShowBalloonTip(string title, string content, ToolTipIcon icon, in...
    method notifyIcon1_BalloonTipClicked (line 436) | void notifyIcon1_BalloonTipClicked(object sender, EventArgs e)
    method _notifyIcon_BalloonTipClosed (line 440) | private void _notifyIcon_BalloonTipClosed(object sender, EventArgs e)
    method notifyIcon1_Click (line 444) | private void notifyIcon1_Click(object sender, MouseEventArgs e)
    method notifyIcon1_DoubleClick (line 453) | private void notifyIcon1_DoubleClick(object sender, MouseEventArgs e)
    method CheckUpdateForFirstRun (line 461) | private void CheckUpdateForFirstRun()
    method ShowLogForm_HotKey (line 470) | public void ShowLogForm_HotKey()
    method controller_ShareOverLANStatusChanged (line 479) | void controller_ShareOverLANStatusChanged(object sender, EventArgs e)
    method proxyItem_Click (line 484) | private void proxyItem_Click(object sender, EventArgs e)
    method ForwardProxyWindow_Closed (line 504) | private void ForwardProxyWindow_Closed(object sender, EventArgs e)
    method CloseForwardProxyWindow (line 509) | public void CloseForwardProxyWindow() => forwardProxyWindow.Close();
    method OnlineConfig_Click (line 511) | private void OnlineConfig_Click(object sender, EventArgs e)
    method OnlineConfigWindow_Closed (line 531) | private void OnlineConfigWindow_Closed(object sender, EventArgs e)
    method hotKeyItem_Click (line 536) | private void hotKeyItem_Click(object sender, EventArgs e)
    method HotkeysWindow_Closed (line 556) | private void HotkeysWindow_Closed(object sender, EventArgs e)
    method CloseHotkeysWindow (line 561) | public void CloseHotkeysWindow() => hotkeysWindow.Close();
    method ShareOverLANItem_Click (line 563) | private void ShareOverLANItem_Click(object sender, EventArgs e)
    method AutoStartupItem_Click (line 569) | private void AutoStartupItem_Click(object sender, EventArgs e)
    method ProtocolHandlerItem_Click (line 579) | private void ProtocolHandlerItem_Click(object sender, EventArgs e)
    method Quit_Click (line 589) | private void Quit_Click(object sender, EventArgs e)
    method controller_EnableStatusChanged (line 600) | private void controller_EnableStatusChanged(object sender, EventArgs e)
    method EnableItem_Click (line 605) | private void EnableItem_Click(object sender, EventArgs e)
    method controller_EnableGlobalChanged (line 612) | void controller_EnableGlobalChanged(object sender, EventArgs e)
    method UpdateSystemProxyItemsEnabledStatus (line 618) | private void UpdateSystemProxyItemsEnabledStatus(Configuration config)
    method GlobalModeItem_Click (line 633) | private void GlobalModeItem_Click(object sender, EventArgs e)
    method PACModeItem_Click (line 641) | private void PACModeItem_Click(object sender, EventArgs e)
    method UpdateServersMenu (line 653) | private void UpdateServersMenu()
    method AServerItem_Click (line 725) | private void AServerItem_Click(object sender, EventArgs e)
    method AStrategyItem_Click (line 731) | private void AStrategyItem_Click(object sender, EventArgs e)
    method Config_Click (line 737) | private void Config_Click(object sender, EventArgs e)
    method openURLFromQRCode (line 742) | void openURLFromQRCode()
    method QRCodeItem_Click (line 747) | private void QRCodeItem_Click(object sender, EventArgs e)
    method ServerSharingWindow_Closed (line 767) | private void ServerSharingWindow_Closed(object sender, EventArgs e)
    method ScanQRCodeItem_Click (line 772) | private void ScanQRCodeItem_Click(object sender, EventArgs e)
    method ImportURLItem_Click (line 796) | private void ImportURLItem_Click(object sender, EventArgs e)
    method LocalPACItem_Click (line 808) | private void LocalPACItem_Click(object sender, EventArgs e)
    method OnlinePACItem_Click (line 819) | private void OnlinePACItem_Click(object sender, EventArgs e)
    method UpdateOnlinePACURLItem_Click (line 837) | private void UpdateOnlinePACURLItem_Click(object sender, EventArgs e)
    method SecureLocalPacUrlToggleItem_Click (line 850) | private void SecureLocalPacUrlToggleItem_Click(object sender, EventArg...
    method RegenerateLocalPacOnUpdateItem_Click (line 856) | private void RegenerateLocalPacOnUpdateItem_Click(object sender, Event...
    method CopyLocalPacUrlItem_Click (line 862) | private void CopyLocalPacUrlItem_Click(object sender, EventArgs e)
    method UpdatePACItemsEnabledStatus (line 867) | private void UpdatePACItemsEnabledStatus()
    method EditPACFileItem_Click (line 885) | private void EditPACFileItem_Click(object sender, EventArgs e)
    method UpdatePACFromGeositeItem_Click (line 890) | private async void UpdatePACFromGeositeItem_Click(object sender, Event...
    method EditUserRuleFileForGeositeItem_Click (line 895) | private void EditUserRuleFileForGeositeItem_Click(object sender, Event...
    method controller_FileReadyToOpen (line 900) | void controller_FileReadyToOpen(object sender, ShadowsocksController.P...
    method controller_UpdatePACFromGeositeError (line 907) | void controller_UpdatePACFromGeositeError(object sender, System.IO.Err...
    method controller_UpdatePACFromGeositeCompleted (line 913) | void controller_UpdatePACFromGeositeCompleted(object sender, GeositeRe...
    method controller_VerboseLoggingStatusChanged (line 925) | void controller_VerboseLoggingStatusChanged(object sender, EventArgs e)
    method controller_ShowPluginOutputChanged (line 930) | void controller_ShowPluginOutputChanged(object sender, EventArgs e)
    method VerboseLoggingToggleItem_Click (line 935) | private void VerboseLoggingToggleItem_Click(object sender, EventArgs e)
    method ShowLogItem_Click (line 941) | private void ShowLogItem_Click(object sender, EventArgs e)
    method ShowPluginOutputToggleItem_Click (line 946) | private void ShowPluginOutputToggleItem_Click(object sender, EventArgs e)
    method WriteI18NFileItem_Click (line 952) | private void WriteI18NFileItem_Click(object sender, EventArgs e)
    method updateChecker_CheckUpdateCompleted (line 961) | void updateChecker_CheckUpdateCompleted(object sender, EventArgs e)
    method UpdateUpdateMenu (line 970) | private void UpdateUpdateMenu()
    method autoCheckUpdatesToggleItem_Click (line 977) | private void autoCheckUpdatesToggleItem_Click(object sender, EventArgs e)
    method checkPreReleaseToggleItem_Click (line 984) | private void checkPreReleaseToggleItem_Click(object sender, EventArgs e)
    method checkUpdatesItem_Click (line 991) | private async void checkUpdatesItem_Click(object sender, EventArgs e)
    method AboutItem_Click (line 996) | private void AboutItem_Click(object sender, EventArgs e)

FILE: shadowsocks-csharp/ViewModels/ForwardProxyViewModel.cs
  class ForwardProxyViewModel (line 14) | public class ForwardProxyViewModel : ReactiveValidationObject
    method ForwardProxyViewModel (line 16) | public ForwardProxyViewModel()
    method GetForwardProxyConfig (line 106) | private ForwardProxyConfig GetForwardProxyConfig()

FILE: shadowsocks-csharp/ViewModels/HotkeysViewModel.cs
  class HotkeysViewModel (line 12) | public class HotkeysViewModel : ReactiveObject
    method HotkeysViewModel (line 14) | public HotkeysViewModel()
    method RecordKeyDown (line 87) | public void RecordKeyDown(int hotkeyIndex, KeyEventArgs keyEventArgs)
    method FinishOnKeyUp (line 126) | public void FinishOnKeyUp(int hotkeyIndex, KeyEventArgs keyEventArgs)
    method RegisterAllAndUpdateStatus (line 157) | private void RegisterAllAndUpdateStatus(bool save = false)

FILE: shadowsocks-csharp/ViewModels/OnlineConfigViewModel.cs
  class OnlineConfigViewModel (line 20) | public class OnlineConfigViewModel : ReactiveValidationObject
    method OnlineConfigViewModel (line 22) | public OnlineConfigViewModel()

FILE: shadowsocks-csharp/ViewModels/ServerSharingViewModel.cs
  class ServerSharingViewModel (line 15) | public class ServerSharingViewModel : ReactiveObject
    method ServerSharingViewModel (line 20) | public ServerSharingViewModel()
    method UpdateUrlAndImage (line 52) | private void UpdateUrlAndImage()

FILE: shadowsocks-csharp/ViewModels/VersionUpdatePromptViewModel.cs
  class VersionUpdatePromptViewModel (line 8) | public class VersionUpdatePromptViewModel : ReactiveObject
    method VersionUpdatePromptViewModel (line 10) | public VersionUpdatePromptViewModel(JToken releaseObject)

FILE: shadowsocks-csharp/Views/ForwardProxyView.xaml.cs
  class ForwardProxyView (line 10) | public partial class ForwardProxyView : ReactiveUserControl<ForwardProxy...
    method ForwardProxyView (line 12) | public ForwardProxyView()

FILE: shadowsocks-csharp/Views/HotkeysView.xaml.cs
  class HotkeysView (line 19) | public partial class HotkeysView : ReactiveUserControl<HotkeysViewModel>
    method HotkeysView (line 21) | public HotkeysView()

FILE: shadowsocks-csharp/Views/OnlineConfigView.xaml.cs
  class OnlineConfigView (line 10) | public partial class OnlineConfigView : ReactiveUserControl<OnlineConfig...
    method OnlineConfigView (line 12) | public OnlineConfigView()

FILE: shadowsocks-csharp/Views/ServerSharingView.xaml.cs
  class ServerSharingView (line 11) | public partial class ServerSharingView : ReactiveUserControl<ServerShari...
    method ServerSharingView (line 13) | public ServerSharingView()
    method urlTextBox_PreviewMouseDoubleClick (line 43) | private void urlTextBox_PreviewMouseDoubleClick(object sender, MouseBu...

FILE: shadowsocks-csharp/Views/VersionUpdatePromptView.xaml.cs
  class VersionUpdatePromptView (line 11) | public partial class VersionUpdatePromptView : ReactiveUserControl<Versi...
    method VersionUpdatePromptView (line 13) | public VersionUpdatePromptView(JToken releaseObject)

FILE: test/ProcessEnvironment.cs
  class ProcessEnvironment (line 53) | static class ProcessEnvironment
    method ReadEnvironmentVariables (line 55) | public static StringDictionary ReadEnvironmentVariables(this Process p...
    method TryReadEnvironmentVariables (line 60) | public static StringDictionary TryReadEnvironmentVariables(this Proces...
    method GetCommandLine (line 72) | public static string GetCommandLine(this Process process)
    type UniPtr (line 85) | struct UniPtr
      method UniPtr (line 87) | public UniPtr(IntPtr p)
      method UniPtr (line 93) | public UniPtr(long p)
      method ToString (line 112) | public override string ToString()
      method ToInt64 (line 141) | public long ToInt64()
    method _GetEnvironmentVariablesCore (line 147) | static StringDictionary _GetEnvironmentVariablesCore(IntPtr hProcess)
    method _EnvToDictionary (line 206) | static StringDictionary _EnvToDictionary(byte[] env)
    method _TryReadIntPtr32 (line 265) | static bool _TryReadIntPtr32(IntPtr hProcess, IntPtr ptr, out IntPtr r...
    method _TryReadIntPtr (line 293) | static bool _TryReadIntPtr(IntPtr hProcess, IntPtr ptr, out IntPtr rea...
    method _TryReadIntPtrWow64 (line 321) | static bool _TryReadIntPtrWow64(IntPtr hProcess, long ptr, out long re...
    method _GetPenv (line 349) | static UniPtr _GetPenv(IntPtr hProcess)
    method _GetProcessBitness (line 406) | static int _GetProcessBitness(IntPtr hProcess)
    method _GetPeb32 (line 423) | static IntPtr _GetPeb32(IntPtr hProcess)
    method _GetPebNative (line 446) | static IntPtr _GetPebNative(IntPtr hProcess)
    method _GetPeb64 (line 462) | static UniPtr _GetPeb64(IntPtr hProcess)
    method _HasReadAccess (line 486) | static bool _HasReadAccess(IntPtr hProcess, IntPtr address, out int size)
    method _HasReadAccessWow64 (line 518) | static bool _HasReadAccessWow64(IntPtr hProcess, long address, out int...
    class WindowsApi (line 572) | static class WindowsApi
      type PROCESS_BASIC_INFORMATION (line 574) | [StructLayout(LayoutKind.Sequential, Pack = 1)]
      method NtQueryInformationProcess (line 588) | [DllImport("ntdll.dll", SetLastError = true)]
      method NtQueryInformationProcess (line 596) | [DllImport("ntdll.dll", SetLastError = true)]
      method NtQueryInformationProcess (line 604) | [DllImport("ntdll.dll", SetLastError = true)]
      type PROCESS_BASIC_INFORMATION_WOW64 (line 612) | [StructLayout(LayoutKind.Sequential, Pack = 1)]
      method NtWow64QueryInformationProcess64 (line 623) | [DllImport("ntdll.dll", SetLastError = true)]
      method ReadProcessMemory (line 631) | [DllImport("kernel32.dll", SetLastError = true)]
      method ReadProcessMemory (line 639) | [DllImport("kernel32.dll", SetLastError = true)]
      method NtWow64ReadVirtualMemory64 (line 647) | [DllImport("ntdll.dll", SetLastError = true)]
      method NtWow64ReadVirtualMemory64 (line 655) | [DllImport("ntdll.dll", SetLastError = true)]
      type MEMORY_BASIC_INFORMATION (line 668) | [StructLayout(LayoutKind.Sequential)]
      method VirtualQueryEx (line 680) | [DllImport("kernel32.dll")]
      type MEMORY_BASIC_INFORMATION_WOW64 (line 683) | [StructLayout(LayoutKind.Sequential)]
      type MEMORY_INFORMATION_CLASS (line 695) | public enum MEMORY_INFORMATION_CLASS
      method NtWow64QueryVirtualMemory64 (line 700) | [DllImport("ntdll.dll")]
      method IsWow64Process (line 709) | [DllImport("kernel32.dll")]

FILE: test/Sip003PluginTest.cs
  class Sip003PluginTest (line 12) | [TestClass]
    method TestSip003Plugin_NoPlugin (line 17) | [TestMethod]
    method TestSip003Plugin_Plugin (line 41) | [TestMethod]
    method TestSip003Plugin_PluginWithOpts (line 64) | [TestMethod]
    method TestSip003Plugin_PluginWithArgs (line 88) | [TestMethod]
    method TestSip003Plugin_PluginWithOptsAndArgs (line 112) | [TestMethod]
    method TestSip003Plugin_PluginWithArgsReplaced (line 137) | [TestMethod]
    method TestSip003Plugin_PluginWithOptsAndArgsReplaced (line 161) | [TestMethod]
    method RunPluginSupportTest (line 186) | private static void RunPluginSupportTest(Sip003Plugin plugin, string p...

FILE: test/UnitTest.cs
  class UnitTest (line 14) | [TestClass]
    method TestHotKey2Str (line 17) | [TestMethod]
    method TestStr2HotKey (line 27) | [TestMethod]

FILE: test/UrlTest.cs
  class UrlTest (line 11) | [TestClass]
    method PrepareTestData (line 21) | [TestInitialize]
    method TestParseUrl_Server1 (line 115) | [TestMethod]
    method TestParseUrl_Server2 (line 159) | [TestMethod]
    method TestUrlGenerate (line 202) | [TestMethod]
    method RunParseShadowsocksUrlTest (line 215) | private static void RunParseShadowsocksUrlTest(string testCase, IReadO...
    method RunGenerateShadowsocksUrlTest (line 239) | private static void RunGenerateShadowsocksUrlTest(IReadOnlyDictionary<...
Condensed preview — 138 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,016K chars).
[
  {
    "path": ".gitattributes",
    "chars": 44,
    "preview": "* text=auto\n\n# geosite database\n*.dat binary"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report_en.md",
    "chars": 947,
    "preview": "---\nname: Bug report (English)\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n<!--\n-"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report_zh.md",
    "chars": 569,
    "preview": "---\nname: Bug报告 (中文)\nabout: 反馈Bug\ntitle: ''\nlabels: bug report\nassignees: ''\n\n---\n\n<!--\n- 影梭(Shadowsocks)是一个开源非盈利项目,不提供任"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 594,
    "preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your fea"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 950,
    "preview": "## Please follow the guide below\n\n- You will be asked some questions, please read them **carefully** and answer honestly"
  },
  {
    "path": ".gitignore",
    "chars": 6378,
    "preview": "## Ignore Visual Studio and VSCode temporary files, build results, and\n## files generated by popular Visual Studio add-o"
  },
  {
    "path": "CHANGES",
    "chars": 12791,
    "preview": "4.4.1.0 2022-02-08\r\n- Add plain/none ciphers\r\n\r\n4.4.0.0 2021-01-01\r\n- Security: remove infrastructure of stream ciphers "
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 459,
    "preview": "How to Contribute\n=================\n\nPull Requests\n-------------\n\n1. Pull requests are welcome.\n2. Make sure to pass the"
  },
  {
    "path": "LICENSE.txt",
    "chars": 55118,
    "preview": "shadowsocks-csharp\r\n==================\r\n\r\n                    GNU GENERAL PUBLIC LICENSE\r\n                       Version"
  },
  {
    "path": "OPENSSL-GUIDE",
    "chars": 431,
    "preview": "OpenSSL library guide for VS2017\r\n\r\n# Read NOTES.WIN and NOTES.PERL\r\n\r\n# use Visual Studio native tools command prompt\r\n"
  },
  {
    "path": "README.md",
    "chars": 7298,
    "preview": "<img src=\"shadowsocks-csharp/Resources/ssw128.png\" alt=\"[logo]\" width=\"48\"/> Shadowsocks for Windows\r\n=================="
  },
  {
    "path": "appveyor.yml",
    "chars": 5292,
    "preview": "\r\n# Notes:\r\n#   - Minimal appveyor.yml file is an empty file. All sections are optional.\r\n#   - Indent each level of con"
  },
  {
    "path": "appveyor.yml.obsolete",
    "chars": 516,
    "preview": "# Created by wongsyrone\n\nversion: 1.0.{build}\nimage: Visual Studio 2017\nenvironment:\n  matrix:\n    - platform: x86\n     "
  },
  {
    "path": "appveyor.yml.sample",
    "chars": 14313,
    "preview": "\r\n# Notes:\r\n#   - Minimal appveyor.yml file is an empty file. All sections are optional.\r\n#   - Indent each level of con"
  },
  {
    "path": "packaging/upload.sh",
    "chars": 317,
    "preview": "#!/bin/bash\n\nversion=$1\n\nrsync --progress -e ssh shadowsocks-csharp/bin/x86/Release/Shadowsocks-win-dotnet4.0-$1.zip frs"
  },
  {
    "path": "shadowsocks-csharp/CommandLineOption.cs",
    "chars": 213,
    "preview": "using CommandLine;\n\nnamespace Shadowsocks\n{\n    public class CommandLineOption\n    {\n        [Option(\"open-url\",Require"
  },
  {
    "path": "shadowsocks-csharp/Controller/FileManager.cs",
    "chars": 2080,
    "preview": "using NLog;\r\nusing System;\r\nusing System.IO;\r\nusing System.IO.Compression;\r\nusing System.Text;\r\n\r\nnamespace Shadowsocks"
  },
  {
    "path": "shadowsocks-csharp/Controller/HotkeyReg.cs",
    "chars": 3416,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Windows.Forms;\nusing NLog;\nusing Shadowsocks.Controller.Ho"
  },
  {
    "path": "shadowsocks-csharp/Controller/I18N.cs",
    "chars": 4324,
    "preview": "using Microsoft.VisualBasic.FileIO;\r\nusing NLog;\r\nusing Shadowsocks.Properties;\r\nusing Shadowsocks.Util;\r\nusing System."
  },
  {
    "path": "shadowsocks-csharp/Controller/LoggerExtension.cs",
    "chars": 4589,
    "preview": "using System;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\nusing System.Net;\r\nusing Syst"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/GeositeUpdater.cs",
    "chars": 15551,
    "preview": "using NLog;\nusing Shadowsocks.Properties;\nusing Shadowsocks.Util;\nusing System;\nusing System.Collections.Generic;\nusing"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/IPCService.cs",
    "chars": 2875,
    "preview": "using System;\nusing System.IO.Pipes;\nusing System.Net;\nusing System.Text;\n\nnamespace Shadowsocks.Controller\n{\n    class"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/Listener.cs",
    "chars": 7674,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing System.Net.NetworkInform"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/OnlineConfigResolver.cs",
    "chars": 2222,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing Syste"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/PACDaemon.cs",
    "chars": 5030,
    "preview": "using NLog;\r\nusing Shadowsocks.Model;\r\nusing Shadowsocks.Properties;\r\nusing Shadowsocks.Util;\r\nusing System;\r\nusing Sys"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/PACServer.cs",
    "chars": 7223,
    "preview": "using Shadowsocks.Encryption;\r\nusing Shadowsocks.Model;\r\nusing Shadowsocks.Util;\r\nusing System;\r\nusing System.Net;\r\nusi"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/PortForwarder.cs",
    "chars": 8416,
    "preview": "using System;\r\nusing System.Net;\r\nusing System.Net.Sockets;\r\nusing NLog;\r\nusing Shadowsocks.Util.Sockets;\r\n\r\nnamespace "
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs",
    "chars": 6065,
    "preview": "using System;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing System.Net.Soc"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/Sip003Plugin.cs",
    "chars": 6449,
    "preview": "using System;\r\nusing System.Collections.Specialized;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Net;\r\nu"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/TCPRelay.cs",
    "chars": 36579,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing System.Net.Sockets;\r\nusi"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/UDPRelay.cs",
    "chars": 8349,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Net;\r\nusing System.Net.Sockets;\r\nusing System.Runtime.Co"
  },
  {
    "path": "shadowsocks-csharp/Controller/Service/UpdateChecker.cs",
    "chars": 7033,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Net;\r\nusing"
  },
  {
    "path": "shadowsocks-csharp/Controller/ShadowsocksController.cs",
    "chars": 24282,
    "preview": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System."
  },
  {
    "path": "shadowsocks-csharp/Controller/Strategy/BalancingStrategy.cs",
    "chars": 1762,
    "preview": "using Shadowsocks.Controller;\r\nusing Shadowsocks.Model;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System"
  },
  {
    "path": "shadowsocks-csharp/Controller/Strategy/HighAvailabilityStrategy.cs",
    "chars": 6399,
    "preview": "using NLog;\r\nusing Shadowsocks.Model;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Net;\r\nusing Syste"
  },
  {
    "path": "shadowsocks-csharp/Controller/Strategy/IStrategy.cs",
    "chars": 1327,
    "preview": "using Shadowsocks.Model;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Net;\r\nusing System.Text;\r\n\r\nna"
  },
  {
    "path": "shadowsocks-csharp/Controller/Strategy/StrategyManager.cs",
    "chars": 650,
    "preview": "using Shadowsocks.Controller;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\nnamespace Shadow"
  },
  {
    "path": "shadowsocks-csharp/Controller/System/AutoStartup.cs",
    "chars": 5696,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Runtime.InteropServices;\r\nusing Micr"
  },
  {
    "path": "shadowsocks-csharp/Controller/System/Hotkeys/HotkeyCallbacks.cs",
    "chars": 3329,
    "preview": "using System;\nusing System.Reflection;\n\nnamespace Shadowsocks.Controller.Hotkeys\n{\n    public class HotkeyCallbacks\n   "
  },
  {
    "path": "shadowsocks-csharp/Controller/System/Hotkeys/Hotkeys.cs",
    "chars": 5604,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Windows.In"
  },
  {
    "path": "shadowsocks-csharp/Controller/System/ProtocolHandler.cs",
    "chars": 3321,
    "preview": "using Microsoft.Win32;\nusing NLog;\nusing Shadowsocks.Util;\nusing System;\nusing System.Collections.Generic;\nusing System"
  },
  {
    "path": "shadowsocks-csharp/Controller/System/SystemProxy.cs",
    "chars": 2638,
    "preview": "using System;\r\nusing System.Windows.Forms;\r\nusing NLog;\r\nusing Shadowsocks.Model;\r\nusing Shadowsocks.Util.SystemProxy;\r"
  },
  {
    "path": "shadowsocks-csharp/Data/NLog.config",
    "chars": 749,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<!-- Warning: Configuration may reset after shadowsocks upgrade. -->\r\n<!-- If "
  },
  {
    "path": "shadowsocks-csharp/Data/abp.js",
    "chars": 24132,
    "preview": "/* eslint-disable */\r\n// Was generated by gfwlist2pac in precise mode\r\n// https://github.com/clowwindy/gfwlist2pac\r\n\r\n//"
  },
  {
    "path": "shadowsocks-csharp/Data/i18n.csv",
    "chars": 17985,
    "preview": "en,ru-RU,zh-CN,zh-TW,ja,ko,fr\r\n#Restart program to apply translation,,,,,,\r\n#This is comment line,,,,,,\r\n#Always keep l"
  },
  {
    "path": "shadowsocks-csharp/Data/privoxy_conf.txt",
    "chars": 227,
    "preview": "listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__\r\ntoggle 0\r\nlogfile ss_privoxy.log\r\nshow-on-task-bar 0\r\nactivity"
  },
  {
    "path": "shadowsocks-csharp/Data/user-rule.txt",
    "chars": 98,
    "preview": "! Put user rules line by line in this file.\r\n! See https://adblockplus.org/en/filter-cheatsheet\r\n"
  },
  {
    "path": "shadowsocks-csharp/Encryption/AEAD/AEADEncryptor.cs",
    "chars": 15238,
    "preview": "using NLog;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Net;\r\nusing Syst"
  },
  {
    "path": "shadowsocks-csharp/Encryption/AEAD/AEADMbedTLSEncryptor.cs",
    "chars": 6177,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Runtime.InteropServices;\r\nusi"
  },
  {
    "path": "shadowsocks-csharp/Encryption/AEAD/AEADOpenSSLEncryptor.cs",
    "chars": 7049,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing Shadowsocks.Encryption.Exception;\r\n\r\nnamespace Shadowsocks.Encr"
  },
  {
    "path": "shadowsocks-csharp/Encryption/AEAD/AEADSodiumEncryptor.cs",
    "chars": 5795,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing NLog;\r\nusing Shadowsocks.Controller;"
  },
  {
    "path": "shadowsocks-csharp/Encryption/CircularBuffer/ByteCircularBuffer.cs",
    "chars": 23351,
    "preview": "#region Original License\r\n\r\n//New BSD License(BSD)\r\n//\r\n//Copyright(c) 2014-2015 Cyotek Ltd\r\n//Copyright(c) 2012, Alex "
  },
  {
    "path": "shadowsocks-csharp/Encryption/EncryptorBase.cs",
    "chars": 2895,
    "preview": "namespace Shadowsocks.Encryption\r\n{\r\n    public class EncryptorInfo\r\n    {\r\n        public int KeySize;\r\n        public"
  },
  {
    "path": "shadowsocks-csharp/Encryption/EncryptorFactory.cs",
    "chars": 3328,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Shadowsocks.Encry"
  },
  {
    "path": "shadowsocks-csharp/Encryption/Exception/CryptoException.cs",
    "chars": 409,
    "preview": "namespace Shadowsocks.Encryption.Exception\r\n{\r\n    public class CryptoErrorException : System.Exception\r\n    {\r\n       "
  },
  {
    "path": "shadowsocks-csharp/Encryption/IEncryptor.cs",
    "chars": 533,
    "preview": "using System;\r\n\r\nnamespace Shadowsocks.Encryption\r\n{\r\n    public interface IEncryptor : IDisposable\r\n    {\r\n        /* "
  },
  {
    "path": "shadowsocks-csharp/Encryption/MbedTLS.cs",
    "chars": 4072,
    "preview": "using System;\r\nusing System.IO;\r\nusing System.Runtime.InteropServices;\r\nusing NLog;\r\nusing Shadowsocks.Controller;\r\nusi"
  },
  {
    "path": "shadowsocks-csharp/Encryption/OpenSSL.cs",
    "chars": 6100,
    "preview": "using System;\r\nusing System.IO;\r\nusing System.Runtime.InteropServices;\r\nusing System.Security;\r\nusing System.Text;\r\nusi"
  },
  {
    "path": "shadowsocks-csharp/Encryption/RNG.cs",
    "chars": 1085,
    "preview": "using System;\r\nusing System.Security.Cryptography;\r\n\r\nnamespace Shadowsocks.Encryption\r\n{\r\n    public static class RNG\r"
  },
  {
    "path": "shadowsocks-csharp/Encryption/Sodium.cs",
    "chars": 4620,
    "preview": "using System;\r\nusing System.IO;\r\nusing System.Runtime.InteropServices;\r\nusing NLog;\r\nusing Shadowsocks.Controller;\r\nusi"
  },
  {
    "path": "shadowsocks-csharp/Encryption/Stream/PlainEncryptor.cs",
    "chars": 2392,
    "preview": "using System;\nusing System.Collections.Generic;\n\nnamespace Shadowsocks.Encryption.Stream\n{\n    class PlainEncryptor\n   "
  },
  {
    "path": "shadowsocks-csharp/FodyWeavers.xml",
    "chars": 240,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Weavers xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceS"
  },
  {
    "path": "shadowsocks-csharp/FodyWeavers.xsd",
    "chars": 6900,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\r\n  <!-- This file was g"
  },
  {
    "path": "shadowsocks-csharp/Localization/LocalizationProvider.cs",
    "chars": 359,
    "preview": "using System.Reflection;\nusing WPFLocalizeExtension.Extensions;\n\nnamespace Shadowsocks.Localization\n{\n    public static"
  },
  {
    "path": "shadowsocks-csharp/Localization/Strings.Designer.cs",
    "chars": 15183,
    "preview": "//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code w"
  },
  {
    "path": "shadowsocks-csharp/Localization/Strings.fr.resx",
    "chars": 7779,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The prim"
  },
  {
    "path": "shadowsocks-csharp/Localization/Strings.ja.resx",
    "chars": 7522,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The prim"
  },
  {
    "path": "shadowsocks-csharp/Localization/Strings.ko.resx",
    "chars": 7491,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The prim"
  },
  {
    "path": "shadowsocks-csharp/Localization/Strings.resx",
    "chars": 9769,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The prim"
  },
  {
    "path": "shadowsocks-csharp/Localization/Strings.ru.resx",
    "chars": 7765,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The prim"
  },
  {
    "path": "shadowsocks-csharp/Localization/Strings.zh-Hans.resx",
    "chars": 9172,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The prim"
  },
  {
    "path": "shadowsocks-csharp/Localization/Strings.zh-Hant.resx",
    "chars": 7746,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The prim"
  },
  {
    "path": "shadowsocks-csharp/Model/Configuration.cs",
    "chars": 14481,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing System"
  },
  {
    "path": "shadowsocks-csharp/Model/ForwardProxyConfig.cs",
    "chars": 1063,
    "preview": "using System;\n\nnamespace Shadowsocks.Model\n{\n    [Serializable]\n    public class ForwardProxyConfig\n    {\n        publi"
  },
  {
    "path": "shadowsocks-csharp/Model/Geosite/Geosite.cs",
    "chars": 25544,
    "preview": "// <auto-generated>\n//     Generated by the protocol buffer compiler.  DO NOT EDIT!\n//     source: geosite.proto\n// </au"
  },
  {
    "path": "shadowsocks-csharp/Model/Geosite/geosite.proto",
    "chars": 800,
    "preview": "syntax = \"proto3\";\n\n// DomainObject for routing decision.\nmessage DomainObject {\n  // Type of domain value.\n  enum Type"
  },
  {
    "path": "shadowsocks-csharp/Model/HotKeyConfig.cs",
    "chars": 779,
    "preview": "using System;\r\n\r\nnamespace Shadowsocks.Model\r\n{\r\n    /*\r\n     * Format:\r\n     *  <modifiers-combination>+<key>\r\n     *\r"
  },
  {
    "path": "shadowsocks-csharp/Model/LogViewerConfig.cs",
    "chars": 2630,
    "preview": "using System;\r\nusing System.Drawing;\r\nusing System.Windows.Forms;\r\nusing Newtonsoft.Json;\r\n\r\nnamespace Shadowsocks.Mode"
  },
  {
    "path": "shadowsocks-csharp/Model/NlogConfig.cs",
    "chars": 4519,
    "preview": "using NLog;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;"
  },
  {
    "path": "shadowsocks-csharp/Model/Server.cs",
    "chars": 9722,
    "preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Text;\r\nusing Syste"
  },
  {
    "path": "shadowsocks-csharp/Model/SysproxyConfig.cs",
    "chars": 602,
    "preview": "using System;\r\n\r\nnamespace Shadowsocks.Model\r\n{\r\n    /*\r\n     * Data come from WinINET\r\n     */\r\n\r\n    [Serializable]\r\n"
  },
  {
    "path": "shadowsocks-csharp/Program.cs",
    "chars": 9898,
    "preview": "using System;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.IO.Pipes;\r\nusing System.Net;\r\nusing System.Refl"
  },
  {
    "path": "shadowsocks-csharp/Properties/AssemblyInfo.cs",
    "chars": 1040,
    "preview": "using Shadowsocks.Controller;\r\nusing System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.I"
  },
  {
    "path": "shadowsocks-csharp/Properties/Resources.Designer.cs",
    "chars": 10507,
    "preview": "//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code"
  },
  {
    "path": "shadowsocks-csharp/Properties/Resources.resx",
    "chars": 9512,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<root>\r\n  <!-- \r\n    Microsoft ResX Schema \r\n    \r\n    Version 2.0\r\n    \r\n    T"
  },
  {
    "path": "shadowsocks-csharp/Properties/Settings.Designer.cs",
    "chars": 3327,
    "preview": "//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code"
  },
  {
    "path": "shadowsocks-csharp/Properties/Settings.settings",
    "chars": 931,
    "preview": "<?xml version='1.0' encoding='utf-8'?>\n<SettingsFile xmlns=\"http://schemas.microsoft.com/VisualStudio/2004/01/settings\""
  },
  {
    "path": "shadowsocks-csharp/Proxy/DirectConnect.cs",
    "chars": 2886,
    "preview": "using System;\nusing System.Net;\nusing System.Net.Sockets;\nusing System.Threading;\nusing Shadowsocks.Util.Sockets;\n\nname"
  },
  {
    "path": "shadowsocks-csharp/Proxy/HttpProxy.cs",
    "chars": 6840,
    "preview": "using System;\r\nusing System.Net;\r\nusing System.Net.Sockets;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r"
  },
  {
    "path": "shadowsocks-csharp/Proxy/IProxy.cs",
    "chars": 1024,
    "preview": "using System;\nusing System.Net;\nusing System.Net.Sockets;\n\nnamespace Shadowsocks.Proxy\n{\n\n    public interface IProxy\n "
  },
  {
    "path": "shadowsocks-csharp/Proxy/Socks5Proxy.cs",
    "chars": 10558,
    "preview": "using System;\nusing System.Net;\nusing System.Net.Sockets;\nusing System.Text;\nusing System.Threading;\nusing Shadowsocks."
  },
  {
    "path": "shadowsocks-csharp/Settings.cs",
    "chars": 932,
    "preview": "namespace Shadowsocks.Properties {\n    \n    \n    // 通过此类可以处理设置类的特定事件: \n    //  在更改某个设置的值之前将引发 SettingChanging 事件。\n    /"
  },
  {
    "path": "shadowsocks-csharp/Util/ProcessManagement/Job.cs",
    "chars": 5498,
    "preview": "using System;\r\nusing System.Diagnostics;\r\nusing System.Runtime.InteropServices;\r\nusing NLog;\r\nusing Shadowsocks.Control"
  },
  {
    "path": "shadowsocks-csharp/Util/ProcessManagement/ThreadUtil.cs",
    "chars": 930,
    "preview": "using System.Diagnostics;\nusing System.Management;\nusing System.Text;\n\nnamespace Shadowsocks.Util.ProcessManagement\n{\n "
  },
  {
    "path": "shadowsocks-csharp/Util/Sockets/LineReader.cs",
    "chars": 7522,
    "preview": "using System;\nusing System.Text;\n\nnamespace Shadowsocks.Util.Sockets\n{\n    public class LineReader\n    {\n        privat"
  },
  {
    "path": "shadowsocks-csharp/Util/Sockets/SocketUtil.cs",
    "chars": 1495,
    "preview": "using System;\nusing System.Net;\nusing System.Net.Sockets;\n\nnamespace Shadowsocks.Util.Sockets\n{\n    public static class"
  },
  {
    "path": "shadowsocks-csharp/Util/Sockets/WrappedSocket.cs",
    "chars": 8594,
    "preview": "using System;\r\nusing System.Net;\r\nusing System.Net.Sockets;\r\nusing System.Threading;\r\n\r\nnamespace Shadowsocks.Util.Sock"
  },
  {
    "path": "shadowsocks-csharp/Util/SystemProxy/ProxyException.cs",
    "chars": 1508,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Serialization;\nusing System.Tex"
  },
  {
    "path": "shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs",
    "chars": 10659,
    "preview": "using Newtonsoft.Json;\r\nusing NLog;\r\nusing Shadowsocks.Controller;\r\nusing Shadowsocks.Model;\r\nusing Shadowsocks.Propert"
  },
  {
    "path": "shadowsocks-csharp/Util/Util.cs",
    "chars": 11529,
    "preview": "using NLog;\r\nusing System;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.IO.Compression;\r\nusing System.Run"
  },
  {
    "path": "shadowsocks-csharp/Util/ViewUtils.cs",
    "chars": 4357,
    "preview": "using Shadowsocks.Controller;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Drawing;\r\nusing System.Dr"
  },
  {
    "path": "shadowsocks-csharp/View/ConfigForm.Designer.cs",
    "chars": 38272,
    "preview": "namespace Shadowsocks.View\r\n{\r\n    partial class ConfigForm\r\n    {\r\n        /// <summary>\r\n        /// Required designe"
  },
  {
    "path": "shadowsocks-csharp/View/ConfigForm.cs",
    "chars": 24373,
    "preview": "using Shadowsocks.Controller;\r\nusing Shadowsocks.Model;\r\nusing Shadowsocks.Properties;\r\nusing System;\r\nusing System.Coll"
  },
  {
    "path": "shadowsocks-csharp/View/ConfigForm.resx",
    "chars": 6206,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<root>\r\n  <!-- \r\n    Microsoft ResX Schema \r\n    \r\n    Version 2.0\r\n    \r\n    Th"
  },
  {
    "path": "shadowsocks-csharp/View/LogForm.Designer.cs",
    "chars": 18696,
    "preview": "namespace Shadowsocks.View\r\n{\r\n    partial class LogForm\r\n    {\r\n        /// <summary>\r\n        /// Required designer v"
  },
  {
    "path": "shadowsocks-csharp/View/LogForm.cs",
    "chars": 15800,
    "preview": "using System;\r\nusing System.Drawing;\r\nusing System.IO;\r\nusing System.Windows.Forms;\r\nusing System.Windows.Forms.DataVis"
  },
  {
    "path": "shadowsocks-csharp/View/LogForm.resx",
    "chars": 7651,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<root>\r\n  <!-- \r\n    Microsoft ResX Schema \r\n    \r\n    Version 2.0\r\n    \r\n    T"
  },
  {
    "path": "shadowsocks-csharp/View/MenuViewController.cs",
    "chars": 39062,
    "preview": "using NLog;\r\nusing Shadowsocks.Controller;\r\nusing Shadowsocks.Localization;\r\nusing Shadowsocks.Model;\r\nusing Shadowsock"
  },
  {
    "path": "shadowsocks-csharp/ViewModels/ForwardProxyViewModel.cs",
    "chars": 4454,
    "preview": "using ReactiveUI;\nusing ReactiveUI.Fody.Helpers;\nusing ReactiveUI.Validation.Extensions;\nusing ReactiveUI.Validation.He"
  },
  {
    "path": "shadowsocks-csharp/ViewModels/HotkeysViewModel.cs",
    "chars": 7233,
    "preview": "using ReactiveUI;\nusing ReactiveUI.Fody.Helpers;\nusing Shadowsocks.Controller;\nusing Shadowsocks.Model;\nusing Shadowsoc"
  },
  {
    "path": "shadowsocks-csharp/ViewModels/OnlineConfigViewModel.cs",
    "chars": 4759,
    "preview": "using ReactiveUI;\nusing ReactiveUI.Fody.Helpers;\nusing ReactiveUI.Validation.Extensions;\nusing ReactiveUI.Validation.He"
  },
  {
    "path": "shadowsocks-csharp/ViewModels/ServerSharingViewModel.cs",
    "chars": 3408,
    "preview": "using ReactiveUI;\nusing ReactiveUI.Fody.Helpers;\nusing Shadowsocks.Model;\nusing System;\nusing System.Collections.Generi"
  },
  {
    "path": "shadowsocks-csharp/ViewModels/VersionUpdatePromptViewModel.cs",
    "chars": 1278,
    "preview": "using Newtonsoft.Json.Linq;\nusing ReactiveUI;\nusing Shadowsocks.Controller;\nusing System.Reactive;\n\nnamespace Shadowsoc"
  },
  {
    "path": "shadowsocks-csharp/Views/ForwardProxyView.xaml",
    "chars": 4454,
    "preview": "<reactiveui:ReactiveUserControl\n    x:Class=\"Shadowsocks.Views.ForwardProxyView\"\n    x:TypeArguments=\"vms:ForwardProxyV"
  },
  {
    "path": "shadowsocks-csharp/Views/ForwardProxyView.xaml.cs",
    "chars": 3494,
    "preview": "using ReactiveUI;\nusing Shadowsocks.ViewModels;\nusing System.Reactive.Disposables;\n\nnamespace Shadowsocks.Views\n{\n    /"
  },
  {
    "path": "shadowsocks-csharp/Views/HotkeysView.xaml",
    "chars": 4958,
    "preview": "<reactiveui:ReactiveUserControl\n    x:Class=\"Shadowsocks.Views.HotkeysView\"\n    x:TypeArguments=\"vms:HotkeysViewModel\"\n"
  },
  {
    "path": "shadowsocks-csharp/Views/HotkeysView.xaml.cs",
    "chars": 6605,
    "preview": "using ReactiveUI;\nusing Shadowsocks.ViewModels;\nusing System;\nusing System.Reactive.Disposables;\nusing System.Windows;\n"
  },
  {
    "path": "shadowsocks-csharp/Views/OnlineConfigView.xaml",
    "chars": 2588,
    "preview": "<reactiveui:ReactiveUserControl\n    x:Class=\"Shadowsocks.Views.OnlineConfigView\"\n    x:TypeArguments=\"vms:OnlineConfigV"
  },
  {
    "path": "shadowsocks-csharp/Views/OnlineConfigView.xaml.cs",
    "chars": 2067,
    "preview": "using ReactiveUI;\nusing Shadowsocks.ViewModels;\nusing System.Reactive.Disposables;\n\nnamespace Shadowsocks.Views\n{\n    /"
  },
  {
    "path": "shadowsocks-csharp/Views/ServerSharingView.xaml",
    "chars": 2259,
    "preview": "<reactiveui:ReactiveUserControl\n    x:Class=\"Shadowsocks.Views.ServerSharingView\"\n    x:TypeArguments=\"vms:ServerSharin"
  },
  {
    "path": "shadowsocks-csharp/Views/ServerSharingView.xaml.cs",
    "chars": 1722,
    "preview": "using ReactiveUI;\nusing Shadowsocks.ViewModels;\nusing System.Reactive.Disposables;\nusing System.Windows.Input;\n\nnamespa"
  },
  {
    "path": "shadowsocks-csharp/Views/VersionUpdatePromptView.xaml",
    "chars": 2306,
    "preview": "<reactiveui:ReactiveUserControl\n    x:Class=\"Shadowsocks.Views.VersionUpdatePromptView\"\n    x:TypeArguments=\"vms:Versio"
  },
  {
    "path": "shadowsocks-csharp/Views/VersionUpdatePromptView.xaml.cs",
    "chars": 1489,
    "preview": "using Newtonsoft.Json.Linq;\nusing ReactiveUI;\nusing Shadowsocks.ViewModels;\nusing System.Reactive.Disposables;\n\nnamespa"
  },
  {
    "path": "shadowsocks-csharp/app.config",
    "chars": 4261,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<configuration>\r\n<configSections>\r\n    <sectionGroup name=\"userSettings\" type=\""
  },
  {
    "path": "shadowsocks-csharp/app.manifest",
    "chars": 1434,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\" xmlns:"
  },
  {
    "path": "shadowsocks-csharp/packages.config",
    "chars": 2879,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<packages>\r\n  <package id=\"AvalonEdit\" version=\"6.0.1\" targetFramework=\"net472\""
  },
  {
    "path": "shadowsocks-csharp/shadowsocks-csharp.csproj",
    "chars": 25772,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micro"
  },
  {
    "path": "shadowsocks-windows.sln",
    "chars": 2183,
    "preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Version 16\r\nVisualStudioVersion = 16.0.2"
  },
  {
    "path": "test/ProcessEnvironment.cs",
    "chars": 23602,
    "preview": "/* ***************************************************************************\n\nThe component allows to read the enviro"
  },
  {
    "path": "test/Properties/AssemblyInfo.cs",
    "chars": 1417,
    "preview": "using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General I"
  },
  {
    "path": "test/ShadowsocksTest.csproj",
    "chars": 5078,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micro"
  },
  {
    "path": "test/Sip003PluginTest.cs",
    "chars": 6928,
    "preview": "using System;\r\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\r\nusing System.Threading;\r\nusing System.Collections.G"
  },
  {
    "path": "test/UnitTest.cs",
    "chars": 2609,
    "preview": "using System;\r\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\r\nusing Shadowsocks.Controller;\r\nusing GlobalHotKey;\r"
  },
  {
    "path": "test/UrlTest.cs",
    "chars": 10079,
    "preview": "using System;\r\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\r\nusing Shadowsocks.Controller;\r\nusing System.Threadi"
  },
  {
    "path": "test/app.config",
    "chars": 1008,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-co"
  },
  {
    "path": "test/packages.config",
    "chars": 138,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<packages>\r\n  <package id=\"GlobalHotKey\" version=\"1.1.0\" targetFramework=\"net47"
  }
]

// ... and 2 more files (download for full content)

About this extraction

This page contains the full source code of the shadowsocks/shadowsocks-windows GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 138 files (933.1 KB), approximately 209.3k tokens, and a symbol index with 986 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!