简体   繁体   English

在heroku上运行shadowsocks-nodejs

[英]running shadowsocks-nodejs on heroku

What I am trying to accomplish: Get shadowsocks-node.js to run on heroku.我想要完成的是:让shadowsocks-node.js在 heroku 上运行。

shadowsocks-nodejs is a lightweight tunnel proxy which can help you get through firewalls. shadowsocks-nodejs 是一个轻量级的隧道代理,可以帮助你通过防火墙。

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.我的下一步是将它部署到 heroku 并在我的机器上本地运行 server.js 和 local.js。 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:节点 local.js 输出:

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 ): server.js 输出(通过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: Chrome 返回错误:

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:这是 shadowsocks 使用的我的 config.json:

{
    "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):我编辑了 server.js 来阅读(第 31 行):

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

as advised for heroku apps.如针对 heroku 应用程序的建议。

And this is my package.json file:这是我的 package.json 文件:

{
  "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. shadowsocks-nodejs 与 Heroku 不兼容。 It's using raw sockets, while Heroku only provide HTTP access.它使用原始套接字,而 Heroku 仅提供 HTTP 访问。

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.您可以在 VPS 上部署 shadowsocks-nodejs,并且可以完全自由地使用原始套接字,或者如果您想要免费代理,则使用shadowsocks-dotcloud


EDIT:编辑:

The reason why there is no shadowsocks-heroku is that Heroku does not have websocket support.没有 shadowsocks-heroku 的原因是 Heroku 没有 websocket 支持。

Look this:看看这个:

shadowsocks-heroku is a lightweight tunnel proxy which can help you get through firewalls. shadowsocks-heroku 是一个轻量级的隧道代理,可以帮助您通过防火墙。 It is a port of shadowsocks, but through a different protocol.它是 shadowsocks 的一个端口,但通过不同的协议。

shadowsocks-heroku uses WebSockets instead of raw sockets, so it can be deployed on heroku. shadowsocks-heroku 使用 WebSockets 而不是原始套接字,因此它可以部署在 heroku 上。

Notice that the protocol is INCOMPATIBLE with the origin shadowsocks.请注意,该协议与原始 shadowsocks 不兼容。

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

You might consider the websocket version of shadowsocks. 您可能考虑使用shadowsocks的websocket版本。 I deployed the following shadowsocks-heroku in heroku, and have been using it for a long time. 我在heroku中部署了以下shadowsocks-heroku,并已使用了很长时间。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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