Skip to content

Commit 1cfaa25

Browse files
committed
code cleanup
1 parent 99aa66a commit 1cfaa25

File tree

3 files changed

+1010
-1010
lines changed

3 files changed

+1010
-1010
lines changed

demo/socksproxy.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ var srv = new Proxy({export: 'https://9f34d25f045b34f1cc7f423e15c2b416.vurl.51de
1616

1717
sockspxySrv.on('error', function (e) {
1818
console.error('SERVER ERROR: %j', e);
19-
if (e.code == 'EADDRINUSE') {
20-
console.log('Address in use, retrying in 10 seconds...');
21-
setTimeout(function () {
22-
console.log('Reconnecting to %s:%s', HOST, PORT);
23-
sockspxySrv.close();
24-
sockspxySrv.listen(51888);
25-
}, 10000);
26-
}
19+
if (e.code == 'EADDRINUSE') {
20+
console.log('Address in use, retrying in 10 seconds...');
21+
setTimeout(function () {
22+
console.log('Reconnecting to %s:%s', HOST, PORT);
23+
sockspxySrv.close();
24+
sockspxySrv.listen(51888);
25+
}, 10000);
26+
}
2727
});
2828
console.log('Socks forward proxy server listen on port 51888');
2929
});

filter.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -1147,27 +1147,27 @@ var RULES_CN = [
11471147
];
11481148

11491149
function isDomain(domain, host) {
1150-
var host_length, domain_length;
1151-
return ((domain[0] === '.') ?
1152-
(host === domain.slice(1) ||
1153-
((host_length = host.length) >=
1154-
(domain_length = domain.length) &&
1155-
host.slice(host_length - domain_length) === domain)) :
1156-
(host === domain));
1150+
var host_length, domain_length;
1151+
return ((domain[0] === '.') ?
1152+
(host === domain.slice(1) ||
1153+
((host_length = host.length) >=
1154+
(domain_length = domain.length) &&
1155+
host.slice(host_length - domain_length) === domain)) :
1156+
(host === domain));
11571157
}
11581158

11591159
// check on CN sites
11601160
// TBD ... check on geoIP
11611161
module.exports.isCN = function(host, url) {
1162-
for (var j = 0; j < RULES_CN.length; j++) {
1163-
var rules = RULES_CN[j];
1162+
for (var j = 0; j < RULES_CN.length; j++) {
1163+
var rules = RULES_CN[j];
11641164

1165-
for (var i = 0; i < rules.length; i++) {
1166-
if (isDomain(rules[i], host) === true) {
1167-
return true;
1168-
}
1169-
}
1170-
}
1165+
for (var i = 0; i < rules.length; i++) {
1166+
if (isDomain(rules[i], host) === true) {
1167+
return true;
1168+
}
1169+
}
1170+
}
11711171

1172-
return false;
1172+
return false;
11731173
};

0 commit comments

Comments
 (0)