GithubHelp home page GithubHelp logo

tonytonyfly / shadowsocksr-native Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shadowsocksr-live/shadowsocksr-native

0.0 1.0 0.0 5.22 MB

ShadowsocksR (SSR) native implementation for all platforms powered by libuv

License: GNU General Public License v3.0

CMake 1.90% Makefile 9.33% Shell 13.19% M4 1.33% Dockerfile 0.08% C 62.41% Objective-C 0.09% C++ 1.05% Roff 10.56% Python 0.06%

shadowsocksr-native's Introduction

ShadowsocksR-native

Join the chat at https://gitter.im/ShadowsocksR-Live/

Index

Intro

ShadowsocksR-native is a lightweight secured SOCKS5 proxy for embedded devices and low-end boxes. It's derived from Shadowsocks-libev.

It is a port of ShadowsocksR created by @breakwa11, which is maintained by @ssrlive.

Current version: 0.4 | Changelog

Features

ShadowsocksR-native is written in pure C and only depends on libuv , mbedTLS , libsodium and json-c.

In normal usage, the memory footprint is about 600KB and the CPU utilization is no more than 5% on a low-end router (Buffalo WHR-G300N V2 with a 400MHz MIPS CPU, 32MB memory and 4MB flash).

For a full list of feature comparison between different versions of shadowsocks, refer to the Wiki page.

Protocols & obfuscators

Protocols obfuscators
origin plain
auth_sha1_v4 http_simple
auth_aes128_sha1 http_post
auth_aes128_md5 http_mix
auth_chain_a tls1.2_ticket_auth
auth_chain_b tls1.2_ticket_fastauth
auth_chain_c/d/e/f

progress of data flow

+-----------------------------------------------------------------------------+
|                +--------------------------------------------------------+   |
|                |               +------------------------------------+   |   |
|                |               |            +-------------------+   |   |   |
|  obfuscator    |   encryptor   |  protocol  |     user data     |   |   |   |
|   |            |       |       |      |     +-------------------+   |   |   |
|   |            |       |       +------+-----------------------------+   |   |
|   |            +-------+--------------+---------------------------------+   |
+---+--------------------+--------------+-------------------------------------+
    |                    |              |                                            
    +-- server_encode    +-- encrypt    +-- server_pre_encrypt       <<<=== user data
    |                    |              |                                            
    +-- server_decode    +-- decrypt    +-- server_post_decrypt      ===>>> user data

Build

Distribution-specific guide


Debian & Ubuntu

For Unix-like systems, especially Debian-based systems, e.g. Ubuntu, Debian or Linux Mint, you can build the binary like this:

# Debian / Ubuntu
sudo su                       # using root account
apt-get install --no-install-recommends build-essential autoconf libtool asciidoc xmlto -y
apt-get install git gcc g++ cmake automake -y
apt-get -f install -y
apt-get update -y
apt-get upgrade -y

cd /                          # switch to root directory
git clone https://github.com/ShadowsocksR-Live/shadowsocksr-native.git
mv shadowsocksr-native ssr-n  # rename shadowsocksr-native to ssr-n
cd ssr-n                      # enter ssr-n directory. 
git submodule update --init
git submodule foreach -q 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch || echo master)'

# build ShadowsocksR-native
cmake CMakeLists.txt && make
# make install
# /bin/cp -rfa src/ssr-* /usr/bin

The target binaries are ssr-n/src/ssr-server, ssr-n/src/ssr-client and ssr-n/src/ssr-local.

CentOS

CentOS 7 only. we don't support CentOS 6.x, it's too old.

Before build ssr-Native, we must install cmake 3.x first. following this

# CentOS / Fedora / RHEL
sudo su
yum install wget git gcc gcc-c++ autoconf automake libtool make asciidoc xmlto -y
curl https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh -o a.sh
sh a.sh --prefix=/usr/ --exclude-subdir && rm -rf a.sh
cd /
git clone https://github.com/ShadowsocksR-Live/shadowsocksr-native.git
mv shadowsocksr-native ssr-n
cd ssr-n
git submodule update --init
git submodule foreach -q 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch || echo master)'

cmake . && make
# make install
# /bin/cp -rfa src/ssr-* /usr/bin

The target binaries are ssr-n/src/ssr-server, ssr-n/src/ssr-client and ssr-n/src/ssr-local.

macOS

For macOS, we must download/install/run Xcode first.

Then use Homebrew to install or build.

Install Homebrew and tools:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git cmake automake libtool

Now get source code and build it.

git clone https://github.com/ShadowsocksR-Live/shadowsocksr-native.git
mv shadowsocksr-native ssr-n
cd ssr-n
git submodule update --init
git submodule foreach -q 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch || echo master)'

cmake . && make

The target binaries are ssr-n/src/ssr-server, ssr-n/src/ssr-client and ssr-n/src/ssr-local.

Windows

For Windows, chekout the project using the following commands then open win32/ssr-native.sln with Visual Studio 2010. Enjoy it!

git clone https://github.com/ShadowsocksR-Live/shadowsocksr-native.git 
git submodule update --init
git submodule foreach -q 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch || echo master)'

Usage

For a detailed and complete list of all supported arguments, you may refer to the man pages of the applications, respectively.

    ssr-[client|local|server]

       [-c <config_file>]         The path to config file

       [-d]                       Run in background as a daemon.

       [-h]                       Show this help message.

Sample configure file

config.json

{
    "server": "123.45.67.89",
    "server_port": 443,
    "method": "aes-128-ctr",
    "password": "password",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth",
    "obfs_param": "",
    "local_address": "0.0.0.0",
    "local_port": 1080,
    "udp": true,
    "timeout": 300
}

cmake

In the CentOS 7, the cmake version is too old to work with ShadowsocksR-Native. So we must install it by ourselves.

sudo su
cd /
curl https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh -o a.sh
sh a.sh  --prefix=/usr/ --exclude-subdir
rm -rf a.sh
cmake --version

It will spend about 30 minites. And the cmake --version command will output message likes:

cmake version 3.11.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).

Deploy server

Supporting CentOS 7 / Debian / Ubuntu with the following commands

sudo su
wget --no-check-certificate https://raw.githubusercontent.com/ShadowsocksR-Live/shadowsocksr-native/master/install/install-ssr.sh
chmod +x install-ssr.sh
./install-ssr.sh

After installation, we can view the status with

systemctl status ssr-native.service

And we can view or edit the configuration with cat or vi in root privilege

cat /etc/ssr-native/config.json

After we changed the server configuration, we must restart the service to make the changes take effect.

systemctl restart ssr-native.service

To stop the server, please run

systemctl stop ssr-native.service

To uninstall the server, use the following command

./install-ssr.sh uninstall

shadowsocksr-native's People

Contributors

aipsel avatar anonymous-contributor avatar breakwa11 avatar chion82 avatar clowwindy avatar crvv avatar dndx avatar dorentus avatar eataix avatar esdeathlove avatar glzjin avatar h2nch2cooh avatar hdid avatar hosiet avatar johnnysun avatar kimw avatar krazyivan- avatar librehat avatar linusyang avatar lqs avatar madeye avatar mygod avatar noisyfox avatar rogers0 avatar senorsen avatar ssrlive avatar ssrlive1988 avatar vfreex avatar vinna avatar wongsyrone avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.