• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    JavaScript
  • License
    BSD 3-Clause "New...
  • Created over 8 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Encrypt your socks transmission.

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

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:

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

Examples

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

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

Start daemon:

$ localssjs -d start -b 1080

Log verbosely:

$ serverssjs -d start --level verbose

Update GFWList for your .pac file server:

$ localssjs --pac_update_gfwlist

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

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

Config

{
  "serverAddr": "127.0.0.1",
  "serverPort": 8083,
  "localAddr": "127.0.0.1",
  "localPort": 1080,
  "pacServerPort": 8090,
  "password": "YOUR_PASSWORD_HERE",
  "timeout": 600,
  "method": "aes-128-cfb",

  "level": "warn",
  "localAddrIPv6": "::1",
  "serverAddrIPv6": "::1"
}

Specify your config file with -c flag:

$ 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.

{
  "auth": {
    "forceAuth": true,
    "usernamePassword": {
      "name": "password"
    }
  }
}

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

$ npm test

Contribute

$ 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

More Repositories

1

http-proxy-to-socks

hpts(http-proxy-to-socks) is a nodejs client to convert socks proxy into http proxy
JavaScript
535
star
2

youdao-collins-chrome-extension

A chrome extension to help you search english words in collins dict.
JavaScript
147
star
3

cheerio-without-node-native

Cheerio build that excludes node native modules so that you can use it in platforms like React Native and chrome extensions.
JavaScript
130
star
4

react-yue

Render the views of Yue with React.
JavaScript
126
star
5

typescript-handbook-zh

TypeScriptζ‰‹ε†ŒδΈ­ζ–‡η‰ˆγ€‚
HTML
94
star
6

nysocks

Nysocks binds kcp and libuv to provide an aggressive tcp tunnel in nodejs.
C++
81
star
7

wasm-opencc

OpenCC compiled by Emscripten so that you can run it on browsers or nodejs without compiling.
C++
53
star
8

frozen_east_text_detection.pb

27
star
9

htmlparser2-without-node-native

htmlparser2 build that excludes node native modules so that you can use it in platforms like React Native.
JavaScript
24
star
10

kcp-node

WIP
JavaScript
9
star
11

react-native-leetcode-reader

LeetCode iOS app built with React Native.
JavaScript
7
star
12

oyyd-blog

A blog for oyyd.net.
JavaScript
6
star
13

redux-proptypes-pack

Use React.PropTypes in your redux apps.
JavaScript
4
star
14

rs-object

Node.js bindings to Rust [object](https://github.com/gimli-rs/object).
Rust
3
star
15

do-space-client

A desktop client of Digital Ocean Space by the lib of Yue.
JavaScript
3
star
16

hoppscotch-tauri

Hoppscotch and a rust proxy server bundled with tauri.
Rust
3
star
17

eslint-plugin-graphql-schema

GraphQL schema specific linting rules for ESLint
JavaScript
3
star
18

os-proxy-socks

WIP
JavaScript
1
star
19

redux-thunk-dispatch

Record redux thunk actions and dispatch them when your server side code restarts.
JavaScript
1
star
20

addon_abort_example

C++
1
star
21

redux-thunk-dispatch-todosmvc

An example of redux-thunk-dispatch with react-hot-loader
JavaScript
1
star
22

switch-proxy

switch-proxy(sp) simplifies switching proxies of your git, docker, npm, etc.
JavaScript
1
star