@vpalmisano/webrtcperf 4.1.5 → 4.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -9
- package/app.min.js +1 -1
- package/build/src/config.d.ts +3 -3
- package/build/src/config.js +36 -27
- package/build/src/config.js.map +1 -1
- package/build/src/server.js +4 -4
- package/build/src/server.js.map +1 -1
- package/build/src/session.d.ts +3 -3
- package/build/src/session.js +6 -6
- package/build/src/session.js.map +1 -1
- package/build/src/stats.d.ts +1 -1
- package/build/src/stats.js +24 -4
- package/build/src/stats.js.map +1 -1
- package/build/src/utils.d.ts +3 -3
- package/build/src/utils.js +5 -8
- package/build/src/utils.js.map +1 -1
- package/build/src/vmaf.js +19 -12
- package/build/src/vmaf.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -21
- package/src/config.ts +36 -27
- package/src/server.ts +4 -4
- package/src/session.ts +10 -9
- package/src/stats.ts +25 -4
- package/src/utils.ts +8 -11
- package/src/vmaf.ts +33 -14
package/build/src/config.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ declare const _schemaProperties: {
|
|
|
25
25
|
throttleConfig: string;
|
|
26
26
|
randomAudioPeriod: number;
|
|
27
27
|
randomAudioProbability: number;
|
|
28
|
-
randomAudioRange:
|
|
28
|
+
randomAudioRange: string;
|
|
29
29
|
chromiumPath: string;
|
|
30
30
|
chromiumVersion: any;
|
|
31
31
|
chromiumUrl: string;
|
|
@@ -34,7 +34,7 @@ declare const _schemaProperties: {
|
|
|
34
34
|
windowHeight: number;
|
|
35
35
|
deviceScaleFactor: number;
|
|
36
36
|
maxVideoDecoders: number;
|
|
37
|
-
|
|
37
|
+
maxVideoDecodersRange: string;
|
|
38
38
|
incognito: boolean;
|
|
39
39
|
display: string;
|
|
40
40
|
sessions: number;
|
|
@@ -46,6 +46,7 @@ declare const _schemaProperties: {
|
|
|
46
46
|
showPageLog: boolean;
|
|
47
47
|
pageLogFilter: string;
|
|
48
48
|
pageLogPath: string;
|
|
49
|
+
enableBrowserLogging: string;
|
|
49
50
|
userAgent: string;
|
|
50
51
|
scriptPath: string;
|
|
51
52
|
scriptParams: string;
|
|
@@ -54,7 +55,6 @@ declare const _schemaProperties: {
|
|
|
54
55
|
sessionStorage: string;
|
|
55
56
|
clearCookies: boolean;
|
|
56
57
|
enableGpu: string;
|
|
57
|
-
enableBrowserLogging: string;
|
|
58
58
|
blockedUrls: string;
|
|
59
59
|
extraHeaders: string;
|
|
60
60
|
responseModifiers: string;
|
package/build/src/config.js
CHANGED
|
@@ -110,9 +110,16 @@ session, \`$i\` the tab absolute index.`,
|
|
|
110
110
|
},
|
|
111
111
|
customUrlHandler: {
|
|
112
112
|
doc: `This argument specifies the file path for the custom page URL handler that will be exported by default. \
|
|
113
|
-
The custom page URL handler allows you to define custom URLs that can be used to open your application
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
The custom page URL handler allows you to define custom URLs that can be used to open your application. \
|
|
114
|
+
The handler function will be called with the following variables: \
|
|
115
|
+
- sessions: the total number of sessions; \
|
|
116
|
+
- tabsPerSession: the total number of tabs per session; \
|
|
117
|
+
- id: the session global index (0-indexed); \
|
|
118
|
+
- index: the tab global index (0-indexed); \
|
|
119
|
+
- tabIndex: the tab index in the current session (0-indexed); \
|
|
120
|
+
- pid: the process pid; \
|
|
121
|
+
- env: the environment variables object; \
|
|
122
|
+
- params: the script parameters object. \
|
|
116
123
|
You can use these variables to create custom URL schemes that suit your application's needs.`,
|
|
117
124
|
format: String,
|
|
118
125
|
default: '',
|
|
@@ -223,8 +230,8 @@ seconds.`,
|
|
|
223
230
|
},
|
|
224
231
|
randomAudioPeriod: {
|
|
225
232
|
doc: `If not zero, it specifies the maximum period in seconds after which \
|
|
226
|
-
a new random active
|
|
227
|
-
that
|
|
233
|
+
a new random active session is selected, enabling the getUserMedia audio tracks in \
|
|
234
|
+
that session and disabling all of the others.`,
|
|
228
235
|
format: 'nat',
|
|
229
236
|
default: 0,
|
|
230
237
|
env: 'RANDOM_AUDIO_PERIOD',
|
|
@@ -239,10 +246,11 @@ the selected audio will be activated (value: 0-100).`,
|
|
|
239
246
|
arg: 'random-audio-probability',
|
|
240
247
|
},
|
|
241
248
|
randomAudioRange: {
|
|
242
|
-
doc: `When using random audio period, it defines the
|
|
243
|
-
to be included into the random selection.`,
|
|
244
|
-
format: '
|
|
245
|
-
default:
|
|
249
|
+
doc: `When using random audio period, it defines the session indexes \
|
|
250
|
+
to be included into the random selection (default: include all the sessions).`,
|
|
251
|
+
format: 'index',
|
|
252
|
+
default: 'true',
|
|
253
|
+
nullable: true,
|
|
246
254
|
env: 'RANDOM_AUDIO_RANGE',
|
|
247
255
|
arg: 'random-audio-range',
|
|
248
256
|
},
|
|
@@ -314,12 +322,13 @@ The total decoders count is stored into the virtual file \`/dev/shm/chromium-vid
|
|
|
314
322
|
env: 'MAX_VIDEO_DECODERS',
|
|
315
323
|
arg: 'max-video-decoders',
|
|
316
324
|
},
|
|
317
|
-
|
|
318
|
-
doc: `
|
|
319
|
-
format:
|
|
320
|
-
default:
|
|
321
|
-
|
|
322
|
-
|
|
325
|
+
maxVideoDecodersRange: {
|
|
326
|
+
doc: `It applies the max video decoders option to the sessions included into this list (default: include all the sessions)`,
|
|
327
|
+
format: 'index',
|
|
328
|
+
default: 'true',
|
|
329
|
+
nullable: true,
|
|
330
|
+
env: 'MAX_VIDEO_DECODERS_RANGE',
|
|
331
|
+
arg: 'max-video-decoders-range',
|
|
323
332
|
},
|
|
324
333
|
incognito: {
|
|
325
334
|
doc: `Runs the browser in incognito mode.`,
|
|
@@ -377,7 +386,7 @@ calculated using \`Date.now()\``,
|
|
|
377
386
|
enableDetailedStats: {
|
|
378
387
|
doc: `If detailed participant metrics values should be collected.`,
|
|
379
388
|
format: 'index',
|
|
380
|
-
default: '',
|
|
389
|
+
default: '0-24',
|
|
381
390
|
nullable: true,
|
|
382
391
|
env: 'ENABLE_DETAILED_STATS',
|
|
383
392
|
arg: 'enable-detailed-stats',
|
|
@@ -398,7 +407,7 @@ calculated using \`Date.now()\``,
|
|
|
398
407
|
},
|
|
399
408
|
pageLogFilter: {
|
|
400
409
|
doc: `If set, only the logs with the matching text will be printed \
|
|
401
|
-
on console. Regexp string allowed.`,
|
|
410
|
+
on the console. Regexp string allowed.`,
|
|
402
411
|
format: String,
|
|
403
412
|
default: '',
|
|
404
413
|
nullable: true,
|
|
@@ -406,17 +415,25 @@ on console. Regexp string allowed.`,
|
|
|
406
415
|
arg: 'page-log-filter',
|
|
407
416
|
},
|
|
408
417
|
pageLogPath: {
|
|
409
|
-
doc: `If set, page console logs will be saved on the selected file path.`,
|
|
418
|
+
doc: `If set, the page console logs will be saved on the selected file path.`,
|
|
410
419
|
format: String,
|
|
411
420
|
default: '',
|
|
412
421
|
nullable: true,
|
|
413
422
|
env: 'PAGE_LOG_PATH',
|
|
414
423
|
arg: 'page-log-path',
|
|
415
424
|
},
|
|
425
|
+
enableBrowserLogging: {
|
|
426
|
+
doc: `It enables the Chromium browser logging for the specified session indexes. It requires the page log path option to be set. `,
|
|
427
|
+
format: 'index',
|
|
428
|
+
nullable: true,
|
|
429
|
+
default: '',
|
|
430
|
+
env: 'ENABLE_BROWSER_LOGGING',
|
|
431
|
+
arg: 'enable-browser-logging',
|
|
432
|
+
},
|
|
416
433
|
userAgent: {
|
|
417
434
|
doc: `The user agent override.`,
|
|
418
435
|
format: String,
|
|
419
|
-
default: '',
|
|
436
|
+
default: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
|
|
420
437
|
nullable: true,
|
|
421
438
|
env: 'USER_AGENT',
|
|
422
439
|
arg: 'user-agent',
|
|
@@ -485,14 +502,6 @@ use the host X server instance.`,
|
|
|
485
502
|
env: 'ENABLE_GPU',
|
|
486
503
|
arg: 'enable-gpu',
|
|
487
504
|
},
|
|
488
|
-
enableBrowserLogging: {
|
|
489
|
-
doc: `It enables the Chromium browser logging for the specified session indexes.`,
|
|
490
|
-
format: 'index',
|
|
491
|
-
nullable: true,
|
|
492
|
-
default: '',
|
|
493
|
-
env: 'ENABLE_BROWSER_LOGGING',
|
|
494
|
-
arg: 'enable-browser-logging',
|
|
495
|
-
},
|
|
496
505
|
blockedUrls: {
|
|
497
506
|
doc: `A comma-separated list of request URLs that will be automatically \
|
|
498
507
|
blocked.`,
|
package/build/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAm0BA,sCAEC;AAWD,gCAiBC;AAj2BD,mDAA6C;AAC7C,iFAA8D;AAC9D,2BAA+B;AAC/B,4CAAmB;AACnB,+BAA2B;AAE3B,iEAAiE;AACjE,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE3C,mCAAgC;AAChC,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEvC,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAS,EAAE,EAAE;QACtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAED,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC;IACzB,QAAQ,EAAE,CAAC,CAA4B,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,K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AAC,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IAClC,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import convict, { addFormats } from 'convict'\nimport { ipaddress, url } from 'convict-format-with-validator'\nimport { existsSync } from 'fs'\nimport os from 'os'\nimport { join } from 'path'\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports\nconst puppeteer = require('puppeteer-core')\n\nimport { logger } from './utils'\nconst log = logger('webrtcperf:config')\n\nconst float = {\n name: 'float',\n coerce: (v: string) => parseFloat(v),\n validate: (v: number) => {\n if (!Number.isFinite(v)) throw new Error(`Invalid float: ${v}`)\n },\n}\n\nconst index = {\n name: 'index',\n coerce: (v: unknown) => v,\n validate: (v: boolean | string | number) => {\n if (typeof v === 'string') {\n if (v === 'true' || v === 'false' || v === '') return\n if (v.includes('-')) {\n v.split('-').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (v.includes(',')) {\n v.split(',').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (isNaN(parseInt(v)) || !isFinite(parseInt(v))) throw new Error(`Invalid string index: ${v}`)\n return\n } else if (typeof v === 'number' || typeof v === 'boolean') {\n return\n }\n throw new Error(`Invalid index: \"${v}\" (type: ${typeof v})`)\n },\n}\n\naddFormats({ ipaddress, url, float, index })\n\n// config schema\nconst configSchema = convict({\n url: {\n doc: `The page url to load.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL',\n arg: 'url',\n },\n urlQuery: {\n doc: `The query string to append to the page url; the following template \\\nvariables are replaced: \\`$p\\` the process pid, \\`$s\\` the session index, \\\n\\`$S\\` the total sessions, \\`$t\\` the tab index, \\`$T\\` the total tabs per \\\nsession, \\`$i\\` the tab absolute index.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL_QUERY',\n arg: 'url-query',\n },\n customUrlHandler: {\n doc: `This argument specifies the file path for the custom page URL handler that will be exported by default. \\\nThe custom page URL handler allows you to define custom URLs that can be used to open your application, \\\nand provides the following variables for customization: \\`$p\\`: the process pid, \\`$s\\`: the session index, \\\n\\`$S\\`: the total sessions, \\`$t\\`: the tab index, \\`$T\\`: the total tabs per session, \\`$i\\`: the tab absolute index.\nYou can use these variables to create custom URL schemes that suit your application's needs.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CUSTOM_URL_HANDLER',\n arg: 'custom-url-handler',\n },\n // fake video/audio\n videoPath: {\n doc: `The fake video path; if set, the video will be used as fake \\\nmedia source. It accepts a single path or a comma-separated list of videos \\\npaths that will be used in round-robin by the started sessions. \\\nThe docker pre-built image contains a 2 minutes video sequence stored at \\\n\\`/app/video.mp4\\`. \\\nIt accepts a local file, an http endpoint or a string starting with\n\\`generate:\\` (example: \\`generate:null\\` will generate a black video with \\\nsilent audio). \\\nThe temporary files containing the raw video and audio will be stored at \\\n\\`\\${VIDEO_CACHE_PATH}/video.\\${VIDEO_FORMAT}\\` and \\\n\\`\\${VIDEO_CACHE_PATH}/audio.wav\\`.`,\n format: String,\n default: 'https://github.com/vpalmisano/webrtcperf/releases/download/v2.0.4/video.mp4',\n env: 'VIDEO_PATH',\n arg: 'video-path',\n },\n videoWidth: {\n doc: `The fake video resize width.`,\n format: 'nat',\n default: 1280,\n env: 'VIDEO_WIDTH',\n arg: 'video-width',\n },\n videoHeight: {\n doc: `The fake video resize height.`,\n format: 'nat',\n default: 720,\n env: 'VIDEO_HEIGHT',\n arg: 'video-height',\n },\n videoFramerate: {\n doc: `The fake video framerate.`,\n format: 'nat',\n default: 25,\n env: 'VIDEO_FRAMERATE',\n arg: 'video-framerate',\n },\n videoSeek: {\n doc: `The fake audio/video seek position in seconds.`,\n format: 'nat',\n default: 0,\n env: 'VIDEO_SEEK',\n arg: 'video-seek',\n },\n videoDuration: {\n doc: `The fake audio/video duration in seconds.`,\n format: 'nat',\n default: 120,\n env: 'VIDEO_DURATION',\n arg: 'video-duration',\n },\n videoCacheRaw: {\n doc: `If the temporary video and audio raw files can be reused across \\\nmultiple runs.`,\n format: 'Boolean',\n default: true,\n env: 'VIDEO_CACHE_RAW',\n arg: 'video-cache-raw',\n },\n videoCachePath: {\n doc: `The path where the video and audio raw files are stored.`,\n format: String,\n default: join(os.homedir(), '.webrtcperf/cache'),\n env: 'VIDEO_CACHE_PATH',\n arg: 'video-cache-path',\n },\n videoFormat: {\n doc: `The fake video file format presented to the browser.`,\n format: ['y4m', 'mjpeg'],\n default: 'y4m',\n env: 'VIDEO_FORMAT',\n arg: 'video-format',\n },\n useFakeMedia: {\n doc: `If true, the audio/video/screenshare will be generated using the browser fake device.\nOtherwise, the audio and video streams will be captured from a video element attached to the page, \nwhile the screenshare will be captured from a new browser tab.`,\n format: 'Boolean',\n default: true,\n env: 'USE_FAKE_MEDIA',\n arg: 'use-fake-media',\n },\n //\n runDuration: {\n doc: `If greater than 0, the test will stop after the provided number of \\\nseconds.`,\n format: 'nat',\n default: 0,\n env: 'RUN_DURATION',\n arg: 'run-duration',\n },\n throttleConfig: {\n doc: `A JSON5 string with a valid throtter configuration (https://github.com/vpalmisano/throttler).`,\n format: String,\n nullable: true,\n default: '',\n env: 'THROTTLE_CONFIG',\n arg: 'throttle-config',\n },\n randomAudioPeriod: {\n doc: `If not zero, it specifies the maximum period in seconds after which \\\na new random active tab is selected, enabling the getUserMedia audio tracks in \\\nthat tab and disabling all of the other tabs.`,\n format: 'nat',\n default: 0,\n env: 'RANDOM_AUDIO_PERIOD',\n arg: 'random-audio-period',\n },\n randomAudioProbability: {\n doc: `When using random audio period, it defines the probability % that \\\nthe selected audio will be activated (value: 0-100).`,\n format: 'nat',\n default: 100,\n env: 'RANDOM_AUDIO_PROBABILITY',\n arg: 'random-audio-probability',\n },\n randomAudioRange: {\n doc: `When using random audio period, it defines the number of pages \\\nto be included into the random selection.`,\n format: 'nat',\n default: 0,\n env: 'RANDOM_AUDIO_RANGE',\n arg: 'random-audio-range',\n },\n // Session config\n chromiumPath: {\n doc: `The Chromium executable path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_PATH',\n arg: 'chromium-path',\n },\n chromiumVersion: {\n doc: `The Chromium version. It will be downloaded if the chromium \\\npath is not provided.`,\n format: String,\n nullable: false,\n default: puppeteer.PUPPETEER_REVISIONS.chrome,\n env: 'CHROMIUM_VERSION',\n arg: 'chromium-version',\n },\n chromiumUrl: {\n doc: `The remote Chromium URL (\\`http://HOST:PORT\\`).\nIf provided, the remote instance will be used instead of running a local\nchromium process.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CHROMIUM_URL',\n arg: 'chromium-url',\n },\n chromiumFieldTrials: {\n doc: `Chromium additional field trials.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_FIELD_TRIALS',\n arg: 'chromium-field-trials',\n },\n windowWidth: {\n doc: `The browser window width.`,\n format: 'nat',\n default: 1920,\n env: 'WINDOW_WIDTH',\n arg: 'window-width',\n },\n windowHeight: {\n doc: `The browser window height.`,\n format: 'nat',\n default: 1080,\n env: 'WINDOW_HEIGHT',\n arg: 'window-height',\n },\n deviceScaleFactor: {\n doc: `The browser device scale factor.`,\n format: 'float',\n default: 1,\n env: 'DEVICE_SCALE_FACTOR',\n arg: 'device-scale-factor',\n },\n maxVideoDecoders: {\n doc: `Specifies the maximum number of concurrent WebRTC video decoder \\\ninstances that can be created on the same host.\nIf set it will disable the received video resolution and jitter buffer stats. \\\nThis option is supported only when using the custom chromium build. \\\nThe total decoders count is stored into the virtual file \\`/dev/shm/chromium-video-decoders\\``,\n format: Number,\n default: -1,\n env: 'MAX_VIDEO_DECODERS',\n arg: 'max-video-decoders',\n },\n maxVideoDecodersAt: {\n doc: `Applies the maxVideoDecoders option starting from this session \\`ID\\`.`,\n format: Number,\n default: -1,\n env: 'MAX_VIDEO_DECODERS_AT',\n arg: 'max-video-decoders-at',\n },\n incognito: {\n doc: `Runs the browser in incognito mode.`,\n format: 'Boolean',\n default: false,\n env: 'INCOGNITO',\n arg: 'incognito',\n },\n display: {\n doc: `If unset, the browser will run in headless mode.\nWhen running on MacOS or Windows, set it to any not-empty string.\nOn Linux, set it to a valid X server \\`DISPLAY\\` string (e.g. \\`:0\\`).`,\n format: String,\n default: '',\n nullable: true,\n env: 'DISPLAY',\n arg: 'display',\n },\n /* audioRedForOpus: {\n doc: `Enables RED for OPUS codec (experimental).`,\n format: 'Boolean',\n default: false,\n env: 'AUDIO_RED_FOR_OPUS',\n arg: 'audio-red-for-opus',\n }, */\n sessions: {\n doc: `The number of browser sessions to start.`,\n format: 'nat',\n default: 0,\n env: 'SESSIONS',\n arg: 'sessions',\n },\n tabsPerSession: {\n doc: `The number of tabs to open in each browser session.`,\n format: 'nat',\n default: 1,\n env: 'TABS_PER_SESSION',\n arg: 'tabs-per-session',\n },\n startSessionId: {\n doc: `The starting ID assigned to sessions.`,\n format: 'nat',\n default: 0,\n env: 'START_SESSION_ID',\n arg: 'start-session-id',\n },\n startTimestamp: {\n doc: `The start timestamp (in milliseconds). If 0, the value will be \\\ncalculated using \\`Date.now()\\``,\n format: 'nat',\n default: 0,\n env: 'START_TIMESTAMP',\n arg: 'start-timestamp',\n },\n enableDetailedStats: {\n doc: `If detailed participant metrics values should be collected.`,\n format: 'index',\n default: '',\n nullable: true,\n env: 'ENABLE_DETAILED_STATS',\n arg: 'enable-detailed-stats',\n },\n spawnRate: {\n doc: `The pages spawn rate (pages/s).`,\n format: 'float',\n default: 1,\n env: 'SPAWN_RATE',\n arg: 'spawn-rate',\n },\n showPageLog: {\n doc: `If \\`true\\`, the pages console logs will be shown on console.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_PAGE_LOG',\n arg: 'show-page-log',\n },\n pageLogFilter: {\n doc: `If set, only the logs with the matching text will be printed \\\non console. Regexp string allowed.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_FILTER',\n arg: 'page-log-filter',\n },\n pageLogPath: {\n doc: `If set, page console logs will be saved on the selected file path.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_PATH',\n arg: 'page-log-path',\n },\n userAgent: {\n doc: `The user agent override.`,\n format: String,\n default: '',\n nullable: true,\n env: 'USER_AGENT',\n arg: 'user-agent',\n },\n scriptPath: {\n doc: `One or more JavaScript file paths (comma-separated). \\\nIf set, the files contents will be executed inside each opened tab page; \\\nthe following global variables will be attached to the \\`webrtcperf\\` global object: \\\n\\`WEBRTC_PERF_SESSION\\` the session number (0-indexed); \\\n\\`WEBRTC_PERF_TAB\\` the tab number inside the same session (0-indexed); \\\n\\`WEBRTC_PERF_INDEX\\` the page absolute index (0-indexed). \\\n`,\n format: String,\n default: '',\n env: 'SCRIPT_PATH',\n arg: 'script-path',\n },\n scriptParams: {\n doc: `Additional parameters (in JSON format) that will be exposed into\nthe page context as \\`webrtcperf.params\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SCRIPT_PARAMS',\n arg: 'script-params',\n },\n disabledVideoCodecs: {\n doc: `A string with the video codecs to disable (comma-separated); e.g. \\`vp9,av1\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'DISABLED_VIDEO_CODECS',\n arg: 'disabled-video-codecs',\n },\n localStorage: {\n doc: `A JSON string with the \\`localStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'LOCAL_STORAGE',\n arg: 'local-storage',\n },\n sessionStorage: {\n doc: `A JSON string with the \\`sessionStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SESSION_STORAGE',\n arg: 'session-storage',\n },\n clearCookies: {\n doc: `If true, all the page cookies are cleared.`,\n format: 'Boolean',\n default: false,\n env: 'CLEAR_COOKIES',\n arg: 'clear-cookies',\n },\n enableGpu: {\n doc: `It enables the GPU acceleration (experimental). Set to \"desktop\" to \\\nuse the host X server instance.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ENABLE_GPU',\n arg: 'enable-gpu',\n },\n enableBrowserLogging: {\n doc: `It enables the Chromium browser logging for the specified session indexes.`,\n format: 'index',\n nullable: true,\n default: '',\n env: 'ENABLE_BROWSER_LOGGING',\n arg: 'enable-browser-logging',\n },\n blockedUrls: {\n doc: `A comma-separated list of request URLs that will be automatically \\\nblocked.`,\n format: String,\n nullable: true,\n default: '',\n env: 'BLOCKED_URLS',\n arg: 'blocked-urls',\n },\n extraHeaders: {\n doc: `A dictionary of headers keyed by the url in JSON5 format (e.g. \\\n\\`{ \"https://url.com/*\": { \"header-name\": \"value\" } }\\`).`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_HEADERS',\n arg: 'extra-headers',\n },\n responseModifiers: {\n doc: `A dictionary of content replacements keyed by the url in JSON5 format.\nExamples:\n- replace strings using a regular expression:\n \\`{ \"https://url.com/*\": [{ search: \"searchString\": replace: \"anotherString\" }] }\\`\n- completely replace the content:\n \\`{ \"https://url.com/file.js\": [{ file: \"path/to/newFile.js\" }] }\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'RESPONSE_MODIFIERS',\n arg: 'response-modifiers',\n },\n downloadResponses: {\n doc: `An array of url responses that will be saved to the disk, keyed by the url in JSON5 format.\nExample: \\`[{ urlPattern: \"https://url.com/*\", output: \"save/directory\" }]\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'DOWNLOAD_RESPONSES',\n arg: 'download-responses',\n },\n extraCSS: {\n doc: `A string with a CSS styles to inject into each page. \\\nRules containing \"important\" will be replaced with \"!important\".`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_CSS',\n arg: 'extra-css',\n },\n cookies: {\n doc: `A string with an array of [CookieParam](https://pptr.dev/api/puppeteer.cookieparam) to set into each page in JSON5 format.`,\n format: String,\n nullable: true,\n default: '',\n env: 'COOKIES',\n arg: 'cookies',\n },\n overridePermissions: {\n doc: `A comma-separated list of permissions to grant to the opened url.`,\n format: String,\n nullable: true,\n default: '',\n env: 'OVERRIDE_PERMISSIONS',\n arg: 'override-permissions',\n },\n hardwareConcurrency: {\n doc: `When set, it overrides the navigator.hardwareConcurrency property.`,\n format: 'nat',\n default: 0,\n env: 'HARDWARE_CONCURRENCY',\n arg: 'hardware-concurrency',\n },\n debuggingPort: {\n doc: `The chrome debugging port. If this value != 0, the chrome instance \\\nwill listen on the provided port + the start-session-id value.`,\n format: 'nat',\n default: 0,\n env: 'DEBUGGING_PORT',\n arg: 'debugging-port',\n },\n debuggingAddress: {\n doc: `The chrome debugging listening address. If unset, the network default interface address will be used.`,\n format: String,\n nullable: true,\n default: '127.0.0.1',\n env: 'DEBUGGING_ADDRESS',\n arg: 'debugging-address',\n },\n emulateCpuThrottling: {\n doc: `The emulated CPU throttling factor. If set, the page will be throttled to the specified factor.`,\n format: 'nat',\n default: 0,\n env: 'EMULATE_CPU_THROTTLING',\n arg: 'emulate-cpu-throttling',\n },\n // stats config\n showStats: {\n doc: `If the statistics should be displayed on the console output.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_STATS',\n arg: 'show-stats',\n },\n statsPath: {\n doc: `The log file path; if set, the stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'STATS_PATH',\n arg: 'stats-path',\n },\n detailedStatsPath: {\n doc: `The log file path; if set, the detailed stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'DETAILED_STATS_PATH',\n arg: 'detailed-stats-path',\n },\n statsInterval: {\n doc: `The stats collect interval in seconds. It should be lower than the \\\nPrometheus scraping interval.`,\n format: 'nat',\n default: 15,\n env: 'STATS_INTERVAL',\n arg: 'stats-interval',\n },\n rtcStatsTimeout: {\n doc: `The timeout in seconds after which the RTC stats coming from inactive\\\n hosts are removed. It should be higher than the \\`statsInterval\\` value.`,\n format: 'nat',\n default: 60,\n env: 'RTC_STATS_TIMEOUT',\n arg: 'rtc-stats-timeout',\n },\n customMetrics: {\n doc: `A dictionary of custom metrics keys in JSON5 format (e.g. \\\n'{ statName1: { labels: [\"label1\"] } }').`,\n format: String,\n nullable: true,\n default: '',\n env: 'CUSTOM_METRICS',\n arg: 'custom-metrics',\n },\n //\n prometheusPushgateway: {\n doc: `If set, logs are sent to the specified Prometheus Pushgateway \\\nservice (example: \"http://127.0.0.1:9091\").`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY',\n arg: 'prometheus-pushgateway',\n },\n prometheusPushgatewayJobName: {\n doc: `The Prometheus Pushgateway job name.`,\n format: 'String',\n default: 'default',\n env: 'PROMETHEUS_PUSHGATEWAY_JOB_NAME',\n arg: 'prometheus-pushgateway-job-name',\n },\n prometheusPushgatewayAuth: {\n doc: `The Prometheus Pushgateway basic auth (username:password).`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY_AUTH',\n arg: 'prometheus-pushgateway-auth',\n },\n prometheusPushgatewayGzip: {\n doc: `Allows to use gzip encoded pushgateway requests.`,\n format: 'Boolean',\n default: true,\n env: 'PROMETHEUS_PUSHGATEWAY_GZIP',\n arg: 'prometheus-pushgateway-gzip',\n },\n //\n alertRules: {\n doc: `Alert rules definition (in JSON format).`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES',\n arg: 'alert-rules',\n },\n alertRulesFilename: {\n doc: `The alert rules report output filename.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES_FILENAME',\n arg: 'alert-rules-filename',\n },\n alertRulesFailPercentile: {\n doc: `The alert rules report fails percentile (0-100). With the default value the \\\nalert will be successful only when at least 95% of the checks pass.`,\n format: 'nat',\n nullable: false,\n default: 95,\n env: 'ALERT_RULES_FAIL_PERCENTILE',\n arg: 'alert-rules-fail-percentile',\n },\n pushStatsUrl: {\n doc: `The URL to push the collected stats.`,\n format: String,\n nullable: true,\n default: '',\n env: 'PUSH_STATS_URL',\n arg: 'push-stats-url',\n },\n pushStatsId: {\n doc: `The ID of the collected stats to push.`,\n format: String,\n nullable: true,\n default: 'default',\n env: 'PUSH_STATS_ID',\n arg: 'push-stats-id',\n },\n // server config\n serverPort: {\n doc: `The HTTP server listening port.`,\n format: 'nat',\n nullable: true,\n default: 0,\n env: 'SERVER_PORT',\n arg: 'server-port',\n },\n serverSecret: {\n doc: `The HTTP server basic auth secret. The auth user name is set to \\`admin\\` by default.`,\n format: String,\n default: 'secret',\n env: 'SERVER_SECRET',\n arg: 'server-secret',\n },\n serverUseHttps: {\n doc: `If true, the server will use the HTTPS protocol.`,\n format: 'Boolean',\n default: false,\n env: 'SERVER_USE_HTTPS',\n arg: 'server-use-https',\n },\n serverData: {\n doc: `An optional path that the HTTP server will expose with the /data endpoint.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SERVER_DATA',\n arg: 'server-data',\n },\n // VMAF config\n vmafPath: {\n doc: `When set, it runs the VMAF calculator for the video files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PATH',\n arg: 'vmaf-path',\n },\n vmafPreview: {\n doc: `If true, for each VMAF comparison it creates a side-by-side video with \\\nthe reference and degraded versions.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_PREVIEW',\n arg: 'vmaf-preview',\n },\n vmafKeepIntermediateFiles: {\n doc: `If true, the VMAF intermediate files will not be deleted.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_KEEP_INTERMEDIATE_FILES',\n arg: 'vmaf-keep-intermediate-files',\n },\n vmafKeepSourceFiles: {\n doc: `If true, the VMAF source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VMAF_KEEP_SOURCE_FILES',\n arg: 'vmaf-keep-source-files',\n },\n vmafSkipDuplicated: {\n doc: `If true, the VMAF will skip duplicated recognized frames.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_SKIP_DUPLICATED',\n arg: 'vmaf-skip-duplicated',\n },\n vmafCrop: {\n doc: `If set, the reference and degraded videos will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ \"Participant-000001_recv-by_Participant-000000': { ref: { w: \"iw-10\", h: \"ih-5\" }, deg: { w: \"200\", h: \"200\" } } }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_CROP',\n arg: 'vmaf-crop',\n },\n vmafPrepareVideo: {\n doc: `When set, it prepares the selected video applying a timestamp overlay on top of it. \\\nThe filename must be provided in the format \\`<video path>,<ID>\\`, where the selected ID will be used unique video identifier in the overlay.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PREPARE_VIDEO',\n arg: 'vmaf-prepare-video',\n },\n vmafProcessVideo: {\n doc: `When set, it runs the VMAF video preprocessor, that converts a video file into the IVF format with timestamps matching the overlay recognition. \\\nThe filename must contain a \\`recv\\` or \\`send\\` string to identify if the video was a reference (send) or a degraded version (recv), e.g. \\`Participant1_recv.mp4\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PROCESS_VIDEO',\n arg: 'vmaf-process-video',\n },\n vmafVideoCrop: {\n doc: `If set, the vmaf prepared/processed video will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ w: \"iw-10\", h: \"ih-5\", x: \"10\", y: '5' }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_VIDEO_CROP',\n arg: 'vmaf-video-crop',\n },\n // VISQOL config\n visqolPath: {\n doc: `When set, it runs the visqol calculator for the audio files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VISQOL_PATH',\n arg: 'visqol-path',\n },\n visqolKeepSourceFiles: {\n doc: `If true, the visqol source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VISQOL_KEEP_SOURCE_FILES',\n arg: 'visqol-keep-source-files',\n },\n})\n\ntype ConfigDocs = Record<string, { doc: string; format: string; default: string }>\n\n/**\n * Formats the schema documentation, calling the same function recursively.\n * @param docs the documentation object to extend\n * @param property the root property\n * @param schema the config schema fragment\n * @return the documentation object\n */\nfunction formatDocs(\n docs: ConfigDocs,\n property: string | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: any,\n): ConfigDocs {\n if (schema._cvtProperties) {\n Object.entries(schema._cvtProperties).forEach(([name, value]) => {\n formatDocs(docs, `${property ? `${property}.` : ''}${name}`, value)\n })\n return docs\n }\n\n if (property) {\n docs[property] = {\n doc: schema.doc,\n format: JSON.stringify(schema.format, null, 2),\n default: JSON.stringify(schema.default, null, 2),\n }\n }\n return docs\n}\n\n/**\n * It returns the formatted configuration docs.\n */\nexport function getConfigDocs(): ConfigDocs {\n return formatDocs({}, null, configSchema.getSchema())\n}\n\nconst _schemaProperties = configSchema.getProperties()\n\n/** [[include:config.md]] */\nexport type Config = typeof _schemaProperties\n\n/**\n * Loads the config object.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function loadConfig(filePath?: string, values?: any): Config {\n if (filePath && existsSync(filePath)) {\n log.debug(`Loading config from ${filePath}`)\n configSchema.loadFile(filePath)\n } else if (values) {\n log.debug('Loading config from values.')\n configSchema.load(values)\n } else {\n log.debug('Using default values.')\n configSchema.load({})\n }\n\n configSchema.validate({ allowed: 'strict' })\n const config = configSchema.getProperties()\n\n log.debug('Using config:', config)\n return config\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA40BA,sCAEC;AAWD,gCAiBC;AA12BD,mDAA6C;AAC7C,iFAA8D;AAC9D,2BAA+B;AAC/B,4CAAmB;AACnB,+BAA2B;AAE3B,iEAAiE;AACjE,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE3C,mCAAgC;AAChC,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEvC,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,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C,GAAG,CAAC,KAAK,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAA;QAC5C,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;SAAM,IAAI,MAAM,EAAE,CAAC;QAClB,GAAG,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;QACxC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;QAClC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvB,CAAC;IAED,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC5C,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,EAAE,CAAA;IAE3C,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IAClC,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import convict, { addFormats } from 'convict'\nimport { ipaddress, url } from 'convict-format-with-validator'\nimport { existsSync } from 'fs'\nimport os from 'os'\nimport { join } from 'path'\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports\nconst puppeteer = require('puppeteer-core')\n\nimport { logger } from './utils'\nconst log = logger('webrtcperf:config')\n\nconst float = {\n name: 'float',\n coerce: (v: string) => parseFloat(v),\n validate: (v: number) => {\n if (!Number.isFinite(v)) throw new Error(`Invalid float: ${v}`)\n },\n}\n\nconst index = {\n name: 'index',\n coerce: (v: unknown) => v,\n validate: (v: boolean | string | number) => {\n if (typeof v === 'string') {\n if (v === 'true' || v === 'false' || v === '') return\n if (v.includes('-')) {\n v.split('-').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (v.includes(',')) {\n v.split(',').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (isNaN(parseInt(v)) || !isFinite(parseInt(v))) throw new Error(`Invalid string index: ${v}`)\n return\n } else if (typeof v === 'number' || typeof v === 'boolean') {\n return\n }\n throw new Error(`Invalid index: \"${v}\" (type: ${typeof v})`)\n },\n}\n\naddFormats({ ipaddress, url, float, index })\n\n// config schema\nconst configSchema = convict({\n url: {\n doc: `The page url to load.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL',\n arg: 'url',\n },\n urlQuery: {\n doc: `The query string to append to the page url; the following template \\\nvariables are replaced: \\`$p\\` the process pid, \\`$s\\` the session index, \\\n\\`$S\\` the total sessions, \\`$t\\` the tab index, \\`$T\\` the total tabs per \\\nsession, \\`$i\\` the tab absolute index.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL_QUERY',\n arg: 'url-query',\n },\n customUrlHandler: {\n doc: `This argument specifies the file path for the custom page URL handler that will be exported by default. \\\nThe custom page URL handler allows you to define custom URLs that can be used to open your application. \\\nThe handler function will be called with the following variables: \\\n- sessions: the total number of sessions; \\\n- tabsPerSession: the total number of tabs per session; \\\n- id: the session global index (0-indexed); \\\n- index: the tab global index (0-indexed); \\\n- tabIndex: the tab index in the current session (0-indexed); \\\n- pid: the process pid; \\\n- env: the environment variables object; \\\n- params: the script parameters object. \\\nYou can use these variables to create custom URL schemes that suit your application's needs.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CUSTOM_URL_HANDLER',\n arg: 'custom-url-handler',\n },\n // fake video/audio\n videoPath: {\n doc: `The fake video path; if set, the video will be used as fake \\\nmedia source. It accepts a single path or a comma-separated list of videos \\\npaths that will be used in round-robin by the started sessions. \\\nThe docker pre-built image contains a 2 minutes video sequence stored at \\\n\\`/app/video.mp4\\`. \\\nIt accepts a local file, an http endpoint or a string starting with\n\\`generate:\\` (example: \\`generate:null\\` will generate a black video with \\\nsilent audio). \\\nThe temporary files containing the raw video and audio will be stored at \\\n\\`\\${VIDEO_CACHE_PATH}/video.\\${VIDEO_FORMAT}\\` and \\\n\\`\\${VIDEO_CACHE_PATH}/audio.wav\\`.`,\n format: String,\n default: 'https://github.com/vpalmisano/webrtcperf/releases/download/v2.0.4/video.mp4',\n env: 'VIDEO_PATH',\n arg: 'video-path',\n },\n videoWidth: {\n doc: `The fake video resize width.`,\n format: 'nat',\n default: 1280,\n env: 'VIDEO_WIDTH',\n arg: 'video-width',\n },\n videoHeight: {\n doc: `The fake video resize height.`,\n format: 'nat',\n default: 720,\n env: 'VIDEO_HEIGHT',\n arg: 'video-height',\n },\n videoFramerate: {\n doc: `The fake video framerate.`,\n format: 'nat',\n default: 25,\n env: 'VIDEO_FRAMERATE',\n arg: 'video-framerate',\n },\n videoSeek: {\n doc: `The fake audio/video seek position in seconds.`,\n format: 'nat',\n default: 0,\n env: 'VIDEO_SEEK',\n arg: 'video-seek',\n },\n videoDuration: {\n doc: `The fake audio/video duration in seconds.`,\n format: 'nat',\n default: 120,\n env: 'VIDEO_DURATION',\n arg: 'video-duration',\n },\n videoCacheRaw: {\n doc: `If the temporary video and audio raw files can be reused across \\\nmultiple runs.`,\n format: 'Boolean',\n default: true,\n env: 'VIDEO_CACHE_RAW',\n arg: 'video-cache-raw',\n },\n videoCachePath: {\n doc: `The path where the video and audio raw files are stored.`,\n format: String,\n default: join(os.homedir(), '.webrtcperf/cache'),\n env: 'VIDEO_CACHE_PATH',\n arg: 'video-cache-path',\n },\n videoFormat: {\n doc: `The fake video file format presented to the browser.`,\n format: ['y4m', 'mjpeg'],\n default: 'y4m',\n env: 'VIDEO_FORMAT',\n arg: 'video-format',\n },\n useFakeMedia: {\n doc: `If true, the audio/video/screenshare will be generated using the browser fake device.\nOtherwise, the audio and video streams will be captured from a video element attached to the page, \nwhile the screenshare will be captured from a new browser tab.`,\n format: 'Boolean',\n default: true,\n env: 'USE_FAKE_MEDIA',\n arg: 'use-fake-media',\n },\n //\n runDuration: {\n doc: `If greater than 0, the test will stop after the provided number of \\\nseconds.`,\n format: 'nat',\n default: 0,\n env: 'RUN_DURATION',\n arg: 'run-duration',\n },\n throttleConfig: {\n doc: `A JSON5 string with a valid throtter configuration (https://github.com/vpalmisano/throttler).`,\n format: String,\n nullable: true,\n default: '',\n env: 'THROTTLE_CONFIG',\n arg: 'throttle-config',\n },\n randomAudioPeriod: {\n doc: `If not zero, it specifies the maximum period in seconds after which \\\na new random active session is selected, enabling the getUserMedia audio tracks in \\\nthat session and disabling all of the others.`,\n format: 'nat',\n default: 0,\n env: 'RANDOM_AUDIO_PERIOD',\n arg: 'random-audio-period',\n },\n randomAudioProbability: {\n doc: `When using random audio period, it defines the probability % that \\\nthe selected audio will be activated (value: 0-100).`,\n format: 'nat',\n default: 100,\n env: 'RANDOM_AUDIO_PROBABILITY',\n arg: 'random-audio-probability',\n },\n randomAudioRange: {\n doc: `When using random audio period, it defines the session indexes \\\nto be included into the random selection (default: include all the sessions).`,\n format: 'index',\n default: 'true',\n nullable: true,\n env: 'RANDOM_AUDIO_RANGE',\n arg: 'random-audio-range',\n },\n // Session config\n chromiumPath: {\n doc: `The Chromium executable path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_PATH',\n arg: 'chromium-path',\n },\n chromiumVersion: {\n doc: `The Chromium version. It will be downloaded if the chromium \\\npath is not provided.`,\n format: String,\n nullable: false,\n default: puppeteer.PUPPETEER_REVISIONS.chrome,\n env: 'CHROMIUM_VERSION',\n arg: 'chromium-version',\n },\n chromiumUrl: {\n doc: `The remote Chromium URL (\\`http://HOST:PORT\\`).\nIf provided, the remote instance will be used instead of running a local\nchromium process.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CHROMIUM_URL',\n arg: 'chromium-url',\n },\n chromiumFieldTrials: {\n doc: `Chromium additional field trials.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_FIELD_TRIALS',\n arg: 'chromium-field-trials',\n },\n windowWidth: {\n doc: `The browser window width.`,\n format: 'nat',\n default: 1920,\n env: 'WINDOW_WIDTH',\n arg: 'window-width',\n },\n windowHeight: {\n doc: `The browser window height.`,\n format: 'nat',\n default: 1080,\n env: 'WINDOW_HEIGHT',\n arg: 'window-height',\n },\n deviceScaleFactor: {\n doc: `The browser device scale factor.`,\n format: 'float',\n default: 1,\n env: 'DEVICE_SCALE_FACTOR',\n arg: 'device-scale-factor',\n },\n maxVideoDecoders: {\n doc: `Specifies the maximum number of concurrent WebRTC video decoder \\\ninstances that can be created on the same host.\nIf set it will disable the received video resolution and jitter buffer stats. \\\nThis option is supported only when using the custom chromium build. \\\nThe total decoders count is stored into the virtual file \\`/dev/shm/chromium-video-decoders\\``,\n format: Number,\n default: -1,\n env: 'MAX_VIDEO_DECODERS',\n arg: 'max-video-decoders',\n },\n maxVideoDecodersRange: {\n doc: `It applies the max video decoders option to the sessions included into this list (default: include all the sessions)`,\n format: 'index',\n default: 'true',\n nullable: true,\n env: 'MAX_VIDEO_DECODERS_RANGE',\n arg: 'max-video-decoders-range',\n },\n incognito: {\n doc: `Runs the browser in incognito mode.`,\n format: 'Boolean',\n default: false,\n env: 'INCOGNITO',\n arg: 'incognito',\n },\n display: {\n doc: `If unset, the browser will run in headless mode.\nWhen running on MacOS or Windows, set it to any not-empty string.\nOn Linux, set it to a valid X server \\`DISPLAY\\` string (e.g. \\`:0\\`).`,\n format: String,\n default: '',\n nullable: true,\n env: 'DISPLAY',\n arg: 'display',\n },\n /* audioRedForOpus: {\n doc: `Enables RED for OPUS codec (experimental).`,\n format: 'Boolean',\n default: false,\n env: 'AUDIO_RED_FOR_OPUS',\n arg: 'audio-red-for-opus',\n }, */\n sessions: {\n doc: `The number of browser sessions to start.`,\n format: 'nat',\n default: 0,\n env: 'SESSIONS',\n arg: 'sessions',\n },\n tabsPerSession: {\n doc: `The number of tabs to open in each browser session.`,\n format: 'nat',\n default: 1,\n env: 'TABS_PER_SESSION',\n arg: 'tabs-per-session',\n },\n startSessionId: {\n doc: `The starting ID assigned to sessions.`,\n format: 'nat',\n default: 0,\n env: 'START_SESSION_ID',\n arg: 'start-session-id',\n },\n startTimestamp: {\n doc: `The start timestamp (in milliseconds). If 0, the value will be \\\ncalculated using \\`Date.now()\\``,\n format: 'nat',\n default: 0,\n env: 'START_TIMESTAMP',\n arg: 'start-timestamp',\n },\n enableDetailedStats: {\n doc: `If detailed participant metrics values should be collected.`,\n format: 'index',\n default: '0-24',\n nullable: true,\n env: 'ENABLE_DETAILED_STATS',\n arg: 'enable-detailed-stats',\n },\n spawnRate: {\n doc: `The pages spawn rate (pages/s).`,\n format: 'float',\n default: 1,\n env: 'SPAWN_RATE',\n arg: 'spawn-rate',\n },\n showPageLog: {\n doc: `If \\`true\\`, the pages console logs will be shown on console.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_PAGE_LOG',\n arg: 'show-page-log',\n },\n pageLogFilter: {\n doc: `If set, only the logs with the matching text will be printed \\\non the console. Regexp string allowed.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_FILTER',\n arg: 'page-log-filter',\n },\n pageLogPath: {\n doc: `If set, the page console logs will be saved on the selected file path.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_PATH',\n arg: 'page-log-path',\n },\n enableBrowserLogging: {\n doc: `It enables the Chromium browser logging for the specified session indexes. It requires the page log path option to be set. `,\n format: 'index',\n nullable: true,\n default: '',\n env: 'ENABLE_BROWSER_LOGGING',\n arg: 'enable-browser-logging',\n },\n userAgent: {\n doc: `The user agent override.`,\n format: String,\n default: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',\n nullable: true,\n env: 'USER_AGENT',\n arg: 'user-agent',\n },\n scriptPath: {\n doc: `One or more JavaScript file paths (comma-separated). \\\nIf set, the files contents will be executed inside each opened tab page; \\\nthe following global variables will be attached to the \\`webrtcperf\\` global object: \\\n\\`WEBRTC_PERF_SESSION\\` the session number (0-indexed); \\\n\\`WEBRTC_PERF_TAB\\` the tab number inside the same session (0-indexed); \\\n\\`WEBRTC_PERF_INDEX\\` the page absolute index (0-indexed). \\\n`,\n format: String,\n default: '',\n env: 'SCRIPT_PATH',\n arg: 'script-path',\n },\n scriptParams: {\n doc: `Additional parameters (in JSON format) that will be exposed into\nthe page context as \\`webrtcperf.params\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SCRIPT_PARAMS',\n arg: 'script-params',\n },\n disabledVideoCodecs: {\n doc: `A string with the video codecs to disable (comma-separated); e.g. \\`vp9,av1\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'DISABLED_VIDEO_CODECS',\n arg: 'disabled-video-codecs',\n },\n localStorage: {\n doc: `A JSON string with the \\`localStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'LOCAL_STORAGE',\n arg: 'local-storage',\n },\n sessionStorage: {\n doc: `A JSON string with the \\`sessionStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SESSION_STORAGE',\n arg: 'session-storage',\n },\n clearCookies: {\n doc: `If true, all the page cookies are cleared.`,\n format: 'Boolean',\n default: false,\n env: 'CLEAR_COOKIES',\n arg: 'clear-cookies',\n },\n enableGpu: {\n doc: `It enables the GPU acceleration (experimental). Set to \"desktop\" to \\\nuse the host X server instance.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ENABLE_GPU',\n arg: 'enable-gpu',\n },\n blockedUrls: {\n doc: `A comma-separated list of request URLs that will be automatically \\\nblocked.`,\n format: String,\n nullable: true,\n default: '',\n env: 'BLOCKED_URLS',\n arg: 'blocked-urls',\n },\n extraHeaders: {\n doc: `A dictionary of headers keyed by the url in JSON5 format (e.g. \\\n\\`{ \"https://url.com/*\": { \"header-name\": \"value\" } }\\`).`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_HEADERS',\n arg: 'extra-headers',\n },\n responseModifiers: {\n doc: `A dictionary of content replacements keyed by the url in JSON5 format.\nExamples:\n- replace strings using a regular expression:\n \\`{ \"https://url.com/*\": [{ search: \"searchString\": replace: \"anotherString\" }] }\\`\n- completely replace the content:\n \\`{ \"https://url.com/file.js\": [{ file: \"path/to/newFile.js\" }] }\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'RESPONSE_MODIFIERS',\n arg: 'response-modifiers',\n },\n downloadResponses: {\n doc: `An array of url responses that will be saved to the disk, keyed by the url in JSON5 format.\nExample: \\`[{ urlPattern: \"https://url.com/*\", output: \"save/directory\" }]\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'DOWNLOAD_RESPONSES',\n arg: 'download-responses',\n },\n extraCSS: {\n doc: `A string with a CSS styles to inject into each page. \\\nRules containing \"important\" will be replaced with \"!important\".`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_CSS',\n arg: 'extra-css',\n },\n cookies: {\n doc: `A string with an array of [CookieParam](https://pptr.dev/api/puppeteer.cookieparam) to set into each page in JSON5 format.`,\n format: String,\n nullable: true,\n default: '',\n env: 'COOKIES',\n arg: 'cookies',\n },\n overridePermissions: {\n doc: `A comma-separated list of permissions to grant to the opened url.`,\n format: String,\n nullable: true,\n default: '',\n env: 'OVERRIDE_PERMISSIONS',\n arg: 'override-permissions',\n },\n hardwareConcurrency: {\n doc: `When set, it overrides the navigator.hardwareConcurrency property.`,\n format: 'nat',\n default: 0,\n env: 'HARDWARE_CONCURRENCY',\n arg: 'hardware-concurrency',\n },\n debuggingPort: {\n doc: `The chrome debugging port. If this value != 0, the chrome instance \\\nwill listen on the provided port + the start-session-id value.`,\n format: 'nat',\n default: 0,\n env: 'DEBUGGING_PORT',\n arg: 'debugging-port',\n },\n debuggingAddress: {\n doc: `The chrome debugging listening address. If unset, the network default interface address will be used.`,\n format: String,\n nullable: true,\n default: '127.0.0.1',\n env: 'DEBUGGING_ADDRESS',\n arg: 'debugging-address',\n },\n emulateCpuThrottling: {\n doc: `The emulated CPU throttling factor. If set, the page will be throttled to the specified factor.`,\n format: 'nat',\n default: 0,\n env: 'EMULATE_CPU_THROTTLING',\n arg: 'emulate-cpu-throttling',\n },\n // stats config\n showStats: {\n doc: `If the statistics should be displayed on the console output.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_STATS',\n arg: 'show-stats',\n },\n statsPath: {\n doc: `The log file path; if set, the stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'STATS_PATH',\n arg: 'stats-path',\n },\n detailedStatsPath: {\n doc: `The log file path; if set, the detailed stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'DETAILED_STATS_PATH',\n arg: 'detailed-stats-path',\n },\n statsInterval: {\n doc: `The stats collect interval in seconds. It should be lower than the \\\nPrometheus scraping interval.`,\n format: 'nat',\n default: 15,\n env: 'STATS_INTERVAL',\n arg: 'stats-interval',\n },\n rtcStatsTimeout: {\n doc: `The timeout in seconds after which the RTC stats coming from inactive\\\n hosts are removed. It should be higher than the \\`statsInterval\\` value.`,\n format: 'nat',\n default: 60,\n env: 'RTC_STATS_TIMEOUT',\n arg: 'rtc-stats-timeout',\n },\n customMetrics: {\n doc: `A dictionary of custom metrics keys in JSON5 format (e.g. \\\n'{ statName1: { labels: [\"label1\"] } }').`,\n format: String,\n nullable: true,\n default: '',\n env: 'CUSTOM_METRICS',\n arg: 'custom-metrics',\n },\n //\n prometheusPushgateway: {\n doc: `If set, logs are sent to the specified Prometheus Pushgateway \\\nservice (example: \"http://127.0.0.1:9091\").`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY',\n arg: 'prometheus-pushgateway',\n },\n prometheusPushgatewayJobName: {\n doc: `The Prometheus Pushgateway job name.`,\n format: 'String',\n default: 'default',\n env: 'PROMETHEUS_PUSHGATEWAY_JOB_NAME',\n arg: 'prometheus-pushgateway-job-name',\n },\n prometheusPushgatewayAuth: {\n doc: `The Prometheus Pushgateway basic auth (username:password).`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY_AUTH',\n arg: 'prometheus-pushgateway-auth',\n },\n prometheusPushgatewayGzip: {\n doc: `Allows to use gzip encoded pushgateway requests.`,\n format: 'Boolean',\n default: true,\n env: 'PROMETHEUS_PUSHGATEWAY_GZIP',\n arg: 'prometheus-pushgateway-gzip',\n },\n //\n alertRules: {\n doc: `Alert rules definition (in JSON format).`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES',\n arg: 'alert-rules',\n },\n alertRulesFilename: {\n doc: `The alert rules report output filename.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES_FILENAME',\n arg: 'alert-rules-filename',\n },\n alertRulesFailPercentile: {\n doc: `The alert rules report fails percentile (0-100). With the default value the \\\nalert will be successful only when at least 95% of the checks pass.`,\n format: 'nat',\n nullable: false,\n default: 95,\n env: 'ALERT_RULES_FAIL_PERCENTILE',\n arg: 'alert-rules-fail-percentile',\n },\n pushStatsUrl: {\n doc: `The URL to push the collected stats.`,\n format: String,\n nullable: true,\n default: '',\n env: 'PUSH_STATS_URL',\n arg: 'push-stats-url',\n },\n pushStatsId: {\n doc: `The ID of the collected stats to push.`,\n format: String,\n nullable: true,\n default: 'default',\n env: 'PUSH_STATS_ID',\n arg: 'push-stats-id',\n },\n // server config\n serverPort: {\n doc: `The HTTP server listening port.`,\n format: 'nat',\n nullable: true,\n default: 0,\n env: 'SERVER_PORT',\n arg: 'server-port',\n },\n serverSecret: {\n doc: `The HTTP server basic auth secret. The auth user name is set to \\`admin\\` by default.`,\n format: String,\n default: 'secret',\n env: 'SERVER_SECRET',\n arg: 'server-secret',\n },\n serverUseHttps: {\n doc: `If true, the server will use the HTTPS protocol.`,\n format: 'Boolean',\n default: false,\n env: 'SERVER_USE_HTTPS',\n arg: 'server-use-https',\n },\n serverData: {\n doc: `An optional path that the HTTP server will expose with the /data endpoint.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SERVER_DATA',\n arg: 'server-data',\n },\n // VMAF config\n vmafPath: {\n doc: `When set, it runs the VMAF calculator for the video files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PATH',\n arg: 'vmaf-path',\n },\n vmafPreview: {\n doc: `If true, for each VMAF comparison it creates a side-by-side video with \\\nthe reference and degraded versions.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_PREVIEW',\n arg: 'vmaf-preview',\n },\n vmafKeepIntermediateFiles: {\n doc: `If true, the VMAF intermediate files will not be deleted.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_KEEP_INTERMEDIATE_FILES',\n arg: 'vmaf-keep-intermediate-files',\n },\n vmafKeepSourceFiles: {\n doc: `If true, the VMAF source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VMAF_KEEP_SOURCE_FILES',\n arg: 'vmaf-keep-source-files',\n },\n vmafSkipDuplicated: {\n doc: `If true, the VMAF will skip duplicated recognized frames.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_SKIP_DUPLICATED',\n arg: 'vmaf-skip-duplicated',\n },\n vmafCrop: {\n doc: `If set, the reference and degraded videos will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ \"Participant-000001_recv-by_Participant-000000': { ref: { w: \"iw-10\", h: \"ih-5\" }, deg: { w: \"200\", h: \"200\" } } }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_CROP',\n arg: 'vmaf-crop',\n },\n vmafPrepareVideo: {\n doc: `When set, it prepares the selected video applying a timestamp overlay on top of it. \\\nThe filename must be provided in the format \\`<video path>,<ID>\\`, where the selected ID will be used unique video identifier in the overlay.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PREPARE_VIDEO',\n arg: 'vmaf-prepare-video',\n },\n vmafProcessVideo: {\n doc: `When set, it runs the VMAF video preprocessor, that converts a video file into the IVF format with timestamps matching the overlay recognition. \\\nThe filename must contain a \\`recv\\` or \\`send\\` string to identify if the video was a reference (send) or a degraded version (recv), e.g. \\`Participant1_recv.mp4\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PROCESS_VIDEO',\n arg: 'vmaf-process-video',\n },\n vmafVideoCrop: {\n doc: `If set, the vmaf prepared/processed video will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ w: \"iw-10\", h: \"ih-5\", x: \"10\", y: '5' }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_VIDEO_CROP',\n arg: 'vmaf-video-crop',\n },\n // VISQOL config\n visqolPath: {\n doc: `When set, it runs the visqol calculator for the audio files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VISQOL_PATH',\n arg: 'visqol-path',\n },\n visqolKeepSourceFiles: {\n doc: `If true, the visqol source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VISQOL_KEEP_SOURCE_FILES',\n arg: 'visqol-keep-source-files',\n },\n})\n\ntype ConfigDocs = Record<string, { doc: string; format: string; default: string }>\n\n/**\n * Formats the schema documentation, calling the same function recursively.\n * @param docs the documentation object to extend\n * @param property the root property\n * @param schema the config schema fragment\n * @return the documentation object\n */\nfunction formatDocs(\n docs: ConfigDocs,\n property: string | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: any,\n): ConfigDocs {\n if (schema._cvtProperties) {\n Object.entries(schema._cvtProperties).forEach(([name, value]) => {\n formatDocs(docs, `${property ? `${property}.` : ''}${name}`, value)\n })\n return docs\n }\n\n if (property) {\n docs[property] = {\n doc: schema.doc,\n format: JSON.stringify(schema.format, null, 2),\n default: JSON.stringify(schema.default, null, 2),\n }\n }\n return docs\n}\n\n/**\n * It returns the formatted configuration docs.\n */\nexport function getConfigDocs(): ConfigDocs {\n return formatDocs({}, null, configSchema.getSchema())\n}\n\nconst _schemaProperties = configSchema.getProperties()\n\n/** [[include:config.md]] */\nexport type Config = typeof _schemaProperties\n\n/**\n * Loads the config object.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function loadConfig(filePath?: string, values?: any): Config {\n if (filePath && existsSync(filePath)) {\n log.debug(`Loading config from ${filePath}`)\n configSchema.loadFile(filePath)\n } else if (values) {\n log.debug('Loading config from values.')\n configSchema.load(values)\n } else {\n log.debug('Using default values.')\n configSchema.load({})\n }\n\n configSchema.validate({ allowed: 'strict' })\n const config = configSchema.getProperties()\n\n log.debug('Using config:', config)\n return config\n}\n"]}
|
package/build/src/server.js
CHANGED
|
@@ -137,14 +137,14 @@ class Server {
|
|
|
137
137
|
log.error(`mkdir ${this.serverData} error: ${err.message}`);
|
|
138
138
|
});
|
|
139
139
|
this.app.get('/data', this.getDataArchive.bind(this));
|
|
140
|
-
this.app.get('/data
|
|
140
|
+
this.app.get('/data/:path', this.getData.bind(this));
|
|
141
141
|
}
|
|
142
142
|
if (this.videoCachePath) {
|
|
143
143
|
log.debug(`using videoCachePath: ${this.videoCachePath}`);
|
|
144
144
|
fs_1.default.promises.mkdir(this.videoCachePath, { recursive: true }).catch(err => {
|
|
145
145
|
log.error(`mkdir ${this.videoCachePath} error: ${err.message}`);
|
|
146
146
|
});
|
|
147
|
-
this.app.get('/cache
|
|
147
|
+
this.app.get('/cache/:path', this.getCache.bind(this));
|
|
148
148
|
}
|
|
149
149
|
this.app.use((err, req, res, next) => {
|
|
150
150
|
log.error(`request path=${req.path} error:`, err.stack);
|
|
@@ -439,7 +439,7 @@ class Server {
|
|
|
439
439
|
* content in tar.gz format.
|
|
440
440
|
*/
|
|
441
441
|
getData(req, res, next) {
|
|
442
|
-
const paramPath = path_1.default.normalize(req.params
|
|
442
|
+
const paramPath = path_1.default.normalize(req.params.path).replace(/^(\.\.(\/|\\|$))+/, '');
|
|
443
443
|
log.debug(`GET /data/${paramPath}`, req.query);
|
|
444
444
|
const fpath = path_1.default.resolve(this.serverData, paramPath);
|
|
445
445
|
if (!fs_1.default.existsSync(fpath)) {
|
|
@@ -461,7 +461,7 @@ class Server {
|
|
|
461
461
|
tar_fs_1.default.pack(fpath).pipe(zlib_1.default.createGzip()).pipe(res);
|
|
462
462
|
}
|
|
463
463
|
getCache(req, res, next) {
|
|
464
|
-
const paramPath = path_1.default.normalize(req.params
|
|
464
|
+
const paramPath = path_1.default.normalize(req.params.path).replace(/^(\.\.(\/|\\|$))+/, '');
|
|
465
465
|
log.debug(`GET /cache/${paramPath}`, req.query);
|
|
466
466
|
const fpath = path_1.default.resolve(this.videoCachePath, paramPath);
|
|
467
467
|
if (!fs_1.default.existsSync(fpath)) {
|
package/build/src/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAqC;AACrC,mCAAwC;AACxC,mDAAuC;AACvC,4CAAmB;AACnB,+BAAyD;AACzD,iCAA4E;AAC5E,4CAAmB;AACnB,gDAAuB;AACvB,oDAAwB;AACxB,2BAAoC;AACpC,gDAAuB;AACvB,4DAA6B;AAE7B,qCAAqC;AACrC,uCAAkD;AAElD,mCAAoE;AAEpE,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEvC;;;;GAIG;AACH,MAAa,MAAM;IACjB,iCAAiC;IACxB,UAAU,CAAQ;IAC3B,6BAA6B;IACpB,YAAY,CAAQ;IAC7B,wCAAwC;IAC/B,cAAc,CAAS;IAChC,iFAAiF;IACjF,UAAU,CAAQ;IAClB,gFAAgF;IAChF,WAAW,CAAQ;IACnB,mEAAmE;IACnE,cAAc,CAAQ;IACtB,sCAAsC;IACtC,KAAK,CAAO;IAEJ,GAAG,CAAiB;IACpB,MAAM,GAAoC,IAAI,CAAA;IAC9C,GAAG,GAA2B,IAAI,CAAA;IAE1C;;;;;;;;;;;OAWG;IACH,YACE,EACE,UAAU,GAAG,IAAI,EACjB,YAAY,GAAG,QAAQ,EACvB,cAAc,GAAG,KAAK,EACtB,UAAU,GAAG,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ression from 'compression'\nimport { timingSafeEqual } from 'crypto'\nimport express, { json } from 'express'\nimport fs from 'fs'\nimport { Server as HttpServer, createServer } from 'http'\nimport { Server as HttpsServer, createServer as _createServer } from 'https'\nimport os from 'os'\nimport path from 'path'\nimport tar from 'tar-fs'\nimport { WebSocketServer } from 'ws'\nimport zlib from 'zlib'\nimport auth from 'basic-auth'\n\nimport { loadConfig } from './config'\nimport { Session, SessionParams } from './session'\nimport { Stats } from './stats'\nimport { logger, runShellCommand, getDockerLogsPath } from './utils'\n\nconst log = logger('webrtcperf:server')\n\n/**\n * An HTTP server instance that allows to control the tool using a REST\n * interface. Moreover, it allows to aggregate stats data coming from multiple\n * running tool instances.\n */\nexport class Server {\n /** The server listening port. */\n readonly serverPort: number\n /** The basic auth secret. */\n readonly serverSecret: string\n /** If HTTPS protocol should be used. */\n readonly serverUseHttps: boolean\n /** An optional path that the HTTP server will expose with the /data endpoint. */\n serverData: string\n /** The file path that will be used to serve the \\`/view/page.log\\` requests. */\n pageLogPath: string\n /** The path that will be used to serve the \\`/cache\\` requests. */\n videoCachePath: string\n /** A {@link Stats} class instance. */\n stats: Stats\n\n private app: express.Express\n private server: HttpServer | HttpsServer | null = null\n private wss: WebSocketServer | null = null\n\n /**\n * Server instance.\n * All the HTTP endpoints are protected by basic authentication with user\n * `admin` and password {@link Server.serverSecret}.\n * @param serverPort The server listening port.\n * @param serverSecret The basic auth secret.\n * @param serverUseHttps If HTTPS protocol should be used.\n * @param serverData An optional path that the HTTP server will expose with the /data endpoint.\n * @param pageLogPath The file path that will be used to serve the \\`/view/page.log\\` requests.\n * @param videoCachePath The path that will be used to serve the \\`/cache\\` requests.\n * @param stats A {@link Stats} class instance.\n */\n constructor(\n {\n serverPort = 5000,\n serverSecret = 'secret',\n serverUseHttps = false,\n serverData = '',\n pageLogPath = '',\n videoCachePath = '',\n } = {},\n stats: Stats,\n ) {\n this.serverPort = serverPort\n this.serverSecret = serverSecret\n this.serverUseHttps = serverUseHttps\n this.serverData = serverData\n this.pageLogPath = pageLogPath\n this.videoCachePath = videoCachePath\n this.stats = stats\n //\n this.app = express()\n this.app.use(compression())\n this.app.use(\n json({\n limit: '10mb',\n }),\n )\n\n this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {\n if (req.query.auth === this.serverSecret) {\n return next()\n }\n const credentials = auth(req)\n if (!credentials || credentials.name !== 'admin' || credentials.pass !== this.serverSecret) {\n res.setHeader('WWW-Authenticate', 'Basic realm=\"Restricted Area\"')\n res.status(401).send('Unauthorized')\n return\n }\n next()\n })\n\n this.app.get('/', (_req, res) => {\n res.send('')\n })\n\n this.app.get('/stats', this.getStats.bind(this))\n this.app.get('/collected-stats', this.getCollectedStats.bind(this))\n this.app.get('/screenshot/:sessionId', this.getScreenshot.bind(this))\n this.app.put('/collected-stats', this.putCollectedStats.bind(this))\n this.app.put('/session', this.putSession.bind(this))\n this.app.put('/sessions', this.putSessions.bind(this))\n this.app.delete('/session', this.deleteSession.bind(this))\n this.app.delete('/sessions', this.deleteSessions.bind(this))\n this.app.get('/view/page.log', this.getPageLog.bind(this))\n this.app.get('/view/docker.log', this.getDockerLog.bind(this))\n this.app.get('/download/alert-rules', this.getAlertRules.bind(this))\n this.app.get('/download/stats', this.getStatsFile.bind(this))\n this.app.get('/download/detailed-stats', this.getDetailedStatsFile.bind(this))\n this.app.get('/empty-page', this.getEmptyPage.bind(this))\n if (this.serverData) {\n log.debug(`using serverData: ${this.serverData}`)\n fs.promises.mkdir(this.serverData, { recursive: true }).catch(err => {\n log.error(`mkdir ${this.serverData} error: ${err.message}`)\n })\n this.app.get('/data', this.getDataArchive.bind(this))\n this.app.get('/data/*', this.getData.bind(this))\n }\n if (this.videoCachePath) {\n log.debug(`using videoCachePath: ${this.videoCachePath}`)\n fs.promises.mkdir(this.videoCachePath, { recursive: true }).catch(err => {\n log.error(`mkdir ${this.videoCachePath} error: ${err.message}`)\n })\n this.app.get('/cache/*', this.getCache.bind(this))\n }\n\n this.app.use((err: Error, req: express.Request, res: express.Response, next: express.NextFunction) => {\n log.error(`request path=${req.path} error:`, err.stack)\n if (res.headersSent) {\n return next(err)\n }\n res.status(500).send(err.message)\n })\n }\n\n /*\n * onConnection\n * @param {Socket} socket\n */\n /* onConnection(socket) {\n log.debug('onConnection', socket);\n\n socket.on('disconnect', () => {\n log.debug('io socket disconnected');\n });\n\n socket.on('message', (msg) => {\n log.debug('message', msg);\n });\n } */\n\n /**\n * GET /stats endpoint.\n *\n * Returns a JSON array of the last statistics for each running Session.\n */\n private async getStats(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`GET /stats`)\n const stats = []\n try {\n for (const session of this.stats.sessions.values()) {\n stats.push(session.stats)\n }\n res.json(stats)\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * GET /download/stats endpoint.\n *\n * Returns the {@link Stats.statsWriter} file content.\n */\n private getStatsFile(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`/download/stats`, req.query)\n if (!this.stats.statsWriter) {\n return next(new Error('statsPath not set'))\n }\n res.download(this.stats.statsPath)\n }\n\n /**\n * GET /download/detailed-stats endpoint.\n *\n * Returns the {@link Stats.detailedStatsWriter} file content.\n */\n private getDetailedStatsFile(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`/download/detailed-stats`, req.query)\n if (!this.stats.detailedStatsWriter) {\n return next(new Error('detailedStatsPath not set'))\n }\n res.download(this.stats.detailedStatsPath)\n }\n\n /**\n * GET /collected-stats endpoint.\n *\n * Returns a JSON array of the last statistics collected from external running\n * tools.\n */\n private getCollectedStats(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`GET /collected-stats`)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const stats: Record<string, any> = {}\n try {\n for (const [key, stat] of Object.entries(this.stats.collectedStats)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stats[key] = (stat as any).data\n }\n res.json(stats)\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * GET /screenshot/<sessionID> endpoint.\n *\n * Returns the page screenshot running inside the {@link Session} identified\n * by `sessionID`.\n * Additional query params:\n * - `page`: the page number (starting from `0`) running inside the {@link Session}.\n * - `format`: the image format (`jpeg`, `png`, `webp`). Default: `webp`.\n */\n private async getScreenshot(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n const sessionId = parseInt(req.params.sessionId)\n const pageId = parseInt((req.query.page as string) || '0')\n const format = (req.query.format as string) || 'webp'\n log.debug(`GET /screenshot/${sessionId} page=${pageId} format=${format}`)\n try {\n const session = this.stats.sessions.get(sessionId)\n if (!session) {\n throw new Error(`Session not found: \"${sessionId}\"`)\n }\n const filePath = await session.pageScreenshot(pageId, format)\n res.sendFile(path.resolve(filePath))\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * PUT /collected-stats endpoint.\n *\n * Allows to inject {@link Stats} metrics coming from an external tool.\n */\n private putCollectedStats(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`PUT /collected-stats`)\n const { id, stats, config } = req.body\n try {\n this.stats.addExternalCollectedStats(id, stats, config)\n res.json({\n message: `Collected stats added`,\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * PUT /session endpoint.\n *\n * Starts a new {@link Session}.\n * The request body format will be parsed as a {@link SessionParams} object.\n */\n private async putSession(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`PUT /session`, req.body)\n try {\n const id = this.stats.consumeSessionId()\n await this.startLocalSession(id, req.body)\n res.json({\n message: `Session created`,\n data: { id },\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * PUT /sessions endpoint.\n *\n * Starts multiple {@link Session} instances as specified into the\n * `body.sessions` value.\n * The request body will be parsed as a {@link SessionParams} object.\n */\n private async putSessions(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`PUT /sessions`, req.body)\n try {\n const { sessions } = req.body\n const sessionsIds = []\n for (let i = 0; i < sessions; i++) {\n const id = this.stats.sessions.size\n await this.startLocalSession(id, req.body)\n sessionsIds.push(id)\n }\n res.json({\n message: `${sessions} sessions created`,\n data: { ids: sessionsIds },\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * DELETE /session endpoint.\n *\n * Delete the {@link Session} instance identified by the `body.id` param.\n */\n private async deleteSession(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`DELETE /session`, req.body)\n try {\n const { id } = req.body\n await this.stopLocalSession(id)\n res.json({\n message: `Session deleted`,\n data: { id },\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * DELETE /sessions endpoint.\n *\n * Delete the {@link Session} instances specified by the `body.ids` array.\n */\n private async deleteSessions(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`DELETE /sessions`, req.body)\n try {\n const { ids } = req.body\n for (const id of ids) {\n await this.stopLocalSession(id)\n }\n res.json({\n message: `${ids.length} sessions deleted`,\n data: { ids },\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * GET /view/page.log endpoint.\n *\n * Returns the page log file content as specified in {@link Config} `pageLogPath`.\n */\n private getPageLog(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`GET /view/page.log`, req.query)\n if (!this.pageLogPath) {\n return next(new Error('pageLogPath not set'))\n }\n if (req.query.range && !req.headers.range) {\n req.headers.range = `bytes=${req.query.range}`\n }\n res.sendFile(path.resolve(this.pageLogPath))\n }\n\n /**\n * GET /view/docker.log endpoint.\n *\n * Returns the Docker logs related to the container running the tool.\n * It requires to run the Docker container with the following options:\n * ```\n --cidfile /tmp/docker.id\n -v /tmp/docker.id:/root/.webrtcperf/docker.id:ro\n -v /var/lib/docker:/var/lib/docker:ro\n * ```\n */\n private async getDockerLog(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`GET /view/docker.log`, req.query)\n try {\n const logPath = await getDockerLogsPath()\n if (req.query.range && !req.headers.range) {\n req.headers.range = `bytes=${req.query.range}`\n }\n res.sendFile(path.resolve(logPath))\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * GET /download/alert-rules endpoint.\n *\n * Downloads the alert rules report stored into the {@link Stats.alertRulesFilename}.\n */\n private getAlertRules(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`GET /download/alert-rules`, req.query)\n if (!this.stats.alertRulesFilename) {\n return next(new Error('Stats alertRulesFilename not set'))\n }\n res.download(this.stats.alertRulesFilename)\n }\n\n /**\n * GET /empty-page endpoint.\n *\n * Returns an empty HTML page. Useful for running tests with raw Javascript\n * content without any DOM rendering.\n */\n private getEmptyPage(req: express.Request, res: express.Response): void {\n log.debug(`GET /empty-page`, req.query)\n const title = req.query.title || 'EmptyPage'\n res.send(`<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>${title}</title>\n</head>\n<body></body>\n</html>`)\n }\n\n /**\n * GET /data/* endpoint.\n *\n * Returns the file content relative to the {@link Config} `serverData` path.\n * If the requested path points to a directory, it returns the directory\n * content in tar.gz format.\n */\n private getData(req: express.Request, res: express.Response, next: express.NextFunction): void {\n const paramPath = path.normalize(req.params[0]).replace(/^(\\.\\.(\\/|\\\\|$))+/, '')\n log.debug(`GET /data/${paramPath}`, req.query)\n const fpath = path.resolve(this.serverData, paramPath)\n if (!fs.existsSync(fpath)) {\n return next(new Error(`${paramPath} not found`))\n }\n if (req.query.range && !req.headers.range) {\n req.headers.range = `bytes=${req.query.range}`\n }\n res.sendFile(fpath)\n }\n\n private getDataArchive(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`GET /data`, req.query)\n const fpath = path.resolve(this.serverData)\n if (!fs.lstatSync(fpath).isDirectory()) {\n return next(new Error(`${fpath} is not a directory`))\n }\n res.header('Content-Disposition', `attachment; filename=\"${path.basename(fpath)}.tar.gz\"`)\n res.setHeader('content-type', 'application/gzip')\n tar.pack(fpath).pipe(zlib.createGzip()).pipe(res)\n }\n\n private getCache(req: express.Request, res: express.Response, next: express.NextFunction): void {\n const paramPath = path.normalize(req.params[0]).replace(/^(\\.\\.(\\/|\\\\|$))+/, '')\n log.debug(`GET /cache/${paramPath}`, req.query)\n const fpath = path.resolve(this.videoCachePath, paramPath)\n if (!fs.existsSync(fpath)) {\n return next(new Error(`${paramPath} not found`))\n }\n if (req.query.range && !req.headers.range) {\n req.headers.range = `bytes=${req.query.range}`\n }\n res.sendFile(fpath)\n }\n\n /**\n * Starts a new {@link Session} instance.\n * @param id The session unique id.\n * @param config The session configuration.\n */\n private async startLocalSession(id: number, config: SessionParams): Promise<Session> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sessionConfig = loadConfig(undefined, config) as any\n const session = new Session({ ...sessionConfig, id })\n session.once('stop', () => {\n console.warn(`Session ${id} stopped, reloading...`)\n setTimeout(this.startLocalSession.bind(this), sessionConfig.spawnPeriod, id, config)\n })\n this.stats.addSession(session)\n try {\n await session.start()\n } catch (err) {\n this.stats.removeSession(session.id)\n throw err\n }\n return session\n }\n\n /**\n * Stops a new {@link Session} instance.\n * @param {number} id The session unique id.\n */\n private async stopLocalSession(id: number): Promise<void> {\n const session = this.stats.sessions.get(id)\n if (!session) {\n log.warn(`stopLocalSession session ${id} not found`)\n return\n }\n session.removeAllListeners()\n this.stats.removeSession(id)\n await session.stop()\n }\n\n /**\n * Starts the {@link Server} instance.\n */\n async start(): Promise<void> {\n log.debug('start')\n if (this.serverUseHttps) {\n const destDir = path.join(os.homedir(), '.webrtcperf/ssl')\n await runShellCommand(\n `mkdir -p ${destDir} && openssl req -newkey rsa:2048 -nodes -keyout ${destDir}/domain.key -x509 -days 365 -out ${destDir}/domain.crt -subj \"/C=EU/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com\"`,\n )\n this.server = _createServer(\n {\n key: fs.readFileSync(`${destDir}/domain.key`),\n cert: fs.readFileSync(`${destDir}/domain.crt`),\n },\n this.app,\n )\n } else {\n this.server = createServer(this.app)\n }\n\n // WebSocket endpoint.\n const wss = new WebSocketServer({ noServer: true })\n wss.on('connection', (ws, request) => {\n try {\n const query = new URLSearchParams(request.url?.split('?')[1] || '')\n const action = query.get('action') || ''\n log.debug(`ws connection from ${request.socket.remoteAddress} action: ${action}`)\n switch (action) {\n case 'write-stream': {\n if (!this.serverData) {\n throw new Error('serverData option not set')\n }\n const filename = query.get('filename') || ''\n if (!filename) {\n throw new Error('filename not set')\n }\n const paramPath = path.normalize(filename).replace(/^(\\.\\.(\\/|\\\\|$))+/, '')\n\n log.debug(`ws write-stream ${paramPath}`)\n const fpath = path.resolve(this.serverData, paramPath)\n if (fs.existsSync(fpath)) {\n throw new Error(`file already exists: ${fpath}`)\n }\n const stream = fs.createWriteStream(fpath)\n\n let headerWritten = false\n let framesWritten = 0\n\n const close = async () => {\n stream.close()\n ws.close()\n\n try {\n if (!framesWritten) {\n await fs.promises.unlink(fpath)\n }\n } catch (err) {\n log.error(`ws write-stream close error: ${(err as Error).message}`)\n }\n }\n\n stream.on('error', (err: Error) => {\n log.error(`ws write-stream error: ${err.message}`)\n void close()\n })\n\n ws.on('error', (err: Error) => {\n log.error(`ws write-stream error: ${err.message}`)\n void close()\n })\n\n ws.on('close', () => {\n log.debug(`ws write-stream close`)\n void close()\n })\n\n ws.on('message', (data: Uint8Array) => {\n if (!data?.byteLength) return\n if (!headerWritten) {\n stream.write(data)\n headerWritten = true\n return\n }\n stream.write(data)\n framesWritten++\n })\n\n break\n }\n default:\n throw new Error(`invalid action: ${action}`)\n }\n } catch (err) {\n log.error(`ws connection error: ${(err as Error).message}`)\n ws.close()\n }\n })\n this.wss = wss\n\n this.server.on('upgrade', (request, socket, head) => {\n log.debug(`ws upgrade ${request.url}`)\n try {\n const query = new URLSearchParams(request.url?.split('?')[1] || '')\n const auth = query.get('auth')\n if (!auth || !timingSafeEqual(Buffer.from(auth), Buffer.from(this.serverSecret))) {\n throw new Error('invalid auth')\n }\n } catch (err) {\n log.error(`ws upgrade error: ${(err as Error).message}`)\n socket.write('HTTP/1.1 401 Unauthorized\\r\\n\\r\\n')\n socket.destroy()\n return\n }\n\n wss.handleUpgrade(request, socket, head, ws => {\n wss.emit('connection', ws, request)\n })\n })\n\n this.server.listen(this.serverPort, () => {\n log.debug(`HTTPS server listening on port ${this.serverPort}`)\n })\n }\n\n /**\n * Stops the {@link Server} instance.\n */\n stop(): void {\n if (this.wss) {\n this.wss.close()\n this.wss = null\n }\n if (this.server) {\n log.debug('stop')\n this.server.close()\n this.server = null\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAqC;AACrC,mCAAwC;AACxC,mDAAuC;AACvC,4CAAmB;AACnB,+BAAyD;AACzD,iCAA4E;AAC5E,4CAAmB;AACnB,gDAAuB;AACvB,oDAAwB;AACxB,2BAAoC;AACpC,gDAAuB;AACvB,4DAA6B;AAE7B,qCAAqC;AACrC,uCAAkD;AAElD,mCAAoE;AAEpE,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEvC;;;;GAIG;AACH,MAAa,MAAM;IACjB,iCAAiC;IACxB,UAAU,CAAQ;IAC3B,6BAA6B;IACpB,YAAY,CAAQ;IAC7B,wCAAwC;IAC/B,cAAc,CAAS;IAChC,iFAAiF;IACjF,UAAU,CAAQ;IAClB,gFAAgF;IAChF,WAAW,CAAQ;IACnB,mEAAmE;IACnE,cAAc,CAAQ;IACtB,sCAAsC;IACtC,KAAK,CAAO;IAEJ,GAAG,CAAiB;IACpB,MAAM,GAAoC,IAAI,CAAA;IAC9C,GAAG,GAA2B,IAAI,CAAA;IAE1C;;;;;;;;;;;OAWG;IACH,YACE,EACE,UAAU,GAAG,IAAI,EACjB,YAAY,GAAG,QAAQ,EACvB,cAAc,GAAG,KAAK,EACtB,UAAU,GAAG,EAAE,EACf,WAAW,GAAG,EAAE,EAChB,cAAc,GAAG,EAAE,GACpB,GA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AAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;oBACjF,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;gBACjC,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,GAAG,CAAC,KAAK,CAAC,qBAAsB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAA;gBACxD,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAA;gBACjD,MAAM,CAAC,OAAO,EAAE,CAAA;gBAChB,OAAM;YACR,CAAC;YAED,GAAG,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE;gBAC5C,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;YACrC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE;YACvC,GAAG,CAAC,KAAK,CAAC,kCAAkC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;QAChE,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAA;YAChB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAA;QACjB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YACjB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;YACnB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACpB,CAAC;IACH,CAAC;CACF;AA3mBD,wBA2mBC","sourcesContent":["import compression from 'compression'\nimport { timingSafeEqual } from 'crypto'\nimport express, { json } from 'express'\nimport fs from 'fs'\nimport { Server as HttpServer, createServer } from 'http'\nimport { Server as HttpsServer, createServer as _createServer } from 'https'\nimport os from 'os'\nimport path from 'path'\nimport tar from 'tar-fs'\nimport { WebSocketServer } from 'ws'\nimport zlib from 'zlib'\nimport auth from 'basic-auth'\n\nimport { loadConfig } from './config'\nimport { Session, SessionParams } from './session'\nimport { Stats } from './stats'\nimport { logger, runShellCommand, getDockerLogsPath } from './utils'\n\nconst log = logger('webrtcperf:server')\n\n/**\n * An HTTP server instance that allows to control the tool using a REST\n * interface. Moreover, it allows to aggregate stats data coming from multiple\n * running tool instances.\n */\nexport class Server {\n /** The server listening port. */\n readonly serverPort: number\n /** The basic auth secret. */\n readonly serverSecret: string\n /** If HTTPS protocol should be used. */\n readonly serverUseHttps: boolean\n /** An optional path that the HTTP server will expose with the /data endpoint. */\n serverData: string\n /** The file path that will be used to serve the \\`/view/page.log\\` requests. */\n pageLogPath: string\n /** The path that will be used to serve the \\`/cache\\` requests. */\n videoCachePath: string\n /** A {@link Stats} class instance. */\n stats: Stats\n\n private app: express.Express\n private server: HttpServer | HttpsServer | null = null\n private wss: WebSocketServer | null = null\n\n /**\n * Server instance.\n * All the HTTP endpoints are protected by basic authentication with user\n * `admin` and password {@link Server.serverSecret}.\n * @param serverPort The server listening port.\n * @param serverSecret The basic auth secret.\n * @param serverUseHttps If HTTPS protocol should be used.\n * @param serverData An optional path that the HTTP server will expose with the /data endpoint.\n * @param pageLogPath The file path that will be used to serve the \\`/view/page.log\\` requests.\n * @param videoCachePath The path that will be used to serve the \\`/cache\\` requests.\n * @param stats A {@link Stats} class instance.\n */\n constructor(\n {\n serverPort = 5000,\n serverSecret = 'secret',\n serverUseHttps = false,\n serverData = '',\n pageLogPath = '',\n videoCachePath = '',\n } = {},\n stats: Stats,\n ) {\n this.serverPort = serverPort\n this.serverSecret = serverSecret\n this.serverUseHttps = serverUseHttps\n this.serverData = serverData\n this.pageLogPath = pageLogPath\n this.videoCachePath = videoCachePath\n this.stats = stats\n //\n this.app = express()\n this.app.use(compression())\n this.app.use(\n json({\n limit: '10mb',\n }),\n )\n\n this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {\n if (req.query.auth === this.serverSecret) {\n return next()\n }\n const credentials = auth(req)\n if (!credentials || credentials.name !== 'admin' || credentials.pass !== this.serverSecret) {\n res.setHeader('WWW-Authenticate', 'Basic realm=\"Restricted Area\"')\n res.status(401).send('Unauthorized')\n return\n }\n next()\n })\n\n this.app.get('/', (_req, res) => {\n res.send('')\n })\n\n this.app.get('/stats', this.getStats.bind(this))\n this.app.get('/collected-stats', this.getCollectedStats.bind(this))\n this.app.get('/screenshot/:sessionId', this.getScreenshot.bind(this))\n this.app.put('/collected-stats', this.putCollectedStats.bind(this))\n this.app.put('/session', this.putSession.bind(this))\n this.app.put('/sessions', this.putSessions.bind(this))\n this.app.delete('/session', this.deleteSession.bind(this))\n this.app.delete('/sessions', this.deleteSessions.bind(this))\n this.app.get('/view/page.log', this.getPageLog.bind(this))\n this.app.get('/view/docker.log', this.getDockerLog.bind(this))\n this.app.get('/download/alert-rules', this.getAlertRules.bind(this))\n this.app.get('/download/stats', this.getStatsFile.bind(this))\n this.app.get('/download/detailed-stats', this.getDetailedStatsFile.bind(this))\n this.app.get('/empty-page', this.getEmptyPage.bind(this))\n if (this.serverData) {\n log.debug(`using serverData: ${this.serverData}`)\n fs.promises.mkdir(this.serverData, { recursive: true }).catch(err => {\n log.error(`mkdir ${this.serverData} error: ${err.message}`)\n })\n this.app.get('/data', this.getDataArchive.bind(this))\n this.app.get('/data/:path', this.getData.bind(this))\n }\n if (this.videoCachePath) {\n log.debug(`using videoCachePath: ${this.videoCachePath}`)\n fs.promises.mkdir(this.videoCachePath, { recursive: true }).catch(err => {\n log.error(`mkdir ${this.videoCachePath} error: ${err.message}`)\n })\n this.app.get('/cache/:path', this.getCache.bind(this))\n }\n\n this.app.use((err: Error, req: express.Request, res: express.Response, next: express.NextFunction) => {\n log.error(`request path=${req.path} error:`, err.stack)\n if (res.headersSent) {\n return next(err)\n }\n res.status(500).send(err.message)\n })\n }\n\n /*\n * onConnection\n * @param {Socket} socket\n */\n /* onConnection(socket) {\n log.debug('onConnection', socket);\n\n socket.on('disconnect', () => {\n log.debug('io socket disconnected');\n });\n\n socket.on('message', (msg) => {\n log.debug('message', msg);\n });\n } */\n\n /**\n * GET /stats endpoint.\n *\n * Returns a JSON array of the last statistics for each running Session.\n */\n private async getStats(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`GET /stats`)\n const stats = []\n try {\n for (const session of this.stats.sessions.values()) {\n stats.push(session.stats)\n }\n res.json(stats)\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * GET /download/stats endpoint.\n *\n * Returns the {@link Stats.statsWriter} file content.\n */\n private getStatsFile(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`/download/stats`, req.query)\n if (!this.stats.statsWriter) {\n return next(new Error('statsPath not set'))\n }\n res.download(this.stats.statsPath)\n }\n\n /**\n * GET /download/detailed-stats endpoint.\n *\n * Returns the {@link Stats.detailedStatsWriter} file content.\n */\n private getDetailedStatsFile(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`/download/detailed-stats`, req.query)\n if (!this.stats.detailedStatsWriter) {\n return next(new Error('detailedStatsPath not set'))\n }\n res.download(this.stats.detailedStatsPath)\n }\n\n /**\n * GET /collected-stats endpoint.\n *\n * Returns a JSON array of the last statistics collected from external running\n * tools.\n */\n private getCollectedStats(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`GET /collected-stats`)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const stats: Record<string, any> = {}\n try {\n for (const [key, stat] of Object.entries(this.stats.collectedStats)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stats[key] = (stat as any).data\n }\n res.json(stats)\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * GET /screenshot/<sessionID> endpoint.\n *\n * Returns the page screenshot running inside the {@link Session} identified\n * by `sessionID`.\n * Additional query params:\n * - `page`: the page number (starting from `0`) running inside the {@link Session}.\n * - `format`: the image format (`jpeg`, `png`, `webp`). Default: `webp`.\n */\n private async getScreenshot(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n const sessionId = parseInt(req.params.sessionId)\n const pageId = parseInt((req.query.page as string) || '0')\n const format = (req.query.format as string) || 'webp'\n log.debug(`GET /screenshot/${sessionId} page=${pageId} format=${format}`)\n try {\n const session = this.stats.sessions.get(sessionId)\n if (!session) {\n throw new Error(`Session not found: \"${sessionId}\"`)\n }\n const filePath = await session.pageScreenshot(pageId, format)\n res.sendFile(path.resolve(filePath))\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * PUT /collected-stats endpoint.\n *\n * Allows to inject {@link Stats} metrics coming from an external tool.\n */\n private putCollectedStats(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`PUT /collected-stats`)\n const { id, stats, config } = req.body\n try {\n this.stats.addExternalCollectedStats(id, stats, config)\n res.json({\n message: `Collected stats added`,\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * PUT /session endpoint.\n *\n * Starts a new {@link Session}.\n * The request body format will be parsed as a {@link SessionParams} object.\n */\n private async putSession(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`PUT /session`, req.body)\n try {\n const id = this.stats.consumeSessionId()\n await this.startLocalSession(id, req.body)\n res.json({\n message: `Session created`,\n data: { id },\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * PUT /sessions endpoint.\n *\n * Starts multiple {@link Session} instances as specified into the\n * `body.sessions` value.\n * The request body will be parsed as a {@link SessionParams} object.\n */\n private async putSessions(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`PUT /sessions`, req.body)\n try {\n const { sessions } = req.body\n const sessionsIds = []\n for (let i = 0; i < sessions; i++) {\n const id = this.stats.sessions.size\n await this.startLocalSession(id, req.body)\n sessionsIds.push(id)\n }\n res.json({\n message: `${sessions} sessions created`,\n data: { ids: sessionsIds },\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * DELETE /session endpoint.\n *\n * Delete the {@link Session} instance identified by the `body.id` param.\n */\n private async deleteSession(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`DELETE /session`, req.body)\n try {\n const { id } = req.body\n await this.stopLocalSession(id)\n res.json({\n message: `Session deleted`,\n data: { id },\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * DELETE /sessions endpoint.\n *\n * Delete the {@link Session} instances specified by the `body.ids` array.\n */\n private async deleteSessions(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`DELETE /sessions`, req.body)\n try {\n const { ids } = req.body\n for (const id of ids) {\n await this.stopLocalSession(id)\n }\n res.json({\n message: `${ids.length} sessions deleted`,\n data: { ids },\n })\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * GET /view/page.log endpoint.\n *\n * Returns the page log file content as specified in {@link Config} `pageLogPath`.\n */\n private getPageLog(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`GET /view/page.log`, req.query)\n if (!this.pageLogPath) {\n return next(new Error('pageLogPath not set'))\n }\n if (req.query.range && !req.headers.range) {\n req.headers.range = `bytes=${req.query.range}`\n }\n res.sendFile(path.resolve(this.pageLogPath))\n }\n\n /**\n * GET /view/docker.log endpoint.\n *\n * Returns the Docker logs related to the container running the tool.\n * It requires to run the Docker container with the following options:\n * ```\n --cidfile /tmp/docker.id\n -v /tmp/docker.id:/root/.webrtcperf/docker.id:ro\n -v /var/lib/docker:/var/lib/docker:ro\n * ```\n */\n private async getDockerLog(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {\n log.debug(`GET /view/docker.log`, req.query)\n try {\n const logPath = await getDockerLogsPath()\n if (req.query.range && !req.headers.range) {\n req.headers.range = `bytes=${req.query.range}`\n }\n res.sendFile(path.resolve(logPath))\n } catch (err) {\n next(err)\n }\n }\n\n /**\n * GET /download/alert-rules endpoint.\n *\n * Downloads the alert rules report stored into the {@link Stats.alertRulesFilename}.\n */\n private getAlertRules(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`GET /download/alert-rules`, req.query)\n if (!this.stats.alertRulesFilename) {\n return next(new Error('Stats alertRulesFilename not set'))\n }\n res.download(this.stats.alertRulesFilename)\n }\n\n /**\n * GET /empty-page endpoint.\n *\n * Returns an empty HTML page. Useful for running tests with raw Javascript\n * content without any DOM rendering.\n */\n private getEmptyPage(req: express.Request, res: express.Response): void {\n log.debug(`GET /empty-page`, req.query)\n const title = req.query.title || 'EmptyPage'\n res.send(`<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>${title}</title>\n</head>\n<body></body>\n</html>`)\n }\n\n /**\n * GET /data/* endpoint.\n *\n * Returns the file content relative to the {@link Config} `serverData` path.\n * If the requested path points to a directory, it returns the directory\n * content in tar.gz format.\n */\n private getData(req: express.Request, res: express.Response, next: express.NextFunction): void {\n const paramPath = path.normalize(req.params.path).replace(/^(\\.\\.(\\/|\\\\|$))+/, '')\n log.debug(`GET /data/${paramPath}`, req.query)\n const fpath = path.resolve(this.serverData, paramPath)\n if (!fs.existsSync(fpath)) {\n return next(new Error(`${paramPath} not found`))\n }\n if (req.query.range && !req.headers.range) {\n req.headers.range = `bytes=${req.query.range}`\n }\n res.sendFile(fpath)\n }\n\n private getDataArchive(req: express.Request, res: express.Response, next: express.NextFunction): void {\n log.debug(`GET /data`, req.query)\n const fpath = path.resolve(this.serverData)\n if (!fs.lstatSync(fpath).isDirectory()) {\n return next(new Error(`${fpath} is not a directory`))\n }\n res.header('Content-Disposition', `attachment; filename=\"${path.basename(fpath)}.tar.gz\"`)\n res.setHeader('content-type', 'application/gzip')\n tar.pack(fpath).pipe(zlib.createGzip()).pipe(res)\n }\n\n private getCache(req: express.Request, res: express.Response, next: express.NextFunction): void {\n const paramPath = path.normalize(req.params.path).replace(/^(\\.\\.(\\/|\\\\|$))+/, '')\n log.debug(`GET /cache/${paramPath}`, req.query)\n const fpath = path.resolve(this.videoCachePath, paramPath)\n if (!fs.existsSync(fpath)) {\n return next(new Error(`${paramPath} not found`))\n }\n if (req.query.range && !req.headers.range) {\n req.headers.range = `bytes=${req.query.range}`\n }\n res.sendFile(fpath)\n }\n\n /**\n * Starts a new {@link Session} instance.\n * @param id The session unique id.\n * @param config The session configuration.\n */\n private async startLocalSession(id: number, config: SessionParams): Promise<Session> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sessionConfig = loadConfig(undefined, config) as any\n const session = new Session({ ...sessionConfig, id })\n session.once('stop', () => {\n console.warn(`Session ${id} stopped, reloading...`)\n setTimeout(this.startLocalSession.bind(this), sessionConfig.spawnPeriod, id, config)\n })\n this.stats.addSession(session)\n try {\n await session.start()\n } catch (err) {\n this.stats.removeSession(session.id)\n throw err\n }\n return session\n }\n\n /**\n * Stops a new {@link Session} instance.\n * @param {number} id The session unique id.\n */\n private async stopLocalSession(id: number): Promise<void> {\n const session = this.stats.sessions.get(id)\n if (!session) {\n log.warn(`stopLocalSession session ${id} not found`)\n return\n }\n session.removeAllListeners()\n this.stats.removeSession(id)\n await session.stop()\n }\n\n /**\n * Starts the {@link Server} instance.\n */\n async start(): Promise<void> {\n log.debug('start')\n if (this.serverUseHttps) {\n const destDir = path.join(os.homedir(), '.webrtcperf/ssl')\n await runShellCommand(\n `mkdir -p ${destDir} && openssl req -newkey rsa:2048 -nodes -keyout ${destDir}/domain.key -x509 -days 365 -out ${destDir}/domain.crt -subj \"/C=EU/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com\"`,\n )\n this.server = _createServer(\n {\n key: fs.readFileSync(`${destDir}/domain.key`),\n cert: fs.readFileSync(`${destDir}/domain.crt`),\n },\n this.app,\n )\n } else {\n this.server = createServer(this.app)\n }\n\n // WebSocket endpoint.\n const wss = new WebSocketServer({ noServer: true })\n wss.on('connection', (ws, request) => {\n try {\n const query = new URLSearchParams(request.url?.split('?')[1] || '')\n const action = query.get('action') || ''\n log.debug(`ws connection from ${request.socket.remoteAddress} action: ${action}`)\n switch (action) {\n case 'write-stream': {\n if (!this.serverData) {\n throw new Error('serverData option not set')\n }\n const filename = query.get('filename') || ''\n if (!filename) {\n throw new Error('filename not set')\n }\n const paramPath = path.normalize(filename).replace(/^(\\.\\.(\\/|\\\\|$))+/, '')\n\n log.debug(`ws write-stream ${paramPath}`)\n const fpath = path.resolve(this.serverData, paramPath)\n if (fs.existsSync(fpath)) {\n throw new Error(`file already exists: ${fpath}`)\n }\n const stream = fs.createWriteStream(fpath)\n\n let headerWritten = false\n let framesWritten = 0\n\n const close = async () => {\n stream.close()\n ws.close()\n\n try {\n if (!framesWritten) {\n await fs.promises.unlink(fpath)\n }\n } catch (err) {\n log.error(`ws write-stream close error: ${(err as Error).message}`)\n }\n }\n\n stream.on('error', (err: Error) => {\n log.error(`ws write-stream error: ${err.message}`)\n void close()\n })\n\n ws.on('error', (err: Error) => {\n log.error(`ws write-stream error: ${err.message}`)\n void close()\n })\n\n ws.on('close', () => {\n log.debug(`ws write-stream close`)\n void close()\n })\n\n ws.on('message', (data: Uint8Array) => {\n if (!data?.byteLength) return\n if (!headerWritten) {\n stream.write(data)\n headerWritten = true\n return\n }\n stream.write(data)\n framesWritten++\n })\n\n break\n }\n default:\n throw new Error(`invalid action: ${action}`)\n }\n } catch (err) {\n log.error(`ws connection error: ${(err as Error).message}`)\n ws.close()\n }\n })\n this.wss = wss\n\n this.server.on('upgrade', (request, socket, head) => {\n log.debug(`ws upgrade ${request.url}`)\n try {\n const query = new URLSearchParams(request.url?.split('?')[1] || '')\n const auth = query.get('auth')\n if (!auth || !timingSafeEqual(Buffer.from(auth), Buffer.from(this.serverSecret))) {\n throw new Error('invalid auth')\n }\n } catch (err) {\n log.error(`ws upgrade error: ${(err as Error).message}`)\n socket.write('HTTP/1.1 401 Unauthorized\\r\\n\\r\\n')\n socket.destroy()\n return\n }\n\n wss.handleUpgrade(request, socket, head, ws => {\n wss.emit('connection', ws, request)\n })\n })\n\n this.server.listen(this.serverPort, () => {\n log.debug(`HTTPS server listening on port ${this.serverPort}`)\n })\n }\n\n /**\n * Stops the {@link Server} instance.\n */\n stop(): void {\n if (this.wss) {\n this.wss.close()\n this.wss = null\n }\n if (this.server) {\n log.debug('stop')\n this.server.close()\n this.server = null\n }\n }\n}\n"]}
|