Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fetch("http://speedsmart.net/resources/serversJSON.php").then(function(r){return r.json()}).then(function(d){
- var sl=d.serverList.reverse(),i=0,l=sl.length;
- sl=sl.filter(function(a){return a.serverID!="31" && a.serverID!="32" });l=sl.length-1;
- function ping(_s) {
- // console.log(_s);
- var t1=new Date();
- fetch(_s.ping_url, {method: 'HEAD', redirect: 'follow',mode:'no-cors', cache:'no-cache' }).then(function(r){if (r.ok) { return r.text()} else {return 'failed'}}).then(function(d){
- console.log([i,new Date()-t1,_s.serverName, _s.ping_url.split('/')[2],_s.distance].join("\t"));
- if (i<l) {i++;ping(sl[i]) }
- }).catch(function(err) {
- console.log(i,_s.serverName,'failed: '+ err,_s.serverID);
- // console.log(err);
- if (i<l) {i++;ping(sl[i])}
- })
- }
- ping(sl[i]);
- })
- // http://speedsmart.net/resources/startupJSON.php user_isp user_address closestServer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement