Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ them.
| Config option | Description | Default |
| --- | --- | :--: |
| **autoStart**: *boolean* | Whether to automatically start the measurements on instantiation. | `true` |
| **downloadApiUrl**: *string* | The URL of the API for performing download GET requests. | `https://speed.cloudflare.com/__down` |
| **uploadApiUrl**: *string* | The URL of the API for performing upload POST requests. | `https://speed.cloudflare.com/__up` |
| **downloadApiUrl**: *string* | Deprecated fallback URL for download GET requests when `measurementTargets` is empty. | `https://speed.cloudflare.com/__down` |
| **uploadApiUrl**: *string* | Deprecated fallback URL for upload POST requests when `measurementTargets` is empty. | `https://speed.cloudflare.com/__up` |
| **measurementTargets**: *string[]* | Origins used for latency, download, and upload requests. The engine appends `/__down` or `/__up` and distributes requests across the targets, starting at a random target. Duplicate targets are preserved. | `[]` |
| **turnServerUri**: *string* | The URI of the TURN server used to measure packet loss. | `turn.cloudflare.com:3478` |
| **turnServerCredsApiUrl**: *string* | A URI that returns TURN server credentials. Expects a JSON response with `username` and `credential` keys. | - |
| **turnServerUser**: *string* | The username for the TURN server credentials. | - |
Expand Down
12 changes: 10 additions & 2 deletions src/Results/MeasurementCalculations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,16 @@ class MeasurementCalculations {
Object.entries(bandwidthResults)
.map(([bytes, { timings }]) =>
timings.map(
({ bps, duration, ping, measTime, serverTime, transferSize }) => ({
bytes: +bytes,
({
bps,
duration,
ping,
measTime,
serverTime,
transferSize,
transferredBytes
}) => ({
bytes: transferredBytes ?? +bytes,
bps,
duration,
ping,
Expand Down
21 changes: 19 additions & 2 deletions src/config/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export interface BandwidthMeasurementConfig {
bytes: number;
/** Number of requests to issue at this payload size. */
count: number;
/**
* Runs this step using one continuously replenished request lane per target.
*
* @experimental Unstable — may change or be removed in any release.
*/
parallel?: boolean;
/** If `true`, skip the minimum-duration filter for this round. */
bypassMinDuration?: boolean;
}
Expand Down Expand Up @@ -45,10 +51,20 @@ export interface Config {
/** Whether to start the test immediately on construction. Default: `true`. */
autoStart: boolean;

/** URL for download requests. Default: `https://speed.cloudflare.com/__down`. */
/**
* URL for download requests.
*
* @deprecated Use {@link measurementTargets}. This remains the fallback when no targets are configured.
*/
downloadApiUrl: string;
/** URL for upload requests. Default: `https://speed.cloudflare.com/__up`. */
/**
* URL for upload requests.
*
* @deprecated Use {@link measurementTargets}. This remains the fallback when no targets are configured.
*/
uploadApiUrl: string;
/** Origins used for latency, download, and upload requests. */
measurementTargets: string[];
/** URL for per-measurement logging. Set to `null` to disable. Default: `null`. */
logMeasurementApiUrl: string | null;
/** URL for logging test results. Set to `null` to disable. Default: `https://speed.cloudflare.com/__results`. */
Expand Down Expand Up @@ -162,6 +178,7 @@ const defaultConfig: Config = {
// APIs
downloadApiUrl: `${REL_API_URL}/__down`,
uploadApiUrl: `${REL_API_URL}/__up`,
measurementTargets: [],
logMeasurementApiUrl: null,
logAimApiUrl: `${REL_API_URL}/__results`,
turnServerUri: 'turn.speed.cloudflare.com:50000',
Expand Down
Loading