Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heroku support #12

Open
wants to merge 81 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
6fcb1a2
Heroku support
mrluanma Mar 21, 2014
6d0be05
WebSocket now Generally Available on Heroku.
mrluanma Jul 8, 2014
5cda3da
support custom client-side configuration file from arguments
Oct 13, 2014
46471df
support custom client-side configuration file from arguments(change c…
Oct 13, 2014
3d397bb
Merge pull request #1 from hzheng/master
mrluanma Oct 13, 2014
41cda79
Added `remote_port`, `local_address` options.
mrluanma Dec 25, 2014
b4d30f6
connections property is deprecated. Use getConnections() method
mrluanma Dec 25, 2014
cdda585
Support pass multiple `server` options from command line arguments.
mrluanma Dec 25, 2014
afcd1a2
Use `minimist` to parse arguments.
mrluanma Dec 25, 2014
dcfb8ab
Added LICENSE
mrluanma Dec 25, 2014
6519b6b
Use `ws` to handle the WebSocket heavy lifting
mrluanma Jan 5, 2015
b4d1140
Ping every 50 seconds.
mrluanma Jan 6, 2015
c40ba52
It's in milliseconds, Jim
mrluanma Jan 7, 2015
4cc9caa
Nodetime
mrluanma Jan 8, 2015
5aa721b
fix test
mrluanma Jan 9, 2015
68b91d4
pause/resume socket properly
mrluanma Jan 11, 2015
b113071
Revert "Nodetime"
mrluanma Jan 12, 2015
7fff934
Specify `table` cipher on command line.
mrluanma Jan 12, 2015
2b12fa1
Try node 0.11.x
mrluanma Jan 12, 2015
1fa9edf
Save a few Buffer allocation.
mrluanma Jan 13, 2015
b626e60
gc every second.
mrluanma Jan 13, 2015
3afb708
Bind server to specified interface.
mrluanma Jan 13, 2015
94c3822
Support specified WebSocket URL as server.
mrluanma Jan 13, 2015
e81f965
OpenShift
mrluanma Jan 13, 2015
4d6104d
Merge pull request #4 from mrluanma/openshift
mrluanma Jan 14, 2015
a3e1061
Support `null` cipher.
mrluanma Jan 14, 2015
4a77197
Document OpenShift support.
mrluanma Jan 14, 2015
d0a3ab2
cleanup
mrluanma Jan 14, 2015
c9492fb
minor
mrluanma Jan 15, 2015
1bacabf
Document supported ciphers. #7
mrluanma Jan 21, 2015
0d1a7de
Specify `binary` sub-protocol only. Close #7.
mrluanma Jan 23, 2015
38e24ac
Revert "Support `null` cipher."
mrluanma Jan 24, 2015
882f621
Support `rc4-md5` cipher.
mrluanma Jan 24, 2015
d73b996
fix #8.
mrluanma Jan 28, 2015
22f20ec
Build with CoffeeScript 1.10.0
mrluanma Oct 15, 2015
fe9223e
Remove `gc()`
mrluanma Oct 15, 2015
61543a9
Upgrade dependencies.
mrluanma Oct 15, 2015
b8b5beb
Removed OpenShift support.
mrluanma Nov 25, 2015
ba248ff
Support local HTTP Proxy.
bigbagboom Aug 24, 2016
190f3c0
Default Node to the latest Long-Term-Support release
mrluanma Jun 19, 2017
5b4328f
Fixed RangeError error due to signed vs unsigned int.
olliecheng Dec 15, 2017
7c1d540
Merge pull request #40 from denosawr/patch-1
mrluanma Dec 15, 2017
478e776
Minor.
mrluanma Jan 3, 2018
c1f434b
CoffeeScript 2.1.1
mrluanma Jan 3, 2018
9308853
decaffeinate
mrluanma Jan 3, 2018
c35918b
decaffeinate suggestions
mrluanma Jan 3, 2018
3c31c44
yarn
mrluanma Jan 3, 2018
c0fc97a
prettier
mrluanma Jan 3, 2018
590cc24
Upgrade dependencies
mrluanma Jan 4, 2018
11265b6
yarn add bufferutil
mrluanma Jan 4, 2018
34ff097
Fix concurrent connections
mrluanma Jan 4, 2018
a004f0d
Do not touch ws._socket
mrluanma Jan 4, 2018
40ddb75
Delete redundant error handler.
mrluanma Jan 4, 2018
822994e
Remove buggy backpressure handling.
mrluanma Jan 4, 2018
0052678
yarn upgrade --latest
HackingGate Mar 5, 2019
eb48ee9
Merge pull request #50 from HackingGate/master
mrluanma Mar 6, 2019
22118e2
for audit fixed.
xtons Jul 5, 2022
881dd16
more compatible
xtons Jul 8, 2022
940711b
Merge pull request #55 from xtons/master
mrluanma Jul 16, 2022
cc0dd70
devenv init & bun
mrluanma Mar 5, 2024
fcefbea
Update dependencies.
mrluanma Mar 5, 2024
ba2fa5c
merge_sort.js -> Array.sort
mrluanma Mar 5, 2024
0d758d8
prettier
mrluanma Mar 5, 2024
64b47ec
commonjs -> esm
mrluanma Mar 5, 2024
9354a3f
(node:19613) [DEP0005] DeprecationWarning: Buffer() is deprecated due…
mrluanma Mar 5, 2024
a4e6068
IPv6
mrluanma Mar 5, 2024
30ae59c
Remove rc4*
mrluanma Mar 5, 2024
44f8e21
Remove ping.
mrluanma Mar 5, 2024
7a17132
Handles backpressure.
mrluanma Mar 5, 2024
66f06ac
Buffer.concat(cachedPieces)
mrluanma Mar 5, 2024
1879333
Remove table cipher.
mrluanma Mar 5, 2024
6e887fd
Move inetNtoa to utils.
mrluanma Mar 5, 2024
28a149b
test: Run server in the test process.
mrluanma Mar 6, 2024
8f19e8a
Fix EVP_BytesToKey memoize.
mrluanma Mar 6, 2024
c1fc88a
Refactor huge try-catch by buffer length checking.
mrluanma Mar 6, 2024
41e1bea
Send addr + data in one ws message.
mrluanma Mar 9, 2024
855c773
Buffer.slice -> Buffer.subarray.
mrluanma Mar 9, 2024
c6f484c
Simplify IPv6 inetNtoa.
mrluanma Mar 10, 2024
6c25c9f
Run prettier using devenv Pre-Commit Hooks.
mrluanma Mar 10, 2024
45ea2a7
Minor
mrluanma Mar 10, 2024
ac4f8f2
GitHub Actions
mrluanma Mar 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"customizations": {
"vscode": {
"extensions": [
"mkhl.direnv"
]
}
},
"image": "ghcr.io/cachix/devenv:latest",
"overrideCommand": false,
"updateContentCommand": "devenv ci"
}
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="

use devenv
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Test'

on:
pull_request:
push:

jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v26
- uses: cachix/cachix-action@v14
with:
name: devenv
- name: Install devenv.sh
run: nix profile install --accept-flake-config tarball+https://install.devenv.sh/latest

- name: Build the devenv shell and run any pre-commit hooks
run: devenv ci

- name: Run a single command in the devenv shell
run: devenv shell bun run test.js
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml

3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.yml
*.yaml
.devcontainer.json
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"bracketSpacing": false,
"singleQuote": true
}
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2018 Zhao Xiaohong
Copyright (c) 2012-2014 clowwindy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm start
91 changes: 57 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,76 @@
shadowsocks-dotcloud
===========
# shadowsocks-heroku

[![Build Status](https://travis-ci.org/clowwindy/shadowsocks-dotcloud.png)](https://travis-ci.org/clowwindy/shadowsocks-dotcloud)
shadowsocks-heroku is a lightweight tunnel proxy which can help you get through firewalls. It is a port of [shadowsocks](https://github.com/clowwindy/shadowsocks), but through a different protocol.

shadowsocks-dotcloud is a lightweight tunnel proxy which can help you get through
firewalls. It is a port of [shadowsocks](https://github.com/clowwindy/shadowsocks), but
through a different protocol.
shadowsocks-heroku uses WebSocket instead of raw sockets, so it can be deployed on [Heroku](https://www.heroku.com/).

shadowsocks-dotcloud uses WebSockets instead of raw sockets,
so it can be deployed on [dotcloud](https://www.dotcloud.com/).
Notice that the protocol is INCOMPATIBLE with shadowsocks.

Notice that the protocol is INCOMPATIBLE with the origin shadowsocks.
## Heroku

usage
-----------
### Usage

Sign up for [dotcloud](https://www.dotcloud.com/).
```
$ heroku create
Creating still-tor-8707... done, stack is cedar-14
http://still-tor-8707.herokuapp.com/ | [email protected]:still-tor-8707.git
```

Install [dotcloud CLI](https://docs.dotcloud.com/0.9/firststeps/install/).
Push the code to Heroku.

Put the code somewhere, for example shadowsocks-dotcloud/. Edit `shadowsocks/config.json`, change the following values:
```
$ git push heroku master
-----> Compressing... done, 5.1MB
-----> Launching... done, v3
http://still-tor-8707.herokuapp.com/ deployed to Heroku

server your server hostname, for example, shadowsocks-YOURUSERNAME.dotcloud.com
local_port local port
password a password used to encrypt transfer
timeout in seconds
method encryption method, null by default, or use "rc4"
To [email protected]:still-tor-8707.git
* [new branch] master -> master
```

Upload the code. You can choose your own app name other than `shadowsocks`. You'll see your hostname at the end.
Set a few configs:

$ dotcloud create shadowsocks
Created application "shadowsocks" using the flavor "sandbox"
...
$ dotcloud push --application shadowsocks shadowsocks-dotcloud/
# upload shadowsocks-dotcloud/ ssh://[email protected]:443/shadowsocks
...
Deployment finished. Your application is available at the following URLs
www: http://shadowsocks-YOURUSERNAME.dotcloud.com/
```
$ heroku config:set METHOD=aes-128-cfb KEY=foobar
Setting config vars and restarting still-tor-8707... done, v11
KEY: foobar
METHOD: aes-128-cfb
```

Open terminal, cd into shadowsocks, run `node local.js`.
Install project dependencies with `npm install`:

Change proxy settings of your browser into
```
$ npm install
```

SOCKS5 127.0.0.1:local_port
Then run:

```
$ node local.js -s still-tor-8707.herokuapp.com -l 1080 -m aes-128-cfb -k foobar -r 80
server listening at { address: '127.0.0.1', family: 'IPv4', port: 1080 }
```

troubleshooting
----------------
Change proxy settings of your browser into:

```
SOCKS5 127.0.0.1:1080
```

### Troubleshooting

If there is something wrong, you can check the logs by:

$ dotcloud logs www --application shadowsocks
```
$ heroku logs -t --app still-tor-8707
```

## Supported Ciphers

- aes-128-cfb
- aes-192-cfb
- aes-256-cfb
- camellia-128-cfb
- camellia-192-cfb
- camellia-256-cfb
Binary file added bun.lockb
Binary file not shown.
10 changes: 10 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"server": "127.0.0.1",
"local_address": "127.0.0.1",
"scheme": "ws",
"local_port": 1080,
"remote_port": 8080,
"password": "`try*(^^$some^$%^complex>:<>?~password/",
"timeout": 600,
"method": "aes-128-cfb"
}
Loading