简体   繁体   English

错误:不兼容的SOCKS协议版本:71

[英]Error: Incompatible SOCKS protocol version: 71

I am trying to implement the ssh2 node module example which is using socksv5. 我正在尝试实现使用socksv5的ssh2节点模块示例。

var socks = require('socksv5'),
Connection = require('ssh2');

var ssh_config = {
host: '192.168.100.1',
port: 22,
username: 'nodejs',
password: 'rules'
};

socks.createServer(function(info, accept, deny) {
var conn = new Connection();
conn.on('ready', function() {
   conn.forwardOut(info.srcAddr,
                   info.srcPort,
                   info.dstAddr,
                   info.dstPort,
                   function(err, stream) {
                      if (err)
                         return deny();

                     var clientSocket;
                     if (clientSocket = accept(true)) {
                        stream.pipe(clientSocket).pipe(stream).on('close', function() {
                        conn.end();
                        });
                     } else
                         conn.end();
                  });
              }).on('error', function(err) {
                   deny();
          }).connect(ssh_config);
       }).listen(1080, 'localhost', function() {
            console.log('SOCKSv5 proxy server started on port 1080');
       }).useAuth(socks.auth.None());

ssh2 connection is working but I am getting this error when calling the page in browser. ssh2连接正常,但是在浏览器中调用页面时出现此错误。

Help would be much appreciated Kind regards Thomas 谢谢您的帮助

You're trying to use the SOCKS 5 proxy as an HTTP proxy. 您正在尝试将SOCKS 5代理用作HTTP代理。 These are not the same protocols. 这些不是相同的协议。

So for example in Firefox, Tools -> Options -> Advanced -> Connection Settings -> "SOCKS Host" is what you want to fill out (localhost and port 1080), not "HTTP Proxy." 因此,例如在Firefox中,您要填写的是工具->选项->高级->连接设置->“ SOCKS主机”(本地主机和端口1080),而不是“ HTTP代理”。

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

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