Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Vahid Farid committed Mar 21, 2023
1 parent bcbf45d commit dc39ce5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@
<label>تاخیر مجاز: <input type="number" id="max-latency" min="300" max="3000" step="50"/></label>
</td>
</tr>
<tr>
<td colspan="2">
<label>عبارت منظم: <input type="text" dir="ltr" id="ip-regex" placeholder="^104\.17\.|^141\." /></label>
</td>
</tr>
<tr>
<td>
<label>استفاده از آدرس لندن: <input id="uk-cdn" type="checkbox" /></label>
Expand Down Expand Up @@ -349,21 +354,25 @@
let maxLatency;
let numberOfWorkingIPs;
let includeUK;
let ipRegex;

document.getElementById('max-ip').value = localStorage.getItem('max-ip') || 5;
document.getElementById('max-latency').value = localStorage.getItem('max-latency') || 1000;
document.getElementById('uk-cdn').checked = localStorage.getItem('include-uk') == 'true';
document.getElementById('ip-regex').value = localStorage.getItem('ip-regex');

function startScan() {
document.getElementById('start-hint').style.display='none';

maxIP = ~~document.getElementById('max-ip').value;
maxLatency = ~~document.getElementById('max-latency').value;
includeUK = !!document.getElementById('uk-cdn').checked;
ipRegex = document.getElementById('ip-regex').value;

localStorage.setItem('max-ip', maxIP);
localStorage.setItem('max-latency', maxLatency);
localStorage.setItem('include-uk', includeUK);
localStorage.setItem('ip-regex', ipRegex);

testNo = 0;
numberOfWorkingIPs = 0;
Expand All @@ -378,6 +387,13 @@
ips = ips.concat(cidrToIpArray(cidr, cdnLocation));
}
}

if (ipRegex) {
const regex = new RegExp(ipRegex);
ips = ips.filter(el => regex.test(el.ip));
console.log(regex, ips)
}

testIPs(randomizeElements(ips));
}

Expand Down

0 comments on commit dc39ce5

Please sign in to comment.