`
elgs
  • 浏览: 8683 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论

nproxy 基于Nodejs的Proxy

阅读更多

npr

A nodejs proxy server.

Supports TCP in proxy mode, HTTP and Websocket in router mode.

Installation

sudo npm install npr -g

Startup

  • Start the proxy server with default configuration 'proxy.json':
    npr

  • Start the proxy server with selected configuration 'google.json':
    npr google.json

  • Start the proxy server with multiple configurations 'google.json ms.json':
    npr google.json ms.json

Proxy mode

A configuration proxy.json looks like this:

{
  "microsoft" : {
    "dstPort" : 80,
    "localPort" : 3000,
    "dstAddr" : "www.microsoft.com"
  },
  "google" : {
    "dstPort" : 80,
    "localPort" : 2000,
    "localAddr" : "127.0.0.1",
    "dstAddr" : "www.google.com"
  }
}

means that:
when the clients connect to 127.0.0.1:3000, they connect to www.microsoft.com:80, and when the clients connect to127.0.0.1:2000, they connect to www.google.com:80.

Please note that localAddr is not necessary, when omitted, the server will listen on all network interfaces.

Router mode

Router mode works only with HTTP, not even HTTPS. Proxy mode and router mode can be working together happily. A configuration proxy.json looks like this:

{
  "google_ms" : {
    "localPort" : 4000,
    "routes" : {
      "hostname_a" : {
        "dstAddr" : "www.microsoft.com",
        "dstPort" : 80
      },
      "hostname_b" : {
        "dstAddr" : "www.google.com",
        "dstPort" : 80
      },
      "default" : {
        "dstAddr" : "www.yahoo.com",
        "dstPort" : 80
      }
    }
  }
}

means that:
if multiple host names / domain names are bound to the proxy server, let's say hostname_a and hostname_b. When the clients connect to hostname_a:4000, they connect to www.microsoft.com:80, and when the clients connect to hostname_b:4000, they connect to www.google.com:80. If the clients connect to a host name which is not in the route table, 127.0.0.1:4000 from the proxy server itelf, for example, they connect to the default route www.yahoo.com:80.

0
5
分享到:
评论
2 楼 sgp420 2013-07-16  
KAO,破解哪个东东 一年多前,在网上发现的;今天贴出来,供需要的人使用;
你NB是吧!!
1 楼 elgs 2013-06-05  
刚刚增加了Route Mode。

相关推荐

    nproxy2:一个轻量级的代理工具,运行于命令行,专注于本地远程文件替换,方便前端工程师的调试,提升效率

    本来准备给nproxy提MR,但是貌似给的反馈比较慢,而且考虑到提的MR可能不一定被采纳,所以最后决定基于nproxy,自己整一个专门给自己用的小工具。以上就是此项目产生的原因,感谢!下面是nproxy的说明文档。因为至...

    NProxy:一个nodejs https代理和一个ss like代理

    NProxy 配置写在config.js,分为tunnel,client,server三部分 一个基于隧道的https代理 参考 需要自己生成及导入证书 node lib/index.js -t 一个类ss实现 node lib/index.js -c client部分 node lib/index.js -s ...

    node-http-proxy:节点http代理服务器

    节点http代理具有单进程模式或多进程模式(设置参数“ -i”)的节点http代理服务器安装node-http-proxy $npm install -g node-http-proxy服务器启动 $nproxy start -p 9999 -i 1# start proxy server# create child ...

    IEProxyHelper

    IE代理帮助类,可以自动检测IE带代理设置,获取代理服务器信息,如果是设置为脚本代理(pac),可以..._tprintf(_T("***\nret:%d\nproxy:%s\n"), bRet, szProxy); 输出结果 OUTPUT: *** ret:1 proxy:proxy.tencent.com

    Tion Proxy-crx插件

    语言:English (United States) 在您的浏览器中创建代理的简单易行! Tion Proxy是Fiddler,Charles或Nproxy的免费替代产品。

    concurrency:python中Web服务器并发的一些带注释的例子

    Web 应用程序并发 尤其是在 Python 中 这个存储库包含一堆我正在注释的代码,这些代码演示了在 Web 应用程序中实现并发的不同方法。... nproxy.js - 在实现的应用程序,使用回调。 proxy.go - 在实现的应用程序。 t

Global site tag (gtag.js) - Google Analytics