@basmilius/apple-common 0.0.96 → 0.0.98
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/dist/index.js +21 -17
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -979,23 +979,27 @@ class timing_default {
|
|
|
979
979
|
this.#port = port;
|
|
980
980
|
}
|
|
981
981
|
async#onMessage(data, info) {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
982
|
+
try {
|
|
983
|
+
const request = NTP.decode(data);
|
|
984
|
+
const ntp = NTP.now();
|
|
985
|
+
const [receivedSeconds, receivedFraction] = NTP.parts(ntp);
|
|
986
|
+
reporter.info(`Timing server ntp=${ntp} receivedSeconds=${receivedSeconds} receivedFraction=${receivedFraction}`);
|
|
987
|
+
const response = NTP.encode({
|
|
988
|
+
proto: request.proto,
|
|
989
|
+
type: 83 | 128,
|
|
990
|
+
seqno: request.seqno,
|
|
991
|
+
padding: 0,
|
|
992
|
+
reftime_sec: request.sendtime_sec,
|
|
993
|
+
reftime_frac: request.sendtime_frac,
|
|
994
|
+
recvtime_sec: receivedSeconds,
|
|
995
|
+
recvtime_frac: receivedFraction,
|
|
996
|
+
sendtime_sec: receivedSeconds,
|
|
997
|
+
sendtime_frac: receivedFraction
|
|
998
|
+
});
|
|
999
|
+
this.#socket.send(response, info.port, info.address);
|
|
1000
|
+
} catch (err) {
|
|
1001
|
+
reporter.warn(`Timing server received malformed packet (${data.length} bytes) from ${info.address}:${info.port}`, err);
|
|
1002
|
+
}
|
|
999
1003
|
}
|
|
1000
1004
|
}
|
|
1001
1005
|
// src/connection.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basmilius/apple-common",
|
|
3
3
|
"description": "Common features shared across various apple protocol packages.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.98",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@basmilius/apple-encoding": "0.0.
|
|
41
|
+
"@basmilius/apple-encoding": "0.0.98",
|
|
42
42
|
"@stablelib/chacha20poly1305": "^2.0.1",
|
|
43
43
|
"fast-srp-hap": "^2.0.4",
|
|
44
44
|
"node-dns-sd": "^1.0.1",
|