mirror of
https://github.com/mii443/sindan-client.git
synced 2025-08-22 16:25:41 +00:00
Updated /macos/package-lock.json v2
This commit is contained in:
11285
linux/package-lock.json
generated
11285
linux/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,15 @@
|
||||
{
|
||||
"name": "linux",
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.0",
|
||||
"description": "sindan-client-linux",
|
||||
"main": "speedindex.js",
|
||||
"dependencies": {
|
||||
"log": "^6.0.0",
|
||||
"npm": "^6.14.9",
|
||||
"npm-check-updates": "^10.2.3",
|
||||
"puppeteer-core": "^5.5.0",
|
||||
"puppeteer-core": "^1.11.0",
|
||||
"speedline": "^1.4.3"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
@ -24,5 +23,6 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/SINDAN/sindan-client/issues"
|
||||
},
|
||||
"homepage": "https://github.com/SINDAN/sindan-client#readme"
|
||||
"homepage": "https://github.com/SINDAN/sindan-client#readme",
|
||||
"devDependencies": {}
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ readonly ST_SRVS="https://inonius.net/speedtest/?ispInfo=false"
|
||||
|
||||
# urls for speedindex
|
||||
readonly SI_SRVS="http://www.wide.ad.jp/,https://yahoo.co.jp/,https://google.co.jp/"
|
||||
readonly SI_TIMEOUT="0"
|
||||
|
||||
# upload urls
|
||||
readonly URL_CAMPAIGN="http://fluentd.sindan-net.com:8888/sindan.log_campaign"
|
||||
|
@ -1994,33 +1994,34 @@ cmdset_portscan () {
|
||||
|
||||
#
|
||||
do_speedindex() {
|
||||
if [ $# -ne 1 ]; then
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "ERROR: do_speedindex <target_url>." 1>&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
tracejson=trace-json/$(echo "$1" | sed 's/[.:/]/_/g').json
|
||||
node speedindex.js "$1" ${tracejson}
|
||||
node speedindex.js "$1" "$2" ${tracejson}
|
||||
return $?
|
||||
}
|
||||
|
||||
#
|
||||
cmdset_speedindex() {
|
||||
if [ $# -ne 5 ]; then
|
||||
if [ $# -ne 6 ]; then
|
||||
echo "ERROR: cmdset_speedindex <layer> <version> <target_type>" \
|
||||
"<target_addr> <count>." 1>&2
|
||||
"<SI_TIMEOUT> <target_addr> <count>." 1>&2
|
||||
return 1
|
||||
fi
|
||||
local layer=$1
|
||||
local ver=$2
|
||||
local type=$3
|
||||
local target=$4
|
||||
local count=$5
|
||||
local timeout=$4
|
||||
local target=$5
|
||||
local count=$6
|
||||
local result=$FAIL
|
||||
local string=" speedindex to extarnal server: $target by $ver"
|
||||
local string=" speedindex to extarnal server: $target by $ver (timeout: $timeout)"
|
||||
local speedindex_ans
|
||||
|
||||
if speedindex_ans=$(do_speedindex ${target}); then
|
||||
if speedindex_ans=$(do_speedindex ${target} ${timeout}); then
|
||||
result=$SUCCESS
|
||||
else
|
||||
stat=$?
|
||||
@ -3247,7 +3248,7 @@ if [ "$v4addr_type" = "private" ] || [ "$v4addr_type" = "global" ] || \
|
||||
for target in $(echo "$SI_SRVS" | sed 's/,/ /g'); do
|
||||
|
||||
# Do speedindex
|
||||
cmdset_speedindex "$layer" Dualstack speedidsrv "$target" "$count"
|
||||
cmdset_speedindex "$layer" Dualstack speedidsrv "$SI_TIMEOUT" "$target" "$count"
|
||||
|
||||
count=$(( count + 1 ))
|
||||
done
|
||||
|
@ -1,6 +1,6 @@
|
||||
// speedindex.js
|
||||
// author: bashow
|
||||
// 2020/03/24
|
||||
// 2021/12/08
|
||||
|
||||
// Requirements:
|
||||
// sudo apt install chromium-browser
|
||||
@ -9,32 +9,39 @@
|
||||
// npm i speedline
|
||||
|
||||
// How to use:
|
||||
// node speedindex.js <url>
|
||||
// node speedindex.js <url> <timeout>
|
||||
// OUTPUT [speedindex]
|
||||
|
||||
const puppeteer = require('puppeteer-core');
|
||||
const speedline = require('speedline');
|
||||
|
||||
var url = process.argv[2];
|
||||
var traceJson = process.argv[3];
|
||||
var timeOut = process.argv[3];
|
||||
var traceJson = process.argv[4];
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch({
|
||||
executablePath: '/usr/bin/chromium-browser',
|
||||
args: ['--no-sandbox']});
|
||||
const page = await browser.newPage();
|
||||
await page.setDefaultNavigationTimeout(60000);
|
||||
await page.tracing.start({
|
||||
path: traceJson,
|
||||
screenshots: true
|
||||
})
|
||||
try {
|
||||
await page.tracing.start({
|
||||
path: traceJson,
|
||||
screenshots: true
|
||||
})
|
||||
|
||||
await page.goto(url);
|
||||
await page.tracing.stop();
|
||||
await browser.close();
|
||||
|
||||
speedline(traceJson).then(res => {
|
||||
await page.goto(url, {
|
||||
waitUntil:'load',
|
||||
timeout: parseInt(timeOut, 10)
|
||||
});
|
||||
await page.tracing.stop();
|
||||
speedline(traceJson).then(res => {
|
||||
console.log(res.speedIndex)
|
||||
});
|
||||
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(-1)
|
||||
// throw e;
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
})();
|
||||
|
Reference in New Issue
Block a user