Go to file
2017-03-09 16:17:46 +08:00
bin feat(bin): add 'blinksocks-init' and 'blinksocks-run' sub commands 2017-03-09 16:17:46 +08:00
config chore(config): check protocol is set or not 2017-03-01 22:18:58 +08:00
docs chore(architcture): add docs for 'fail' callback 2017-03-08 22:11:09 +08:00
lib chore(lib): update 2017-03-08 22:11:09 +08:00
src fix(hub): eslint 2017-03-08 23:22:43 +08:00
.babelrc chore(.babelrc): reformat 2017-03-02 13:51:18 +08:00
.dockerignore feat(deploy): add Docker stuff 2016-12-31 23:03:46 +08:00
.eslintrc chore(eslint): turn off no-undef and max-len check rules 2017-02-20 22:58:43 +08:00
.gitignore chore(.gitignore): ignore .vscode 2017-03-01 14:09:41 +08:00
.travis.yml chore(CI): use node_js:6.10.0 2017-02-23 21:35:14 +08:00
Dockerfile chore(deploy): use node:6.10.0-slim 2017-02-23 21:35:28 +08:00
LICENSE chore(License): update copyright to 2017 2017-01-02 23:14:59 +08:00
package.json feat(bin): add 'blinksocks-init' and 'blinksocks-run' sub commands 2017-03-09 16:17:46 +08:00
README.md docs(README): update 2017-03-08 14:15:52 +08:00
start.sh feat(bin): add 'blinksocks-init' and 'blinksocks-run' sub commands 2017-03-09 16:17:46 +08:00
yarn.lock feat(bin): add 'blinksocks-init' and 'blinksocks-run' sub commands 2017-03-09 16:17:46 +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.

Documentation

Features

  • HTTP/Socks5/Socks4/Socks4a compatible
  • TCP and UDP relay
  • Middleware Based
  • Highly flexible and customizable
  • Cross-platform
  • Docker deployment

Installation

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

$ npm install -g blinksocks

Upgrade

$ npm update -g blinksocks

Usage

Once installed, you can access blinksocks via CLI:

$ blinksocks --help

  Usage: blinksocks --host <host> --port <port> --key <key> [...]

  Options:

    -h, --help                           output usage information
    -V, --version                        output the version number
    -c, --config [file]                  a json format file for configuration, if specified, other options are ignored
    --host <host>                        an ip address or a hostname to bind
    --port <port>                        where to listen on
    --server-host [server-host]          an ip address or hostname to connect to
    --server-port [server-port]          which port the server listen on
    --key <key>                          a key for encryption and decryption
    --frame [frame]                      a preset used in frame middleware, default: 'origin'
    --frame-params [crypto-params]       parameters for frame preset, default: ''
    --crypto [crypto]                    a preset used in crypto middleware, default: 'openssl'
    --crypto-params [crypto-params]      parameters for crypto, default: 'aes-256-cfb'
    --protocol [protocol]                a preset used in protocol middleware, default: 'aead'
    --protocol-params [protocol-params]  parameters for protocol, default: 'aes-256-cbc,sha256'
    --obfs [obfs]                        a preset used in obfs middleware, default: 'none'
    --obfs-params [obfs-params]          parameters for obfs, default: ''
    --log-level [log-level]              log level, default: all
    -q, --quiet                          force log level to 'error'
    --ciphers                            display all supported ciphers
    --hashes                             display all supported hash functions


  Examples:

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

  To start a server:
    $ blinksocks --host 0.0.0.0 --port 7777 --key key --crypto openssl --crypto-params aes-256-cfb

  To start a client:
    $ blinksocks --host localhost --port 1080 --server-host example.com --server-port 7777 --key key --crypto openssl --crypto-params aes-256-cfb

Config.json

To start a server or client, you can prepare a configuration json file(config.json for example) then supply to --config or -c.

{
  "host": "localhost",
  "port": 6666,
  "server_host": "localhost",
  "server_port": 7777,
  "key": "secret",
  "frame": "origin",
  "frame_params": "",
  "crypto": "openssl",
  "crypto_params": "aes-128-ofb",
  "protocol": "aead",
  "protocol_params": "aes-256-cbc,sha256",
  "obfs": "http",
  "obfs_params": "http-fake.txt",
  "log_level": "error"
}
FIELD DESCRIPTION DEFAULT
*host local ip address or domain name "localhost"
*port local port to bind 1080
server_host server ip or domain name, client only -
server_port server port, client only -
*key for encryption and decryption -
frame frame preset "origin"
frame_params parameters for frame preset ""
crypto crypto preset "openssl"
crypto_params parameters for crypto preset "aes-256-cfb"
protocol protocol preset "aead"
protocol_params parameters for protocol preset "aes-256-cbc,sha256"
obfs obfs preset "none"
obfs_params parameters for obfs preset ""
log_level log level "error"

NOTE: host, port, and key must be set.

  • Available Ciphers

aes-128-ctr, aes-192-ctr, aes-256-ctr, aes-128-cfb, aes-192-cfb, aes-256-cfb,

aes-128-ofb, aes-192-ofb, aes-256-ofb, aes-128-cbc, aes-192-cbc, aes-256-cbc

  • Available Hashes

sha1, sha256, sha512,

  • Available Presets
├── crypto
│   ├── none.js
│   └── openssl.js
├── frame
│   └── origin.js
├── obfs
│   ├── http.js
│   └── none.js
└── protocol
    ├── aead.js
    ├── aead2.js
    └── basic.js
  • Log Levels

The logging library winston use npm logging levels by default, you can choose one of them demand:

{ error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }

Compile for production

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

Compilation of blinksocks is ultra easy:

$ npm run compile

This will compile src to lib.

Test in development

Any application support HTTP/Socks5/Socks4/Socks4a 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

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.

Deploy(Docker)

We use Docker to auto-deploy a blinksocks server.

1. Get image

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

  • Build an image
$ docker build --tag blinksocks:<version> .
  • Pull from docker hub
$ docker pull blinksocks:<version>

2. Run in a container

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

$ docker run -d -p 7777:1080 blinksocks:<version>

References

Contributors

Micooz(Owner), micooz@hotmail.com

Waiting for more contributors...

License

Apache License 2.0