mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-05-08 05:00:34 -05:00
Updated the provider parser
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
const roundSpeed = (bytes, elapsed) => {
|
||||
return Math.round((bytes * 8 / elapsed) / 10) / 100;
|
||||
const roundSpeed = (bandwidth) => {
|
||||
return Math.round(bandwidth / 1250) / 100;
|
||||
}
|
||||
|
||||
module.exports.parseOokla = (test) => {
|
||||
let ping = Math.round(test.ping.latency);
|
||||
let download = roundSpeed(test.download.bytes, test.download.elapsed);
|
||||
let upload = roundSpeed(test.upload.bytes, test.upload.elapsed);
|
||||
let download = roundSpeed(test.download.bandwidth);
|
||||
let upload = roundSpeed(test.upload.bandwidth);
|
||||
let time = Math.round((test.download.elapsed + test.upload.elapsed) / 1000);
|
||||
|
||||
return {ping, download, upload, time};
|
||||
return {ping, download, upload, time, resultId: test.result.id};
|
||||
}
|
||||
|
||||
module.exports.parseLibre = (test) => ({...test, time: Math.round(test.elapsed / 1000)});
|
||||
module.exports.parseLibre = (test) => ({...test, ping: Math.round(test.ping), time: Math.round(test.elapsed / 1000),
|
||||
resultId: null});
|
||||
|
||||
module.exports.parseCloudflare = (test) => ({...test, time: Math.round(test.elapsed)});
|
||||
module.exports.parseCloudflare = (test) => ({...test, time: Math.round(test.elapsed), resultId: null});
|
||||
|
||||
module.exports.parseData = (provider, data) => {
|
||||
switch (provider) {
|
||||
|
||||
Reference in New Issue
Block a user