Skip to content

Commit

Permalink
Issue #8 Add the possibility to block unreachable IP
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyben committed Mar 27, 2020
1 parent 6060088 commit 097faed
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/main-process/ping-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ function Ping(host, options) {

if (WIN) {
this._bin = 'c:/windows/system32/ping.exe';
this._args = (options.args) ? options.args : ['-n', '1', '-w', '5000', host];
this._args = (options.args) ? options.args : ['-n', '1', '-w', '1000', host];
this._regmatch = /[><=]([0-9.]+?)\s*ms/; // No space before "ms"
}
else if (LIN) {
this._bin = '/bin/ping';
this._args = (options.args) ? options.args : ['-n', '-w', '2', '-c', '1', host];
this._args = (options.args) ? options.args : ['-n', '-w', '1', '-c', '1', host];
this._regmatch = /=([0-9.]+?)\s*ms/; // need to verify this
}
else if (MAC) {
this._bin = '/sbin/ping';
this._args = (options.args) ? options.args : ['-n', '-t', '2', '-c', '1', host];
this._args = (options.args) ? options.args : ['-n', '-t', '1', '-c', '1', host];
this._regmatch = /=([0-9.]+?)\s*ms/;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion app/main-process/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PingWrapper.prototype.execute = function () {

setTimeout(function () {
ping.stop();
}, 30000);
}, 1000);
});
});
} catch (error) {
Expand Down
4 changes: 1 addition & 3 deletions app/main-process/world-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ ipcMain.on('add-cluster-in-ip-rules', (event, arg) => {
let ipList = [];

hostList.forEach(host => {
if (host.alive) {
ipList.push(host.ip);
}
ipList.push(host.ip);
});

win.webContents.send('add-specific-servers', [result, ipList, hostList]);
Expand Down
5 changes: 0 additions & 5 deletions app/renderer-process/left-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ ipcRenderer.on('add-specific-servers', (event, arg) => {
const spanServersList = document.getElementById('servers-list');

hosts.forEach(host => {

if (host.time == 0) {
return;
}

serversList.forEach(server => {
if (server.cityName === host.cityName) {
check = true;
Expand Down

0 comments on commit 097faed

Please sign in to comment.