node-opcua-client 2.102.0 → 2.104.0
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/alarms_and_conditions/client_alarm_tools_dump_event.js +6 -3
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js.map +1 -1
- package/dist/alarms_and_conditions/client_tools.js +24 -1
- package/dist/alarms_and_conditions/client_tools.js.map +1 -1
- package/dist/client_base.d.ts +5 -1
- package/dist/client_base.js +1 -1
- package/dist/client_base.js.map +1 -1
- package/dist/client_monitored_item_toolbox.js +5 -2
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session_keepalive_manager.d.ts +1 -1
- package/dist/client_session_keepalive_manager.js +10 -6
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/client_subscription.js +1 -1
- package/dist/client_subscription.js.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/opcua_client.d.ts +0 -38
- package/dist/opcua_client.js.map +1 -1
- package/dist/private/client_base_impl.d.ts +2 -0
- package/dist/private/client_base_impl.js +78 -34
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_publish_engine.js +39 -13
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +1 -1
- package/dist/private/client_session_impl.js +26 -23
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.js +45 -19
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.js +32 -6
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/reconnection.js +52 -26
- package/dist/reconnection.js.map +1 -1
- package/dist/tools/findservers.js +24 -1
- package/dist/tools/findservers.js.map +1 -1
- package/dist/tools/read_history_server_capabilities.js.map +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +9 -8
- package/dist/verify.js.map +1 -1
- package/package.json +48 -48
- package/source/alarms_and_conditions/client_alarm_tools_dump_event.ts +1 -1
- package/source/client_base.ts +5 -1
- package/source/client_monitored_item_toolbox.ts +1 -1
- package/source/client_session_keepalive_manager.ts +7 -5
- package/source/opcua_client.ts +0 -46
- package/source/private/client_base_impl.ts +46 -26
- package/source/private/client_publish_engine.ts +1 -1
- package/source/private/client_session_impl.ts +4 -4
- package/source/private/client_subscription_impl.ts +1 -1
- package/source/private/opcua_client_impl.ts +2 -3
- package/source/reconnection.ts +1 -1
- package/source/tools/read_history_server_capabilities.ts +6 -0
- package/source/verify.ts +9 -8
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.findServersOnNetwork = exports.findServers = void 0;
|
|
4
27
|
/**
|
|
5
28
|
* @module node-opcua-client
|
|
6
29
|
*/
|
|
7
|
-
const async = require("async");
|
|
30
|
+
const async = __importStar(require("async"));
|
|
8
31
|
const client_base_impl_1 = require("../private/client_base_impl");
|
|
9
32
|
function findServers(discoveryServerEndpointUri, callback) {
|
|
10
33
|
const client = new client_base_impl_1.ClientBaseImpl({ connectionStrategy: { maxRetry: 3 } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findservers.js","sourceRoot":"","sources":["../../source/tools/findservers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"findservers.js","sourceRoot":"","sources":["../../source/tools/findservers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,6CAA+B;AAK/B,kEAA6D;AAkB7D,SAAgB,WAAW,CACvB,0BAAkC,EAClC,QAAkE;IAElE,MAAM,MAAM,GAAG,IAAI,iCAAc,CAAC,EAAE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAE3E,IAAI,OAAO,GAA6B,EAAE,CAAC;IAC3C,IAAI,SAAS,GAA0B,EAAE,CAAC;IAE1C,KAAK,CAAC,MAAM,CACR;QACI,CAAC,aAA4B,EAAE,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAC;QAC9D,CAAC;QAED,CAAC,aAA4B,EAAE,EAAE;YAC7B,MAAM,CAAC,WAAW,CAAC,CAAC,GAAiB,EAAE,QAAmC,EAAE,EAAE;gBAC1E,IAAI,QAAQ,EAAE;oBACV,OAAO,GAAG,QAAQ,CAAC;iBACtB;gBACD,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;QACP,CAAC;QAED,CAAC,aAA4B,EAAE,EAAE;YAC7B,MAAM,C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AAC,SAAS,CAAC,CAAC;AAClC,MAAM,CAAC,OAAe,CAAC,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAE,MAAM,CAAC,OAAe,CAAC,oBAAoB,CAAC,CAAC;AACjH,MAAM,CAAC,OAAe,CAAC,WAAW,GAAG,OAAO,CAAC,YAAY,CAAE,MAAM,CAAC,OAAe,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read_history_server_capabilities.js","sourceRoot":"","sources":["../../source/tools/read_history_server_capabilities.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA2C;AAC3C,+DAAiD;AACjD,iEAAqD;AAErD,yDAA2C;AAE3C,uGAAwG;AAExG,uDAAoD;AAcpD,SAAgB,6BAA6B,CACzC,OAAsB,EACtB,QAAgF;IAEhF,IAAI,CAAC,QAAQ,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACrC;IACD,wCAAwC;IACxC,MAAM,UAAU,GAAe,IAAA,yDAAc,EAAC,gCAAS,CAAC,aAAa,EAAE,sDAAsD,CAAC,CAAC;IAE/H,OAAO,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,GAAiB,EAAE,MAAyB,EAAE,EAAE;QACrF,IAAI,GAAG,EAAE;YACL,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;SACxB;QACD,0BAA0B;QAC1B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;SAChD;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE;YAC/B,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC9E;QAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QAEtC,MAAM,+BAA+B,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACnE,2BAA2B;QAC3B,IAAA,0BAAM,EAAC,+BAA+B,CAAC,QAAQ,EAAE,KAAK,cAAc,CAAC,CAAC;QAEtE,4BAA4B;QAC5B,MAAM,UAAU,GAAG;YACf,6BAA6B;YAC7B,+BAA+B;
|
|
1
|
+
{"version":3,"file":"read_history_server_capabilities.js","sourceRoot":"","sources":["../../source/tools/read_history_server_capabilities.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA2C;AAC3C,+DAAiD;AACjD,iEAAqD;AAErD,yDAA2C;AAE3C,uGAAwG;AAExG,uDAAoD;AAcpD,SAAgB,6BAA6B,CACzC,OAAsB,EACtB,QAAgF;IAEhF,IAAI,CAAC,QAAQ,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACrC;IACD,wCAAwC;IACxC,MAAM,UAAU,GAAe,IAAA,yDAAc,EAAC,gCAAS,CAAC,aAAa,EAAE,sDAAsD,CAAC,CAAC;IAE/H,OAAO,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,GAAiB,EAAE,MAAyB,EAAE,EAAE;QACrF,IAAI,GAAG,EAAE;YACL,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;SACxB;QACD,0BAA0B;QAC1B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;SAChD;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE;YAC/B,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC9E;QAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QAEtC,MAAM,+BAA+B,GAAG,MAAM,CAAC,OAAO,CA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|
import { OPCUASecureObject } from "node-opcua-common";
|
|
3
3
|
import { Certificate } from "node-opcua-crypto";
|
|
4
4
|
export declare function verifyIsOPCUAValidCertificate(certificate: Certificate, certificateFile: string, type: "client" | "server", applicationUri: string): void;
|
|
5
|
-
export declare function performCertificateSanityCheck(
|
|
5
|
+
export declare function performCertificateSanityCheck(secureObject: OPCUASecureObject, serverOrClient: "server" | "client", certificateManager: OPCUACertificateManager, applicationUri: string): Promise<void>;
|
package/dist/verify.js
CHANGED
|
@@ -72,6 +72,7 @@ function verifyIsOPCUAValidCertificate(certificate, certificateFile, type, appli
|
|
|
72
72
|
warningLog(`[NODE-OPCUA-W16] The certificate keyUsage must include digitalSignature, nonRepudiation, keyEncipherment and dataEncipherment.\n` +
|
|
73
73
|
`see https://reference.opcfoundation.org/v104/Core/docs/Part6/6.2.2/\n` +
|
|
74
74
|
`certificateFile = ${certificateFile}`);
|
|
75
|
+
warningLog(`keyUsage = ${JSON.stringify(keyUsage, null, " ")}`);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
const extKeyUsage = (_e = certificateInfo.tbsCertificate.extensions) === null || _e === void 0 ? void 0 : _e.extKeyUsage;
|
|
@@ -100,18 +101,18 @@ function verifyIsOPCUAValidCertificate(certificate, certificateFile, type, appli
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
exports.verifyIsOPCUAValidCertificate = verifyIsOPCUAValidCertificate;
|
|
103
|
-
function performCertificateSanityCheck(serverOrClient, certificateManager, applicationUri) {
|
|
104
|
+
function performCertificateSanityCheck(secureObject, serverOrClient, certificateManager, applicationUri) {
|
|
104
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
// verify that certificate is matching private key, and inform the
|
|
106
|
-
const certificate =
|
|
107
|
-
const privateKey =
|
|
106
|
+
// verify that certificate is matching private key, and inform the developer if not
|
|
107
|
+
const certificate = secureObject.getCertificate();
|
|
108
|
+
const privateKey = secureObject.getPrivateKey();
|
|
108
109
|
//
|
|
109
110
|
if (!(0, node_opcua_crypto_1.publicKeyAndPrivateKeyMatches)(certificate, privateKey)) {
|
|
110
111
|
errorLog("[NODE-OPCUA-E01] Configuration error : the certificate and the private key do not match !");
|
|
111
112
|
errorLog(" please check the configuration of the OPCUA Server");
|
|
112
|
-
errorLog(" privateKey= ",
|
|
113
|
+
errorLog(" privateKey= ", secureObject.privateKeyFile);
|
|
113
114
|
errorLog(" certificateManager.privateKey= ", certificateManager.privateKey);
|
|
114
|
-
errorLog(" certificateFile= ",
|
|
115
|
+
errorLog(" certificateFile= ", secureObject.certificateFile);
|
|
115
116
|
throw new Error("[NODE-OPCUA-E01] Configuration error : the certificate and the private key do not match ! please fix your configuration");
|
|
116
117
|
}
|
|
117
118
|
// verify that the certificate provided has the right key length ( at least 2048)
|
|
@@ -126,9 +127,9 @@ function performCertificateSanityCheck(serverOrClient, certificateManager, appli
|
|
|
126
127
|
const status1 = yield certificateManager.trustCertificate(certificate);
|
|
127
128
|
const status = yield certificateManager.verifyCertificateAsync(certificate);
|
|
128
129
|
if (status !== "Good") {
|
|
129
|
-
warningLog("[NODE-OPCUA-W04] Warning: the certificate status is = ", status, " file = ",
|
|
130
|
+
warningLog("[NODE-OPCUA-W04] Warning: the certificate status is = ", status, " file = ", secureObject.certificateFile);
|
|
130
131
|
}
|
|
131
|
-
verifyIsOPCUAValidCertificate(certificate,
|
|
132
|
+
verifyIsOPCUAValidCertificate(certificate, secureObject.certificateFile, serverOrClient, applicationUri);
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
135
|
exports.performCertificateSanityCheck = performCertificateSanityCheck;
|
package/dist/verify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../source/verify.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,yDAM2B;AAC3B,uDAAiG;AAEjG,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAA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G,QAAQ,CAAC,sEAAsE,CAAC,CAAC;YACjF,QAAQ,CAAC,kCAAkC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;YAC1E,QAAQ,CAAC,kCAAkC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;YAC5E,QAAQ,CAAC,kCAAkC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;YAC3E,MAAM,IAAI,KAAK,CACX,yHAAyH,CAC5H,CAAC;SACL;QACD,iFAAiF;QACjF,MAAM,cAAc,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;QACrD,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1D,IAAI,eAAe,IAAI,IAAI,EAAE;YACzB,UAAU,CACN,2HAA2H,eAAe,MAAM;gBAC5I,2FAA2F;gBAC3F,OAAO,cAAc,qEAAqE,CACjG,CAAC;SACL;QACD,sGAAsG;QACtG,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACvE,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QAE5E,IAAI,MAAM,KAAK,MAAM,EAAE;YACnB,UAAU,CAAC,wDAAwD,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;SAC1H;QAED,6BAA6B,CAAC,WAAW,EAAE,YAAY,CAAC,eAAe,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IAC7G,CAAC;CAAA;AAvCD,sEAuCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.104.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module client",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "npx rimraf node_modules dist *.tsbuildinfo certificates",
|
|
@@ -13,61 +13,61 @@
|
|
|
13
13
|
"main": "./dist/index.js",
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ster5/global-mutex": "^
|
|
17
|
-
"@types/async": "^3.2.
|
|
16
|
+
"@ster5/global-mutex": "^2.0.0",
|
|
17
|
+
"@types/async": "^3.2.20",
|
|
18
18
|
"async": "^3.2.4",
|
|
19
19
|
"chalk": "4.1.2",
|
|
20
|
-
"node-opcua-assert": "2.
|
|
21
|
-
"node-opcua-basic-types": "2.
|
|
22
|
-
"node-opcua-buffer-utils": "2.
|
|
23
|
-
"node-opcua-certificate-manager": "2.
|
|
24
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
25
|
-
"node-opcua-common": "2.
|
|
20
|
+
"node-opcua-assert": "2.104.0",
|
|
21
|
+
"node-opcua-basic-types": "2.104.0",
|
|
22
|
+
"node-opcua-buffer-utils": "2.104.0",
|
|
23
|
+
"node-opcua-certificate-manager": "2.104.0",
|
|
24
|
+
"node-opcua-client-dynamic-extension-object": "2.104.0",
|
|
25
|
+
"node-opcua-common": "2.104.0",
|
|
26
26
|
"node-opcua-constants": "2.98.1",
|
|
27
|
-
"node-opcua-crypto": "
|
|
28
|
-
"node-opcua-data-model": "2.
|
|
29
|
-
"node-opcua-data-value": "2.
|
|
30
|
-
"node-opcua-date-time": "2.
|
|
31
|
-
"node-opcua-debug": "2.
|
|
32
|
-
"node-opcua-extension-object": "2.
|
|
33
|
-
"node-opcua-hostname": "2.
|
|
34
|
-
"node-opcua-nodeid": "2.
|
|
35
|
-
"node-opcua-object-registry": "2.
|
|
36
|
-
"node-opcua-pki": "
|
|
37
|
-
"node-opcua-pseudo-session": "2.
|
|
38
|
-
"node-opcua-schemas": "2.
|
|
39
|
-
"node-opcua-secure-channel": "2.
|
|
40
|
-
"node-opcua-service-browse": "2.
|
|
41
|
-
"node-opcua-service-call": "2.
|
|
42
|
-
"node-opcua-service-discovery": "2.
|
|
43
|
-
"node-opcua-service-endpoints": "2.
|
|
44
|
-
"node-opcua-service-filter": "2.
|
|
45
|
-
"node-opcua-service-history": "2.
|
|
46
|
-
"node-opcua-service-query": "2.
|
|
47
|
-
"node-opcua-service-read": "2.
|
|
48
|
-
"node-opcua-service-register-node": "2.
|
|
49
|
-
"node-opcua-service-secure-channel": "2.
|
|
50
|
-
"node-opcua-service-session": "2.
|
|
51
|
-
"node-opcua-service-subscription": "2.
|
|
52
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
53
|
-
"node-opcua-service-write": "2.
|
|
54
|
-
"node-opcua-status-code": "2.
|
|
55
|
-
"node-opcua-types": "2.
|
|
56
|
-
"node-opcua-utils": "2.
|
|
57
|
-
"node-opcua-variant": "2.
|
|
27
|
+
"node-opcua-crypto": "3.0.5",
|
|
28
|
+
"node-opcua-data-model": "2.104.0",
|
|
29
|
+
"node-opcua-data-value": "2.104.0",
|
|
30
|
+
"node-opcua-date-time": "2.104.0",
|
|
31
|
+
"node-opcua-debug": "2.104.0",
|
|
32
|
+
"node-opcua-extension-object": "2.104.0",
|
|
33
|
+
"node-opcua-hostname": "2.104.0",
|
|
34
|
+
"node-opcua-nodeid": "2.104.0",
|
|
35
|
+
"node-opcua-object-registry": "2.104.0",
|
|
36
|
+
"node-opcua-pki": "4.2.0",
|
|
37
|
+
"node-opcua-pseudo-session": "2.104.0",
|
|
38
|
+
"node-opcua-schemas": "2.104.0",
|
|
39
|
+
"node-opcua-secure-channel": "2.104.0",
|
|
40
|
+
"node-opcua-service-browse": "2.104.0",
|
|
41
|
+
"node-opcua-service-call": "2.104.0",
|
|
42
|
+
"node-opcua-service-discovery": "2.104.0",
|
|
43
|
+
"node-opcua-service-endpoints": "2.104.0",
|
|
44
|
+
"node-opcua-service-filter": "2.104.0",
|
|
45
|
+
"node-opcua-service-history": "2.104.0",
|
|
46
|
+
"node-opcua-service-query": "2.104.0",
|
|
47
|
+
"node-opcua-service-read": "2.104.0",
|
|
48
|
+
"node-opcua-service-register-node": "2.104.0",
|
|
49
|
+
"node-opcua-service-secure-channel": "2.104.0",
|
|
50
|
+
"node-opcua-service-session": "2.104.0",
|
|
51
|
+
"node-opcua-service-subscription": "2.104.0",
|
|
52
|
+
"node-opcua-service-translate-browse-path": "2.104.0",
|
|
53
|
+
"node-opcua-service-write": "2.104.0",
|
|
54
|
+
"node-opcua-status-code": "2.104.0",
|
|
55
|
+
"node-opcua-types": "2.104.0",
|
|
56
|
+
"node-opcua-utils": "2.104.0",
|
|
57
|
+
"node-opcua-variant": "2.104.0",
|
|
58
58
|
"thenify": "^3.3.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@types/underscore": "^1.11.
|
|
61
|
+
"@types/underscore": "^1.11.5",
|
|
62
62
|
"dequeue": "^1.0.5",
|
|
63
63
|
"mocha": "^10.2.0",
|
|
64
|
-
"node-opcua-address-space": "2.
|
|
65
|
-
"node-opcua-binary-stream": "2.
|
|
66
|
-
"node-opcua-factory": "2.
|
|
67
|
-
"node-opcua-leak-detector": "2.
|
|
68
|
-
"node-opcua-nodesets": "2.
|
|
64
|
+
"node-opcua-address-space": "2.104.0",
|
|
65
|
+
"node-opcua-binary-stream": "2.104.0",
|
|
66
|
+
"node-opcua-factory": "2.104.0",
|
|
67
|
+
"node-opcua-leak-detector": "2.104.0",
|
|
68
|
+
"node-opcua-nodesets": "2.103.0",
|
|
69
69
|
"should": "^13.2.3",
|
|
70
|
-
"sinon": "^15.0
|
|
70
|
+
"sinon": "^15.1.0",
|
|
71
71
|
"underscore": "^1.13.6"
|
|
72
72
|
},
|
|
73
73
|
"eslintConfig": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"internet of things"
|
|
91
91
|
],
|
|
92
92
|
"homepage": "http://node-opcua.github.io/",
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "3cd6d355e8b3c66822d08a3ca682659ea5d1a55d",
|
|
94
94
|
"files": [
|
|
95
95
|
"dist",
|
|
96
96
|
"source"
|
package/source/client_base.ts
CHANGED
|
@@ -102,6 +102,10 @@ export interface OPCUAClientBaseOptions {
|
|
|
102
102
|
* @default false
|
|
103
103
|
*/
|
|
104
104
|
keepSessionAlive?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* the number of milliseconds that the client should wait until it sends a keep alive message to the server.
|
|
107
|
+
*/
|
|
108
|
+
keepAliveInterval?: number;
|
|
105
109
|
|
|
106
110
|
/**
|
|
107
111
|
* certificate Manager
|
|
@@ -132,6 +136,7 @@ export interface OPCUAClientBaseOptions {
|
|
|
132
136
|
* @advanced
|
|
133
137
|
*/
|
|
134
138
|
transportSettings?: TransportSettings;
|
|
139
|
+
transportTimeout?: number;
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
export interface GetEndpointsOptions {
|
|
@@ -325,7 +330,6 @@ export interface OPCUAClientBase {
|
|
|
325
330
|
readonly connectionStrategy: ConnectionStrategy;
|
|
326
331
|
readonly keepPendingSessionsOnDisconnect: boolean;
|
|
327
332
|
readonly endpointUrl: string;
|
|
328
|
-
readonly keepSessionAlive: boolean;
|
|
329
333
|
readonly applicationName: string;
|
|
330
334
|
}
|
|
331
335
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module node-opcua-client
|
|
3
3
|
*/
|
|
4
4
|
import { EventEmitter } from "events";
|
|
5
|
-
import
|
|
5
|
+
import chalk from "chalk";
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
7
|
import { ServerState } from "node-opcua-common";
|
|
8
8
|
import { VariableIds } from "node-opcua-constants";
|
|
@@ -43,7 +43,7 @@ export class ClientSessionKeepAliveManager extends EventEmitter implements Clien
|
|
|
43
43
|
this.count = 0;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
public start(): void {
|
|
46
|
+
public start(keepAliveInterval?: number): void {
|
|
47
47
|
assert(!this.timerId);
|
|
48
48
|
/* istanbul ignore next*/
|
|
49
49
|
if (this.session.timeout < 600) {
|
|
@@ -58,10 +58,12 @@ export class ClientSessionKeepAliveManager extends EventEmitter implements Clien
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const selectedCheckInterval =
|
|
62
|
+
keepAliveInterval ||
|
|
63
|
+
Math.min(Math.floor(Math.min((this.session.timeout * 2) / 3, 20000)), ClientSecureChannelLayer.defaultTransportTimeout);
|
|
62
64
|
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
+
this.checkInterval = selectedCheckInterval;
|
|
66
|
+
this.pingTimeout = Math.floor(Math.min(Math.max(50, selectedCheckInterval / 2), 20000));
|
|
65
67
|
|
|
66
68
|
// make sure first one is almost immediate
|
|
67
69
|
this.timerId = setTimeout(() => this.ping_server(), this.pingTimeout);
|
package/source/opcua_client.ts
CHANGED
|
@@ -16,7 +16,6 @@ import { ClientSubscription, ClientSubscriptionOptions } from "./client_subscrip
|
|
|
16
16
|
import { OPCUAClientImpl } from "./private/opcua_client_impl";
|
|
17
17
|
import { UserIdentityInfo } from "./user_identity_info";
|
|
18
18
|
|
|
19
|
-
|
|
20
19
|
export interface OPCUAClientOptions extends OPCUAClientBaseOptions {
|
|
21
20
|
/**
|
|
22
21
|
* the requested session timeout in CreateSession (ms)
|
|
@@ -43,51 +42,6 @@ export interface OPCUAClientOptions extends OPCUAClientBaseOptions {
|
|
|
43
42
|
* @default true
|
|
44
43
|
*/
|
|
45
44
|
endpointMustExist?: boolean;
|
|
46
|
-
|
|
47
|
-
// --------------------------------------------------------------------
|
|
48
|
-
connectionStrategy?: ConnectionStrategyOptions;
|
|
49
|
-
|
|
50
|
-
/** the server certificate. */
|
|
51
|
-
serverCertificate?: Certificate;
|
|
52
|
-
|
|
53
|
-
/***
|
|
54
|
-
* default secure token lifetime in ms
|
|
55
|
-
*/
|
|
56
|
-
defaultSecureTokenLifetime?: number;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* the security mode
|
|
60
|
-
* @default MessageSecurityMode.None
|
|
61
|
-
*/
|
|
62
|
-
securityMode?: MessageSecurityMode | string;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* the security policy
|
|
66
|
-
* @default SecurityPolicy.None
|
|
67
|
-
*/
|
|
68
|
-
securityPolicy?: SecurityPolicy | string;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @default false
|
|
72
|
-
*/
|
|
73
|
-
keepSessionAlive?: boolean;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* client certificate pem file.
|
|
77
|
-
* @default "certificates/client_self-signed_cert_2048.pem"
|
|
78
|
-
*/
|
|
79
|
-
certificateFile?: string;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* client private key pem file.
|
|
83
|
-
* @default "certificates/client_key_2048.pem"
|
|
84
|
-
*/
|
|
85
|
-
privateKeyFile?: string;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* a client name string that will be used to generate session names.
|
|
89
|
-
*/
|
|
90
|
-
clientName?: string;
|
|
91
45
|
}
|
|
92
46
|
|
|
93
47
|
export interface OPCUAClient extends OPCUAClientBase {
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
import * as fs from "fs";
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import * as async from "async";
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import chalk from "chalk";
|
|
10
9
|
import { withLock } from "@ster5/global-mutex";
|
|
11
10
|
import { assert } from "node-opcua-assert";
|
|
12
11
|
import { IOPCUASecureObjectOptions, OPCUASecureObject } from "node-opcua-common";
|
|
13
|
-
import { Certificate, makeSHA1Thumbprint, Nonce } from "node-opcua-crypto";
|
|
12
|
+
import { Certificate, makeSHA1Thumbprint, Nonce, split_der } from "node-opcua-crypto";
|
|
14
13
|
import { installPeriodicClockAdjustment, periodicClockAdjustment, uninstallPeriodicClockAdjustment } from "node-opcua-date-time";
|
|
15
14
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
16
15
|
|
|
@@ -365,6 +364,7 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
365
364
|
* true if session shall periodically probe the server to keep the session alive and prevent timeout
|
|
366
365
|
*/
|
|
367
366
|
public keepSessionAlive: boolean;
|
|
367
|
+
public readonly keepAliveInterval?: number;
|
|
368
368
|
|
|
369
369
|
public _sessions: ClientSessionImpl[];
|
|
370
370
|
protected _serverEndpoints: EndpointDescription[];
|
|
@@ -383,6 +383,7 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
383
383
|
private _tmpClient?: OPCUAClientBase;
|
|
384
384
|
private _instanceNumber: number;
|
|
385
385
|
private _transportSettings: TransportSettings;
|
|
386
|
+
private _transportTimeout?: number;
|
|
386
387
|
|
|
387
388
|
public clientCertificateManager: OPCUACertificateManager;
|
|
388
389
|
|
|
@@ -451,6 +452,7 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
451
452
|
this.serverCertificate = options.serverCertificate;
|
|
452
453
|
|
|
453
454
|
this.keepSessionAlive = typeof options.keepSessionAlive === "boolean" ? options.keepSessionAlive : false;
|
|
455
|
+
this.keepAliveInterval = options.keepAliveInterval;
|
|
454
456
|
|
|
455
457
|
// statistics...
|
|
456
458
|
this._byteRead = 0;
|
|
@@ -471,6 +473,7 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
471
473
|
this._setInternalState("disconnected");
|
|
472
474
|
|
|
473
475
|
this._transportSettings = options.transportSettings || {};
|
|
476
|
+
this._transportTimeout = options.transportTimeout;
|
|
474
477
|
}
|
|
475
478
|
|
|
476
479
|
private _cancel_reconnection(callback: ErrorCallback) {
|
|
@@ -645,8 +648,8 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
645
648
|
securityPolicy: this.securityPolicy,
|
|
646
649
|
serverCertificate: this.serverCertificate,
|
|
647
650
|
tokenRenewalInterval: this.tokenRenewalInterval,
|
|
648
|
-
transportSettings: this._transportSettings
|
|
649
|
-
|
|
651
|
+
transportSettings: this._transportSettings,
|
|
652
|
+
transportTimeout: this._transportTimeout
|
|
650
653
|
});
|
|
651
654
|
secureChannel.on("backoff", (count: number, delay: number) => {
|
|
652
655
|
this.emit("backoff", count, delay);
|
|
@@ -746,11 +749,14 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
746
749
|
if ((this as any)._inCreateDefaultCertificate) {
|
|
747
750
|
errorLog("Internal error : re-entrancy in createDefaultCertificate!");
|
|
748
751
|
}
|
|
749
|
-
|
|
750
752
|
(this as any)._inCreateDefaultCertificate = true;
|
|
751
753
|
if (!fs.existsSync(this.certificateFile)) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
+
await withLock({ fileToLock: this.certificateFile + ".mutex" }, async () => {
|
|
755
|
+
if (fs.existsSync(this.certificateFile)) {
|
|
756
|
+
// the file may have been created in between
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
console.log("Creating default certificate ... please wait");
|
|
754
760
|
if (this.disconnecting) return;
|
|
755
761
|
|
|
756
762
|
await ClientBaseImpl.createCertificate(
|
|
@@ -793,13 +799,10 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
793
799
|
if (!fs.existsSync(this.privateKeyFile)) {
|
|
794
800
|
throw new Error(" cannot locate private key file " + this.privateKeyFile);
|
|
795
801
|
}
|
|
796
|
-
|
|
797
802
|
if (this.disconnecting) return;
|
|
798
803
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
if (this.disconnecting) return;
|
|
802
|
-
await performCertificateSanityCheck.call(this, "client", this.clientCertificateManager, this._getBuiltApplicationUri());
|
|
804
|
+
await this.clientCertificateManager.withLock2(async () => {
|
|
805
|
+
await performCertificateSanityCheck(this, "client", this.clientCertificateManager, this._getBuiltApplicationUri());
|
|
803
806
|
});
|
|
804
807
|
}
|
|
805
808
|
|
|
@@ -934,6 +937,7 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
934
937
|
/* */
|
|
935
938
|
this._handleDisconnectionWhileConnecting(err, callback);
|
|
936
939
|
} else {
|
|
940
|
+
console.log("REMOVE ME", err.stack);
|
|
937
941
|
err = new Error("The connection may have been rejected by server,\n" + "Err = (" + err.message + ")");
|
|
938
942
|
this._handleUnrecoverableConnectionFailure(err, callback);
|
|
939
943
|
}
|
|
@@ -1285,12 +1289,12 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
1285
1289
|
tmpChannel = null;
|
|
1286
1290
|
this._destroy_secure_channel();
|
|
1287
1291
|
this._setInternalState("disconnected");
|
|
1288
|
-
|
|
1292
|
+
callback();
|
|
1289
1293
|
});
|
|
1290
1294
|
} else {
|
|
1291
|
-
this.emit("close", null);
|
|
1292
1295
|
this._setInternalState("disconnected");
|
|
1293
|
-
|
|
1296
|
+
// this.emit("close", null);
|
|
1297
|
+
callback();
|
|
1294
1298
|
}
|
|
1295
1299
|
}
|
|
1296
1300
|
|
|
@@ -1412,14 +1416,28 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
1412
1416
|
_verify_serverCertificate(this.clientCertificateManager, endpoint.serverCertificate, (err1?: Error) => {
|
|
1413
1417
|
if (err1) {
|
|
1414
1418
|
warningLog("[NODE-OPCUA-W25] client's server certificate verification has failed ", err1.message);
|
|
1415
|
-
warningLog(" ", this.clientCertificateManager.rootDir);
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
)
|
|
1419
|
+
warningLog(" clientCertificateManager.rootDir = ", this.clientCertificateManager.rootDir);
|
|
1420
|
+
|
|
1421
|
+
const f = (b: Buffer) =>
|
|
1422
|
+
" " + b.toString("base64").replace(/(.{80})/g, "$1\n ");
|
|
1423
|
+
|
|
1424
|
+
const chain = split_der(endpoint.serverCertificate);
|
|
1425
|
+
warningLog(` server certificate contains ${chain.length} elements`);
|
|
1426
|
+
for (let i = 0; i < chain.length; i++) {
|
|
1427
|
+
const c = chain[i];
|
|
1428
|
+
warningLog("certificate", i, "\n" + f(c));
|
|
1429
|
+
}
|
|
1430
|
+
if (chain.length > 1) {
|
|
1431
|
+
warningLog(
|
|
1432
|
+
" verify also that the issuer certificate is trusted and the issuer's certificate is present in the issuer.cert folder\n" +
|
|
1433
|
+
" of the client certificate manager located in ",
|
|
1434
|
+
this.clientCertificateManager.rootDir
|
|
1435
|
+
);
|
|
1436
|
+
} else {
|
|
1437
|
+
warningLog(
|
|
1438
|
+
" verify that the server certificate is trusted or that server certificate issuer's certificate is present in the issuer folder"
|
|
1439
|
+
);
|
|
1440
|
+
}
|
|
1423
1441
|
return callback(err1);
|
|
1424
1442
|
}
|
|
1425
1443
|
this.serverCertificate = endpoint.serverCertificate;
|
|
@@ -1569,12 +1587,14 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
1569
1587
|
* @event close
|
|
1570
1588
|
* @param error
|
|
1571
1589
|
*/
|
|
1572
|
-
|
|
1590
|
+
if (err) {
|
|
1591
|
+
this.emit("connection_lost", err?.message); // instead of "close"
|
|
1592
|
+
}
|
|
1593
|
+
this.emit("close", err); // instead of "close"
|
|
1573
1594
|
} else {
|
|
1574
1595
|
/**
|
|
1575
1596
|
* @event connection_lost
|
|
1576
1597
|
*/
|
|
1577
|
-
// this.emit("close", err);
|
|
1578
1598
|
if (this.reconnectOnFailure && this._internalState !== "reconnecting") {
|
|
1579
1599
|
debugLog(" ClientBaseImpl emitting connection_lost");
|
|
1580
1600
|
this.emit("connection_lost", err?.message); // instead of "close"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { types } from "util";
|
|
5
5
|
import * as async from "async";
|
|
6
|
-
import
|
|
6
|
+
import chalk from "chalk";
|
|
7
7
|
import { assert } from "node-opcua-assert";
|
|
8
8
|
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
9
9
|
import { PublishRequest, PublishResponse, RepublishRequest, RepublishResponse } from "node-opcua-service-subscription";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { EventEmitter } from "events";
|
|
5
5
|
import { callbackify } from "util";
|
|
6
|
-
import
|
|
6
|
+
import chalk from "chalk";
|
|
7
7
|
import { assert } from "node-opcua-assert";
|
|
8
8
|
import { AggregateFunction } from "node-opcua-constants";
|
|
9
9
|
import { DateTime } from "node-opcua-basic-types";
|
|
@@ -309,7 +309,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
309
309
|
get subscriptionCount(): number {
|
|
310
310
|
return this._publishEngine ? this._publishEngine.subscriptionCount : 0;
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
|
|
313
313
|
get isReconnecting(): boolean {
|
|
314
314
|
return this._client ? this._client.isReconnecting || this._reconnecting?.reconnecting : false;
|
|
315
315
|
}
|
|
@@ -1998,7 +1998,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1998
1998
|
});
|
|
1999
1999
|
}
|
|
2000
2000
|
|
|
2001
|
-
public startKeepAliveManager(): void {
|
|
2001
|
+
public startKeepAliveManager(keepAliveInterval?: number): void {
|
|
2002
2002
|
if (this._keepAliveManager) {
|
|
2003
2003
|
// "keepAliveManger already started"
|
|
2004
2004
|
return;
|
|
@@ -2019,7 +2019,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
2019
2019
|
*/
|
|
2020
2020
|
this.emit("keepalive", state, count);
|
|
2021
2021
|
});
|
|
2022
|
-
this._keepAliveManager.start();
|
|
2022
|
+
this._keepAliveManager.start(keepAliveInterval);
|
|
2023
2023
|
}
|
|
2024
2024
|
|
|
2025
2025
|
public stopKeepAliveManager(): void {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// tslint:disable:unified-signatures
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
6
|
import * as async from "async";
|
|
7
|
-
import
|
|
7
|
+
import chalk from "chalk";
|
|
8
8
|
|
|
9
9
|
import { assert } from "node-opcua-assert";
|
|
10
10
|
import { AttributeIds } from "node-opcua-data-model";
|