Shadowsocks is a cross-platform lightweight and highly efficient secure proxy application originally developed by @clowwindy and currently maintained by multiple developers. Shadowsocks was developed with python but has been ported to various programming languages. Out of many versions, shadowsocks-libev is written in C and is well maintained. The server version is working incredibly fast, and I think the client version will also work well. But there are few articles introducing the ways to build shadowsocks-libev on Windows. The official documentation only lists some commands. With the help of the developer, I am able to build it and run it on Windows platform.
- Download git from https://git-scm.com/download/win.
Install git and make sure the git command path is added to the Windows “path” variable.
Download msys2 installer from https://msys2.github.io/.
Install msys2 by following the wizard on the website.
Determine the architecture of your target app. You can choose to build 32-bit or 64-bit depending on your needs. Normally 32-bit will do the job pretty well unless you are obsessed with building the 64-bit app for 64-bit system. This guide will build the 32-bit app.
Launch the “MinGW-w64 Win32 Shell” from the Start Menu. The name sounds a bit confusing, but it is what we want to open.
Execute the following command to install the toolchain
pacman -S mingw-w64-i686-toolchain tar perl make openssl asciidoc xmlto
- Verify that git is installed correctly by executing
- Checkout shadowsocks-libev from GitHub.
git clone https://github.com/shadowsocks/shadowsocks-libev.git
- Checkout specific version. At the time of writing this article, the most current version is v2.4.5.
git checkout v2.4.5
make && make install
After successfully building the app, you can find the binary in $HOME/ss/bin directory. There should be two executables. ss-local.exe is the client and ss-tunnel.exe is for another usage. Copy these two files to c:/bin/shadowsocks.
Copy the following files from your msys2 installation folder (under your msys2 installation path/mingw32/bin) to the same folder as your ss-local.exe and ss-tunnel.exe (c:/bin/shadowsocks)
Create a config.json file with the correct format. Refer to https://github.com/shadowsocks/shadowsocks-libev/blob/master/debian/config.json as an example.
Open a native Windows CMD window, and navigate to c:/bin/shadowsocks directory.
Start ss-local.exe by executing the following command.
ss-local.exe -c config.json
- Depending on your server settings, if you have enabled One-time authentication in your server, you can start ss-local.exe like this instead.
ss-local.exe -A -c config.json
- Shadowsocks-libev has started. You can now change your system or browser proxy configuration to point to the shadowsocks-libev client.
We can use the built-in Windows task scheduler to automatically start the shadowsocks-libev.
Close any shadowsocks-libev instances before starting. You can use the task manager to kill the process.
Open a native Windows CMD window as an administrator, and then execute the following command.
schtasks /create /ru "SYSTEM" /sc onstart /tn shadowsocks /tr "C:\bin\shadowsocks\ss-local.exe -c C:\bin\shadowsocks\config.json" /f
- Depending on your server settings, if you have enabled One-time authentication in your server, you can issue the following command instead.
schtasks /create /ru "SYSTEM" /sc onstart /tn shadowsocks /tr "C:\bin\shadowsocks\ss-local.exe -A -c C:\bin\shadowsocks\config.json" /f
- Issue the following command to start shadowsocks-libev. You need to run as an administrator.
schtasks /run /tn shadowsocks
- Issue the following command to stop shadowsocks-libev. You need to run as an administrator.
schtasks /end /tn shadowsocks
- If you want to delete the task, you can issue the following command. You need to run as an administrator.
schtasks /delete /tn shadowsocks
- If you don’t want to start shadowsocks as a system account or you don’t want to run shadowsocks as an administrator, you can go to the Task Scheduler to modify the task settings. Change the account to your own account and select “Hidden” and “Run whether user is logged on or not”.
Congratulations, you now have successfully built the shadowsocks-libev on Windows.