anyproxy icon indicating copy to clipboard operation
anyproxy copied to clipboard

anyproxy能在一个系统上启动多个任务吗?

Open chenlei-123 opened this issue 7 years ago • 9 comments
trafficstars

Plese fill the template when you reporting a new issue, thanks!

Which platform are you running AnyProxy

Mac

The version of the AnyProxy

老版本

Your expected behavior of AnyProxy

The actual behavior of AnyProxy

The log of the error

chenlei-123 avatar Dec 14 '17 09:12 chenlei-123

可以啊,指定端口就可以啊

WonderfulLing avatar Dec 14 '17 14:12 WonderfulLing

@chenlei-123 通过在启动参数里面指定不同的端口即可启动多个任务

codingfishman avatar Dec 14 '17 16:12 codingfishman

@codingfishman anyproxy --port 8001,然后另起终端,anyproxy --port 8080,就报错。 Caught exception: Error: listen EADDRINUSE :::8002 at Object._errnoException (util.js:1024:11) at _exceptionWithHostPort (util.js:1046:20) at Server.setupListenHandle [as _listen2] (net.js:1351:14) at listenInCluster (net.js:1392:12) at Server.listen (net.js:1476:7) at Function.listen (/usr/local/lib/node_modules/anyproxy/node_modules/[email protected]@express/lib/application.js:618:24) at /usr/local/lib/node_modules/anyproxy/lib/webInterface.js:145:26 at Object._plugIntoWebinterface (/usr/local/lib/node_modules/anyproxy/lib/rule_default.js:178:9) at new webInterface (/usr/local/lib/node_modules/anyproxy/lib/webInterface.js:144:18) at /usr/local/lib/node_modules/anyproxy/proxy.js:172:46

chenlei-123 avatar Dec 15 '17 06:12 chenlei-123

@WonderfulLing anyproxy --port 8001,然后另起终端,anyproxy --port 8080,就报错。 Caught exception: Error: listen EADDRINUSE :::8002 at Object._errnoException (util.js:1024:11) at _exceptionWithHostPort (util.js:1046:20) at Server.setupListenHandle [as _listen2] (net.js:1351:14) at listenInCluster (net.js:1392:12) at Server.listen (net.js:1476:7) at Function.listen (/usr/local/lib/node_modules/anyproxy/node_modules/[email protected]@express/lib/application.js:618:24) at /usr/local/lib/node_modules/anyproxy/lib/webInterface.js:145:26 at Object._plugIntoWebinterface (/usr/local/lib/node_modules/anyproxy/lib/rule_default.js:178:9) at new webInterface (/usr/local/lib/node_modules/anyproxy/lib/webInterface.js:144:18) at /usr/local/lib/node_modules/anyproxy/proxy.js:172:46

chenlei-123 avatar Dec 15 '17 06:12 chenlei-123

anyproxy -p XXX -w XXX 需要指定webport

WonderfulLing avatar Dec 15 '17 07:12 WonderfulLing

@WonderfulLing 还是不行啊 anyproxy -p 8001 -w 8002,另起终端,anyproxy -p 9001 -w 9002,还是报错 Caught exception: Error: listen EADDRINUSE 0.0.0.0:8003 at Object._errnoException (util.js:1024:11) at _exceptionWithHostPort (util.js:1046:20) at Server.setupListenHandle [as _listen2] (net.js:1351:14) at listenInCluster (net.js:1392:12) at doListen (net.js:1501:7) at _combinedTickCallback (internal/process/next_tick.js:141:11) at process._tickCallback (internal/process/next_tick.js:180:9)

chenlei-123 avatar Dec 15 '17 07:12 chenlei-123

换到4.X的版本吧,wsport是随机的

WonderfulLing avatar Dec 15 '17 09:12 WonderfulLing

@chenlei-123 使用4.0版后不需要再配置wsport,如果需要使用3.x,通过命令行启动会遇到端口冲突,你可以通过模块直接使用,指定port,webport和wsport即可,如下:

var proxy = require("anyproxy");

var options = {
    port          : 8001,
    rule          : require("path/to/my/ruleModule.js"), // rule文件
    webPort       : 8002,  // web ui 端口
    socketPort    : 8003,  // WebSocket端口
   interceptHttps: true, // 代理https
    silent        : false // 不打印日志
};
new proxy.proxyServer(options);

4.0相比3.x版本,rule接口上做了一些变更,如果你方便迁移的话,推荐使用4.0

codingfishman avatar Dec 18 '17 05:12 codingfishman

anyproxy -p -w -e -i

zuiailaoda avatar Apr 16 '20 00:04 zuiailaoda