项目作者: oyyd

项目描述 :
Encrypt your socks transmission.
高级语言: JavaScript
项目地址: git://github.com/oyyd/encryptsocks.git
创建时间: 2016-05-12T12:28:25Z
项目社区:https://github.com/oyyd/encryptsocks

开源协议:BSD 3-Clause "New" or "Revised" License

下载


encryptsocks

npm-version
Build Status

Encrypt your socks transmission.

Why another Nodejs implementation?

Nodejs is a very good choice to achieve both flexibility and good performance in this situation.

And I have found that many of who are familiar with the original implementation may be curious about the memory usage so that I have finished some simple benchmarks to measure its behavior.

Benchmark

You can get the benchmark details here or even test your own implementation.

After some simple benchmarks that compare both the node and python implementation, my conclusion is:

  1. Node has a different GC strategy but it’s, of course, able to keep thousands of connections with a reasonable memory usage. It’s not a bug, it’s a conscious time/space trade-off.

  2. Each request would cost less time to get responsed (even 50% less time in some situations).

  3. Node implementation is less likely to fail requests in high concurrency situation.

And the higher concurrency benchmarks may be meaningless as the bandwidth and network environment would become the actual bottleneck in the real world.

Do Please point out my faults if I have missed something or get something wrong.

Requirement

node >= v4

It’s recommended to use node v6 to achieve better performance.

Installation

  1. npm i -g encryptsocks

About the daemon

Encryptsocks use pm2 as the watcher process from 1.4.0.

CLI

Use localssjs (local ssjs) to start clients to communicate with applications. The localssjs server will also serve a pac file at http://127.0.0.1:8090 (by default) for your apps to avoid unnecessary tunnel work.

You may prefer to navigate clients page and choose clients for your devices instead of using localssjs.

Use serverssjs (server ssjs) to start your remote server.

Use localssjs -h or serverssjs -h to show cli options:

  1. Proxy options:
  2. -c config path to config file
  3. -s SERVER_ADDR server address, default: 127.0.0.1
  4. -p SERVER_PORT server port, default: 8083
  5. -l LOCAL_ADDR local binding address, default: 127.0.0.1
  6. -b LOCAL_PORT local port, default: 1080
  7. -k PASSWORD password
  8. -m METHOD encryption method, default: aes-128-cfb
  9. -t TIMEOUT timeout in seconds, default: 600
  10. --pac_port PAC_PORT PAC file server port, default: 8090
  11. --pac_update_gfwlist [URL] [localssjs] Update the gfwlist
  12. for PAC server. You can specify the
  13. request URL.
  14. --level LOG_LEVEL log level, default: warn
  15. example: --level verbose
  16. General options:
  17. -h, --help show this help message and exit
  18. -d start/stop/restart daemon mode

Examples

Start clients that bind at 1088 and will connect to MY.SSSERVER.DOMAIN:

  1. $ localssjs -b 1088 -s MY.SSSERVER.DOMAIN

Start daemon:

  1. $ localssjs -d start -b 1080

Log verbosely:

  1. $ serverssjs -d start --level verbose

Update GFWList for your .pac file server:

  1. $ localssjs --pac_update_gfwlist

Update GFWList for your .pac file server from a specific URL (default url):

  1. $ localssjs --pac_update_gfwlist http://firefoxfan.cc/gfwlist/gfwlist.txt

Config

  1. {
  2. "serverAddr": "127.0.0.1",
  3. "serverPort": 8083,
  4. "localAddr": "127.0.0.1",
  5. "localPort": 1080,
  6. "pacServerPort": 8090,
  7. "password": "YOUR_PASSWORD_HERE",
  8. "timeout": 600,
  9. "method": "aes-128-cfb",
  10. "level": "warn",
  11. "localAddrIPv6": "::1",
  12. "serverAddrIPv6": "::1"
  13. }

Specify your config file with -c flag:

  1. $ serverssjs -c config.json

You can change default config in config.json file of your global
package.

SOCKS5 Username Password Authetication

NOTE: This authetication is dangerous when sniffed.

Add auth property to your config.json and make forceAuth true.

  1. {
  2. "auth": {
  3. "forceAuth": true,
  4. "usernamePassword": {
  5. "name": "password"
  6. }
  7. }
  8. }

Optimizing

Encryption methods

  • aes-128-cfb
  • aes-192-cfb
  • aes-256-cfb
  • bf-cfb
  • camellia-128-cfb
  • camellia-192-cfb
  • camellia-256-cfb
  • cast5-cfb
  • des-cfb
  • idea-cfb
  • rc2-cfb
  • rc4
  • rc4-md5
  • seed-cfb

Test

  1. $ npm test

Contribute

  1. $ npm run watch

About the support to UDP relay

I intend to implement UDP relay and I have implement it.
but I can’t find an effective way to test this in real world networking.
Please create issues to help us if you know any applications that support
UDP-socks well.

License

BSD