Skip to content

Commit

Permalink
Merge pull request #72 from m-lab/sandbox-cristinaleon-add-pt
Browse files Browse the repository at this point in the history
Integrate packet-test
  • Loading branch information
cristinaleonr committed Aug 23, 2024
2 parents 8cb3388 + 52a800d commit aac1c25
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<script type="text/javascript" src="libraries/ua-device-detector.min.js"></script>
<script type="text/javascript" src="libraries/ng-device-detector.min.js"></script>
<script type="text/javascript" src="libraries/msak.min.js"></script>
<script type="text/javascript" src="libraries/pt.min.js"></script>

<script src="measure/measure.js"></script>
<script src="services/gaugeService.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions app/measure/measure.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ <h1 translate>Test Your Speed</h1>
</div>
</div>
</p>
<small style="font-style: italic;">We are temporarily running two tests back to back to calibrate a new
measurement protocol. This means
<small style="font-style: italic;">We are temporarily running multiple tests back to back to calibrate new
measurement protocols. This means
results may take a little longer to appear than usual. Thank you for your help.
</small><br /><br />
<small translate>For more on M-Lab's data collection and measurement, including the disclosure of IP addresses,
Expand Down
31 changes: 31 additions & 0 deletions app/measure/measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ angular.module('Measure.Measure', ['ngRoute'])
await runNdt7(sessionID);
}

runPT(sessionID)

$scope.$apply(function () {
$scope.currentPhase = gettextCatalog.getString('Complete');
$scope.currentSpeed = '';
Expand Down Expand Up @@ -182,6 +184,35 @@ angular.module('Measure.Measure', ['ngRoute'])

await client.start();
}

async function runPT(sid) {
return pt.test(
{
userAcceptedDataPolicy: true,
downloadworkerfile: "/libraries/pt-download-worker.min.js",
metadata: {
client_name: "speed-measurementlab-net",
client_session_id: sid,
max_cwnd_gain: "512",
}
},
{
serverChosen: function (server) {
$scope.location = server.location.city + ", " +
server.location.country;
$scope.address = server.machine;
console.log('Testing PT to:', {
machine: server.machine,
locations: server.location,
});
},
downloadComplete: (data) => {
console.log("PT result:", data);
},
},
)
}

});

/**
Expand Down
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function copy_libs(cb) {
gulp.src([
"./node_modules/@m-lab/ndt7/src/*.min.js",
"./node_modules/@m-lab/msak/dist/*.min.js",
"./node_modules/@m-lab/packet-test/src/*.min.js",
])

.pipe(gulp.dest('./app/libraries'));
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@bower_components/skel": "n33/skel#~3.0.1",
"@m-lab/msak": "0.3.1",
"@m-lab/ndt7": "0.0.6",
"@m-lab/packet-test": "0.0.16",
"ng-device-detector": "^5.1.4",
"re-tree": "^0.1.7",
"ua-device-detector": "^1.1.8"
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@
bufferutil "^4.0.6"
utf-8-validate "^5.0.8"

"@m-lab/packet-test@0.0.16":
version "0.0.16"
resolved "https://registry.yarnpkg.com/@m-lab/packet-test/-/packet-test-0.0.16.tgz#9d45de5f4003ca369225d88ad7a429e85aa87c5a"
integrity sha512-aUx/Q6fR26YJgchnPGXAWvuZT8OT3b22SgIenllT9v5NZbL2HcDGJ77xzSqZ3jzMEA6rG9tHMXfjQGbf1iQfhQ==
dependencies:
uglify-js "^3.19.2"

accepts@1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.3.tgz#c3ca7434938648c3e0d9c1e328dd68b622c284ca"
Expand Down Expand Up @@ -4193,6 +4200,11 @@ ua-parser-js@^1.0.37:
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.37.tgz#b5dc7b163a5c1f0c510b08446aed4da92c46373f"
integrity sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ==

uglify-js@^3.19.2:
version "3.19.2"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.2.tgz#319ae26a5fbd18d03c7dc02496cfa1d6f1cd4307"
integrity sha512-S8KA6DDI47nQXJSi2ctQ629YzwOVs+bQML6DAtvy0wgNdpi+0ySpQK0g2pxBq2xfF2z3YCscu7NNA8nXT9PlIQ==

ultron@1.0.x:
version "1.0.2"
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.0.2.tgz#ace116ab557cd197386a4e88f4685378c8b2e4fa"
Expand Down

0 comments on commit aac1c25

Please sign in to comment.