Go to file
2017-02-20 22:57:57 +08:00
bin fix(classes): try to fix memory leak 2017-01-07 22:04:23 +08:00
config refactor(Pipe): do more things, simplify Socket, use only one pipe 2017-02-07 23:15:46 +08:00
docs docs(): update README.md and architecture.md 2017-01-10 23:18:00 +08:00
lib chore(lib): update 2017-02-05 23:40:14 +08:00
src fix(obfs): http obfs 2017-02-08 22:54:18 +08:00
.babelrc initial commit 2016-12-09 22:54:58 +08:00
.dockerignore feat(deploy): add Docker stuff 2016-12-31 23:03:46 +08:00
.eslintrc chore(eslint): turn off object-curly-spacing checking 2017-01-18 21:54:22 +08:00
.gitignore chore(.gitignore): ignore *.config.json 2016-12-10 15:02:28 +08:00
.travis.yml chore(CI): use node_js:6.9.5 2017-02-20 22:57:57 +08:00
Dockerfile chore(deploy): use node:6.9.5-slim 2017-02-20 22:57:18 +08:00
LICENSE chore(License): update copyright to 2017 2017-01-02 23:14:59 +08:00
package.json chore(package): add keywords 2017-02-20 22:56:55 +08:00
README.md docs(README): add upgrade instruction 2017-02-04 23:38:24 +08:00
start.sh chore(deploy): use pm2 to run blinksocks 2017-01-12 22:58:44 +08:00
yarn.lock chore(package): update deps 2017-02-20 22:56:34 +08:00

blinksocks

version downloads license dependencies devDependencies

Travis Coverage %e2%9d%a4

micooz/blinksocks

Yet another Socks5 proxy, designed for speed . Inspired by Shadowsocks, And ShadowsocksR.

Across the Great Wall we can reach every corner in the world.

Features

  • HTTP/Socks5/Socks4/Socks4a compatible
  • TCP and UDP relay
  • IPv4 and IPv6 support
  • Universal server and client
  • Fully encryption
  • Docker integration

Installation

You can get pre-compiled library(including executable) of blinksocks from yarn or npm. Both approach requires your system have had Node.js installed.

-> via yarn

If you know yarn, this way is recommended:

$ yarn global add blinksocks

-> via npm

$ npm install -g blinksocks

Upgrade

$ npm update -g blinksocks

Usage

Once installed, you can access blinksocks from command line directly:

$ blinksocks --help

  Usage: blinksocks [options] [...]

  Options:

    -h, --help                  output usage information
    -V, --version               output the version number
    -c, --config [file]         a json file for configuration, if specified, ignore other options
    --host <host>               an ip address or a hostname to bind
    --port <port>               where to listen on
    --password <password>       a password for encryption and decryption
    --server-host [serverHost]  an ip address or a hostname to connect
    --server-port [serverPort]  where is the server listen on
    --cipher [cipher]           a method for encryption or decryption, leave it empty to enbaled non-encryption mode
    --use-iv                    if use initialization vector for encryption
    --log-level [logLevel]      log4js log level
    -q, --quiet                 limit log level to 'error'
    --ciphers                   show all supported ciphers

  Examples:

  As simple as possible:
    $ blinksocks -c config.json

  To start a server:
    $ blinksocks --host 0.0.0.0 --port 7777 --password password --cipher "aes-256-cfb"

  To start a client:
    $ blinksocks --host localhost --port 1080 --password password --server-host example.com --server-port 7777 --cipher "aes-256-cfb"

Configuration

To start a server or client, you can prepare a configuration json file(config.json for example) via --config or -c as follows:

Client

{
  "host": "localhost",
  "port": 1080,
  "server_host": "example.com",
  "server_port": 7777,
  "password": "my secret password",
  "cipher": "aes-256-cfb",
  "use_iv": true,
  "log_level": "error"
}

Server

Just without server_host and server_port:

{
  "host": "0.0.0.0",
  "port": 7777,
  "password": "my secret password",
  "cipher": "aes-256-cfb",
  "use_iv": true,
  "log_level": "error"
}

Or you can provide all pf them via command line.

  • host(--host): Typically localhost.
  • port(--port): Typically 1080.
  • server_host(--server-host): Typically 0.0.0.0.
  • server_port(--server-port): Any available number.
  • password(--password): For data encryption, please keep it secret!
  • cipher(--cipher): Encryption method. You can enable non-encryption mode by set it to empty string.
  • use_iv(--use-iv): Whether encrypt/decrypt with initialization vector or not.
  • log_level(--log-level): should take a value from Logging Level of Log4js.Level. The levels are case-insensitive and cumulative.

Compile for production

For production use, we are running our code under lib not src, so compilation is necessary.

Compilation of blinksocks is super easy:

$ npm run compile

This will compile src to lib.

Test for development

Application which support Socks5/Socks4/Socks4a/HTTP can be used for testing.

For example(use curl):

# Socks5
$ curl --socks5 localhost:1080 https://www.google.com
$ curl --socks5-hostname localhost:1080 https://www.google.com

# Socks4
$ curl --socks4 localhost:1080 https://www.google.com

# Socks4a
$ curl --socks4a localhost:1080 https://www.google.com

# HTTP
$ curl -x http://localhost:1080 https://www.google.com

Run in production

Blinksocks can take advantages of pm2 to run in the production.

Install pm2 before running blinksocks in the production.

Daemon mode

$ pm2 start blinksocks -- -c config.json

Cluster mode

$ pm2 start blinksocks -i 3 -- -c config.json

Deploy

We use Docker to auto-deploy a blinksocks server.

Get image

You can build an image manually or pull it from docker hub:

  • Build an image
$ docker build --tags blinksocks:latest .
  • Pull from docker hub
$ docker pull blinksocks:latest

Run in a container

Container will expose 1080 port, so you must bind a host port to 1080 via -p.

$ docker run -d -p 7777:1080 blinksocks:latest

For Firefox/Google Chrome and more...

A common usage of blinksocks is used it on browsers, so I give an advise here.

For Google Chrome, SwitchyOmega extension is a great approach to use socks5 service.

For FireFox, you can configure proxy at Settings - Advanced - Network - Proxy.

Documentation

If you are interesting in Principle, Architecture or Spec of blinksocks, please check out: docs.

Roadmap

Done:

  • non-encryption mode for debugging and non-security scenarios
  • streaming data send/receive
  • encrypt/decrypt with initialization vector
  • DNS cache
  • UDP relay(need test!)
  • docker deploy scripts
  • more command line options

Next minor version:

v2.1.0:

  • http proxy
  • Socks4 proxy
  • Socks4a proxy
  • Plugin System
  • Message Authentication Code
  • Performance Testing & Report

Further versions:

  • fail2ban
  • more tests
  • more docs
  • more cipher support
  • ...

References

RFC:

Contributors

Micooz(Owner), micooz@hotmail.com

Waiting for more contributors...

License

Apache License 2.0