mirror of
https://github.com/avwo/whistle.git
synced 2026-10-29 07:06:36 +08:00
refactor: code
This commit is contained in:
+9
-8
@@ -185,12 +185,7 @@ function resolveWebsocket(socket, wss) {
|
||||
data.abort = destroy;
|
||||
proxy.emit('request', reqEmitter, data);
|
||||
}
|
||||
if (socket.enable.abort || filter.abort) {
|
||||
return destroy();
|
||||
}
|
||||
if (response()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pluginMgr.loadPlugin(plugin, function(err, ports) {
|
||||
if (err) {
|
||||
return execCallback(err);
|
||||
@@ -209,8 +204,14 @@ function resolveWebsocket(socket, wss) {
|
||||
return;
|
||||
}
|
||||
plugin = null;
|
||||
rules.getProxy(fullUrl, plugin ? null : socket, function(err, hostIp, hostPort) {
|
||||
proxyUrl = !plugin && _rules.proxy ? util.rule.getMatcher(_rules.proxy) : null;
|
||||
if (socket.enable.abort || filter.abort) {
|
||||
return destroy();
|
||||
}
|
||||
if (response()) {
|
||||
return;
|
||||
}
|
||||
rules.getProxy(fullUrl, socket, function(err, hostIp, hostPort) {
|
||||
proxyUrl = _rules.proxy ? util.rule.getMatcher(_rules.proxy) : null;
|
||||
if (proxyUrl) {
|
||||
var isXProxy = X_RE.test(proxyUrl);
|
||||
var isSocks = SOCKS_PROXY_RE.test(proxyUrl);
|
||||
|
||||
Reference in New Issue
Block a user