简体   繁体   中英

running shadowsocks-nodejs on heroku

What I am trying to accomplish: Get shadowsocks-node.js to run on heroku.

shadowsocks-nodejs is a lightweight tunnel proxy which can help you get through firewalls.

I got it to run locally with both processes on the same machine.
My next step was to deploy it to heroku and run server.js there and local.js locally on my machine. However, I can't seem to get a connection going.

My problem: the connections seem to be refused by the server process.


node local.js outputs:

calculating ciphers
server listening at port 1080
server connected
concurrent connections: 1
remote connection refused
server connected
concurrent connections: 1
remote connection refused
server connected

and so on...

server.js outputs (via heroku logs ):

012-10-27T20:39:57+00:00 app[web.1]: server connected
2012-10-27T20:39:57+00:00 app[web.1]: concurrent connections: 1
2012-10-27T20:39:57+00:00 app[web.1]: server disconnected
2012-10-27T20:39:57+00:00 app[web.1]: concurrent connections: 0
2012-10-27T20:42:02+00:00 app[web.1]: server connected
2012-10-27T20:42:02+00:00 app[web.1]: concurrent connections: 1
2012-10-27T20:42:02+00:00 app[web.1]: server disconnected

and so on.

Chrome gives back the error:

Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.

(makes sense)


This is my config.json that is used by shadowsocks:

{
    "server":["https://damp-woodland-7539.herokuapp.com"],
    "server_port":58954,
    "local_port":1080,
    "password":"barfoo!",
    "timeout":60
}

I edited server.js to read (line 31):

//PORT = config.server_port;
PORT = process.env.PORT || 5000;

as advised for heroku apps.

And this is my package.json file:

{
  "name": "shadowsocks-nodejs",
  "scripts": {
    "start": "server.js"
  },
  "version": "0.0.1",
  "engines": {
    "node": "0.8.x"
  },
  "dependencies": {
    "fs": "*",
    "net": "*"
  }
}

This might be just a simple setup issue or some incorrect addresses. Would be great if someone of you could help me out.
Thanks a lot!

shadowsocks-nodejs is incompatible with Heroku. It's using raw sockets, while Heroku only provide HTTP access.

You can deploy shadowsocks-nodejs on a VPS with all the freedom of using raw sockets, or use shadowsocks-dotcloud if you want a free proxy.


EDIT:

The reason why there is no shadowsocks-heroku is that Heroku does not have websocket support.

Look this:

shadowsocks-heroku is a lightweight tunnel proxy which can help you get through firewalls. It is a port of shadowsocks, but through a different protocol.

shadowsocks-heroku uses WebSockets instead of raw sockets, so it can be deployed on heroku.

Notice that the protocol is INCOMPATIBLE with the origin shadowsocks.

https://github.com/mrluanma/shadowsocks-heroku

You might consider the websocket version of shadowsocks. I deployed the following shadowsocks-heroku in heroku, and have been using it for a long time.

https://github.com/mrluanma/shadowsocks-heroku

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM