node-opcua-server-discovery 2.97.0 → 2.98.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/package.json +12 -12
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -21
- package/dist/index.js.map +0 -1
- package/dist/mdns_responder.d.ts +0 -13
- package/dist/mdns_responder.js +0 -110
- package/dist/mdns_responder.js.map +0 -1
- package/dist/opcua_discovery_server.d.ts +0 -37
- package/dist/opcua_discovery_server.js +0 -459
- package/dist/opcua_discovery_server.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-server-discovery",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.98.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -server-discovery",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
"chalk": "4.1.2",
|
|
14
14
|
"env-paths": "2.2.1",
|
|
15
15
|
"node-opcua-assert": "2.88.0",
|
|
16
|
-
"node-opcua-basic-types": "2.
|
|
17
|
-
"node-opcua-certificate-manager": "2.
|
|
18
|
-
"node-opcua-common": "2.
|
|
19
|
-
"node-opcua-debug": "2.
|
|
16
|
+
"node-opcua-basic-types": "2.98.0",
|
|
17
|
+
"node-opcua-certificate-manager": "2.98.0",
|
|
18
|
+
"node-opcua-common": "2.98.0",
|
|
19
|
+
"node-opcua-debug": "2.98.0",
|
|
20
20
|
"node-opcua-hostname": "2.88.0",
|
|
21
|
-
"node-opcua-object-registry": "2.
|
|
22
|
-
"node-opcua-secure-channel": "2.
|
|
23
|
-
"node-opcua-server": "2.
|
|
24
|
-
"node-opcua-service-discovery": "2.
|
|
25
|
-
"node-opcua-service-endpoints": "2.
|
|
26
|
-
"node-opcua-status-code": "2.
|
|
21
|
+
"node-opcua-object-registry": "2.98.0",
|
|
22
|
+
"node-opcua-secure-channel": "2.98.0",
|
|
23
|
+
"node-opcua-server": "2.98.0",
|
|
24
|
+
"node-opcua-service-discovery": "2.98.0",
|
|
25
|
+
"node-opcua-service-endpoints": "2.98.0",
|
|
26
|
+
"node-opcua-status-code": "2.98.0",
|
|
27
27
|
"sterfive-bonjour-service": "1.1.4",
|
|
28
28
|
"thenify": "^3.3.1"
|
|
29
29
|
},
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"internet of things"
|
|
46
46
|
],
|
|
47
47
|
"homepage": "http://node-opcua.github.io/",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c"
|
|
49
49
|
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/**
|
|
18
|
-
* @module node-opcua-server-discovery
|
|
19
|
-
*/
|
|
20
|
-
__exportStar(require("./opcua_discovery_server"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,2DAAyC"}
|
package/dist/mdns_responder.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ServerOnNetwork } from "node-opcua-service-discovery";
|
|
2
|
-
export declare class MDNSResponder {
|
|
3
|
-
/**
|
|
4
|
-
* the list of servers that have been activated as mDNS service
|
|
5
|
-
*/
|
|
6
|
-
registeredServers: ServerOnNetwork[];
|
|
7
|
-
private multicastDNS;
|
|
8
|
-
private browser;
|
|
9
|
-
private recordId;
|
|
10
|
-
lastUpdateDate: Date;
|
|
11
|
-
constructor();
|
|
12
|
-
dispose(): void;
|
|
13
|
-
}
|
package/dist/mdns_responder.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MDNSResponder = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-server-discovery
|
|
6
|
-
*/
|
|
7
|
-
const sterfive_bonjour_service_1 = require("sterfive-bonjour-service");
|
|
8
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
9
|
-
const node_opcua_object_registry_1 = require("node-opcua-object-registry");
|
|
10
|
-
const node_opcua_service_discovery_1 = require("node-opcua-service-discovery");
|
|
11
|
-
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
12
|
-
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename) || true;
|
|
13
|
-
const registry = new node_opcua_object_registry_1.ObjectRegistry();
|
|
14
|
-
class MDNSResponder {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.lastUpdateDate = new Date();
|
|
17
|
-
registry.register(this);
|
|
18
|
-
this.registeredServers = [];
|
|
19
|
-
this.multicastDNS = new sterfive_bonjour_service_1.Bonjour();
|
|
20
|
-
this.recordId = 0;
|
|
21
|
-
this.browser = this.multicastDNS.find({
|
|
22
|
-
protocol: "tcp",
|
|
23
|
-
type: "opcua-tcp"
|
|
24
|
-
});
|
|
25
|
-
const findServiceIndex = (serverName) => {
|
|
26
|
-
const index = this.registeredServers.findIndex((server) => server.serverName === serverName);
|
|
27
|
-
return index;
|
|
28
|
-
};
|
|
29
|
-
const addService = (service) => {
|
|
30
|
-
if (doDebug) {
|
|
31
|
-
debugLog("adding server ", service.name, "port =", service.port);
|
|
32
|
-
}
|
|
33
|
-
// example:
|
|
34
|
-
// {
|
|
35
|
-
// addresses: [ '172.18.207.145', 'fe80::d4e3:352c:9f8b:d0db' ],
|
|
36
|
-
// rawTxt: <Buffer 05 70 61 74 68 3d 08 63 61 70 73 3d 4c 44 53>,
|
|
37
|
-
// txt: { path: '', caps: 'LDS' },
|
|
38
|
-
// name: 'UA Local Discovery Server on STERFIVEPC2',
|
|
39
|
-
// fqdn: 'UA Local Discovery Server on STERFIVEPC2._opcua-tcp._tcp.local',
|
|
40
|
-
// host: 'STERFIVEPC2.local',
|
|
41
|
-
// referer:
|
|
42
|
-
// {
|
|
43
|
-
// address: '172.18.207.145',
|
|
44
|
-
// family: 'IPv4',
|
|
45
|
-
// port: 5353,
|
|
46
|
-
// size: 363
|
|
47
|
-
// },
|
|
48
|
-
// port: 4840,
|
|
49
|
-
// type: 'opcua-tcp',
|
|
50
|
-
// protocol: 'tcp',
|
|
51
|
-
// subtypes: []
|
|
52
|
-
// },
|
|
53
|
-
const existingIndex = findServiceIndex(service.name);
|
|
54
|
-
if (existingIndex >= 0) {
|
|
55
|
-
debugLog("Ignoring existing server ", service.name);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
this.recordId++;
|
|
59
|
-
const recordId = this.recordId;
|
|
60
|
-
const serverName = service.name;
|
|
61
|
-
service.txt = service.txt || {};
|
|
62
|
-
const service_txt = service.txt;
|
|
63
|
-
service_txt.caps = service_txt.caps || "";
|
|
64
|
-
const serverCapabilities = service_txt.caps
|
|
65
|
-
.split(",")
|
|
66
|
-
.map((x) => x.toUpperCase())
|
|
67
|
-
.sort();
|
|
68
|
-
const path = service_txt.path || "";
|
|
69
|
-
const discoveryUrl = "opc.tcp://" + service.host + ":" + service.port + path;
|
|
70
|
-
this.registeredServers.push(new node_opcua_service_discovery_1.ServerOnNetwork({
|
|
71
|
-
discoveryUrl,
|
|
72
|
-
recordId,
|
|
73
|
-
serverCapabilities,
|
|
74
|
-
serverName
|
|
75
|
-
}));
|
|
76
|
-
this.lastUpdateDate = new Date(Date.now());
|
|
77
|
-
debugLog("a new OPCUA server has been registered on mDNS", service.name, recordId);
|
|
78
|
-
};
|
|
79
|
-
const removeService = (service) => {
|
|
80
|
-
const serverName = service.name;
|
|
81
|
-
debugLog("a OPCUA server has been unregistered in mDNS", serverName);
|
|
82
|
-
const index = findServiceIndex(serverName);
|
|
83
|
-
if (index === -1) {
|
|
84
|
-
debugLog("Cannot find server with name ", serverName, " in registeredServers");
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
this.registeredServers.splice(index, 1); // remove element at index
|
|
88
|
-
this.lastUpdateDate = new Date();
|
|
89
|
-
};
|
|
90
|
-
this.browser.on("up", (service) => {
|
|
91
|
-
if (doDebug) {
|
|
92
|
-
debugLog("MDNSResponder : service is up with ", (0, node_opcua_service_discovery_1.serviceToString)(service));
|
|
93
|
-
}
|
|
94
|
-
addService(service);
|
|
95
|
-
});
|
|
96
|
-
this.browser.on("down", (service) => {
|
|
97
|
-
if (doDebug) {
|
|
98
|
-
debugLog("MDNSResponder : service is down with ", (0, node_opcua_service_discovery_1.serviceToString)(service));
|
|
99
|
-
}
|
|
100
|
-
removeService(service);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
dispose() {
|
|
104
|
-
// yy delete (this as any).multicastDNS;
|
|
105
|
-
this.multicastDNS.destroy();
|
|
106
|
-
registry.unregister(this);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
exports.MDNSResponder = MDNSResponder;
|
|
110
|
-
//# sourceMappingURL=mdns_responder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mdns_responder.js","sourceRoot":"","sources":["../source/mdns_responder.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,uEAAqE;AACrE,uDAAiE;AACjE,2EAA4D;AAC5D,+EAAiF;AAEjF,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,IAAI,IAAI,CAAC;AAEnD,MAAM,QAAQ,GAAG,IAAI,2CAAc,EAAE,CAAC;AAEtC,MAAa,aAAa;IAYtB;QAFO,mBAAc,GAAS,IAAI,IAAI,EAAE,CAAC;QAGrC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAExB,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAE5B,IAAI,CAAC,YAAY,GAAG,IAAI,kCAAO,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAElB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YAClC,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,WAAW;SACpB,CAAC,CAAC;QAEH,MAAM,gBAAgB,GAAG,CAAC,UAAkB,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,MAAuB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;YAC9G,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAEF,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,EAAE;YACpC,IAAI,OAAO,EAAE;gBACT,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,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IAEM,OAAO;QACV,wCAAwC;QACxC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC5B,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ;AAzHD,sCAyHC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-server-discovery
|
|
3
|
-
*/
|
|
4
|
-
import { Message, MessageSecurityMode, Response, SecurityPolicy, ServerSecureChannelLayer } from "node-opcua-secure-channel";
|
|
5
|
-
import { OPCUABaseServer, OPCUABaseServerOptions } from "node-opcua-server";
|
|
6
|
-
import { MdnsDiscoveryConfiguration, RegisteredServer } from "node-opcua-service-discovery";
|
|
7
|
-
import { ApplicationDescription } from "node-opcua-service-endpoints";
|
|
8
|
-
import { ErrorCallback } from "node-opcua-status-code";
|
|
9
|
-
export interface OPCUADiscoveryServerOptions extends OPCUABaseServerOptions {
|
|
10
|
-
certificateFile?: string;
|
|
11
|
-
port?: number;
|
|
12
|
-
alternateHostname?: string[];
|
|
13
|
-
securityPolicies?: SecurityPolicy[];
|
|
14
|
-
securityModes?: MessageSecurityMode[];
|
|
15
|
-
hostname?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare class OPCUADiscoveryServer extends OPCUABaseServer {
|
|
18
|
-
private mDnsResponder?;
|
|
19
|
-
private readonly registeredServers;
|
|
20
|
-
private bonjourHolder;
|
|
21
|
-
private _delayInit?;
|
|
22
|
-
constructor(options: OPCUADiscoveryServerOptions);
|
|
23
|
-
start(): Promise<void>;
|
|
24
|
-
start(callback: ErrorCallback): void;
|
|
25
|
-
shutdown(): Promise<void>;
|
|
26
|
-
shutdown(callback: ErrorCallback): void;
|
|
27
|
-
/**
|
|
28
|
-
* returns the number of registered servers
|
|
29
|
-
*/
|
|
30
|
-
get registeredServerCount(): number;
|
|
31
|
-
getServers(channel: ServerSecureChannelLayer): ApplicationDescription[];
|
|
32
|
-
protected _on_RegisterServer2Request(message: Message, channel: ServerSecureChannelLayer): void;
|
|
33
|
-
protected _on_RegisterServerRequest(message: Message, channel: ServerSecureChannelLayer): void;
|
|
34
|
-
protected _on_FindServersOnNetworkRequest(message: Message, channel: ServerSecureChannelLayer): void;
|
|
35
|
-
protected __internalRegisterServerWithCallback(RegisterServerXResponse: any, rawServer: RegisteredServer, discoveryConfigurations: MdnsDiscoveryConfiguration[] | undefined, callback: (err: Error | null, response?: Response) => void): Promise<void>;
|
|
36
|
-
protected __internalRegisterServer(RegisterServerXResponse: any, rawServer: RegisteredServer, discoveryConfigurations?: MdnsDiscoveryConfiguration[]): Promise<Response>;
|
|
37
|
-
}
|
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module node-opcua-server-discovery
|
|
4
|
-
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.OPCUADiscoveryServer = void 0;
|
|
16
|
-
const os = require("os");
|
|
17
|
-
const path = require("path");
|
|
18
|
-
const url = require("url");
|
|
19
|
-
const util_1 = require("util");
|
|
20
|
-
const chalk = require("chalk");
|
|
21
|
-
const env_paths_1 = require("env-paths");
|
|
22
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
23
|
-
const node_opcua_common_1 = require("node-opcua-common");
|
|
24
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
25
|
-
const node_opcua_secure_channel_1 = require("node-opcua-secure-channel");
|
|
26
|
-
const node_opcua_server_1 = require("node-opcua-server");
|
|
27
|
-
const node_opcua_service_discovery_1 = require("node-opcua-service-discovery");
|
|
28
|
-
const node_opcua_certificate_manager_1 = require("node-opcua-certificate-manager");
|
|
29
|
-
const node_opcua_service_endpoints_1 = require("node-opcua-service-endpoints");
|
|
30
|
-
const node_opcua_service_endpoints_2 = require("node-opcua-service-endpoints");
|
|
31
|
-
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
32
|
-
const mdns_responder_1 = require("./mdns_responder");
|
|
33
|
-
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
34
|
-
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
|
|
35
|
-
function hasCapabilities(serverCapabilities, serverCapabilityFilter) {
|
|
36
|
-
if (serverCapabilities == null) {
|
|
37
|
-
return true; // filter is empty => no filtering should take place
|
|
38
|
-
}
|
|
39
|
-
if (serverCapabilityFilter.length === 0) {
|
|
40
|
-
return true; // filter is empty => no filtering should take place
|
|
41
|
-
}
|
|
42
|
-
return !!serverCapabilities.join(" ").match(serverCapabilityFilter);
|
|
43
|
-
}
|
|
44
|
-
const defaultProductUri = "NodeOPCUA-LocalDiscoveryServer";
|
|
45
|
-
const defaultApplicationUri = (0, node_opcua_common_1.makeApplicationUrn)(os.hostname(), defaultProductUri);
|
|
46
|
-
function getDefaultCertificateManager() {
|
|
47
|
-
const config = (0, env_paths_1.default)(defaultProductUri).config;
|
|
48
|
-
return new node_opcua_certificate_manager_1.OPCUACertificateManager({
|
|
49
|
-
name: "PKI",
|
|
50
|
-
rootFolder: path.join(config, "PKI"),
|
|
51
|
-
automaticallyAcceptUnknownCertificate: true
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
55
|
-
constructor(options) {
|
|
56
|
-
options.serverInfo = options.serverInfo || {};
|
|
57
|
-
const serverInfo = options.serverInfo;
|
|
58
|
-
serverInfo.applicationType = node_opcua_service_endpoints_2.ApplicationType.DiscoveryServer;
|
|
59
|
-
serverInfo.applicationUri = serverInfo.applicationUri || defaultApplicationUri;
|
|
60
|
-
serverInfo.productUri = serverInfo.productUri || defaultProductUri;
|
|
61
|
-
serverInfo.applicationName = serverInfo.applicationName || {
|
|
62
|
-
text: defaultProductUri,
|
|
63
|
-
locale: null
|
|
64
|
-
};
|
|
65
|
-
serverInfo.gatewayServerUri = serverInfo.gatewayServerUri || "";
|
|
66
|
-
serverInfo.discoveryProfileUri = serverInfo.discoveryProfileUri || "";
|
|
67
|
-
serverInfo.discoveryUrls = serverInfo.discoveryUrls || [];
|
|
68
|
-
options.serverCertificateManager = options.serverCertificateManager || getDefaultCertificateManager();
|
|
69
|
-
super(options);
|
|
70
|
-
this.bonjourHolder = new node_opcua_service_discovery_1.BonjourHolder();
|
|
71
|
-
// see OPC UA Spec 1.2 part 6 : 7.4 Well Known Addresses
|
|
72
|
-
// opc.tcp://localhost:4840/UADiscovery
|
|
73
|
-
const port = options.port || 4840;
|
|
74
|
-
this.capabilitiesForMDNS = ["LDS"];
|
|
75
|
-
this.registeredServers = {};
|
|
76
|
-
this.mDnsResponder = undefined;
|
|
77
|
-
this._delayInit = () => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const endPoint = new node_opcua_server_1.OPCUAServerEndPoint({
|
|
79
|
-
port,
|
|
80
|
-
certificateChain: this.getCertificateChain(),
|
|
81
|
-
certificateManager: this.serverCertificateManager,
|
|
82
|
-
privateKey: this.getPrivateKey(),
|
|
83
|
-
serverInfo: this.serverInfo
|
|
84
|
-
});
|
|
85
|
-
const options1 = {
|
|
86
|
-
allowAnonymous: true,
|
|
87
|
-
securityModes: options.securityModes,
|
|
88
|
-
securityPolicies: options.securityPolicies,
|
|
89
|
-
userTokenTypes: [],
|
|
90
|
-
hostname: options.hostname,
|
|
91
|
-
alternateHostname: options.alternateHostname,
|
|
92
|
-
disableDiscovery: true,
|
|
93
|
-
};
|
|
94
|
-
endPoint.addStandardEndpointDescriptions(options1);
|
|
95
|
-
this.endpoints.push(endPoint);
|
|
96
|
-
endPoint.on("message", (message, channel) => {
|
|
97
|
-
this.on_request(message, channel);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
start(callback) {
|
|
102
|
-
(0, node_opcua_assert_1.assert)(!this.mDnsResponder);
|
|
103
|
-
(0, node_opcua_assert_1.assert)(Array.isArray(this.capabilitiesForMDNS));
|
|
104
|
-
this._preInitTask.push(() => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
yield this._delayInit();
|
|
106
|
-
}));
|
|
107
|
-
super.start((err) => {
|
|
108
|
-
if (err) {
|
|
109
|
-
return callback(err);
|
|
110
|
-
}
|
|
111
|
-
this.mDnsResponder = new mdns_responder_1.MDNSResponder();
|
|
112
|
-
// declare discovery server in bonjour
|
|
113
|
-
this.bonjourHolder.announcedOnMulticastSubnetWithCallback({
|
|
114
|
-
capabilities: this.capabilitiesForMDNS,
|
|
115
|
-
name: this.serverInfo.applicationUri,
|
|
116
|
-
path: "/DiscoveryServer",
|
|
117
|
-
port: this.endpoints[0].port
|
|
118
|
-
}, (err2) => {
|
|
119
|
-
callback(err2);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
shutdown(callback) {
|
|
124
|
-
debugLog("stopping announcement of LDS on mDNS");
|
|
125
|
-
if (this.mDnsResponder) {
|
|
126
|
-
this.mDnsResponder.dispose();
|
|
127
|
-
this.mDnsResponder = undefined;
|
|
128
|
-
}
|
|
129
|
-
this.bonjourHolder.stopAnnouncedOnMulticastSubnetWithCallback((err) => {
|
|
130
|
-
if (err) {
|
|
131
|
-
console.log("Error ", err.message);
|
|
132
|
-
}
|
|
133
|
-
debugLog("stopping announcement of LDS on mDNS - DONE");
|
|
134
|
-
debugLog("Shutting down Discovery Server");
|
|
135
|
-
super.shutdown(() => {
|
|
136
|
-
setTimeout(() => {
|
|
137
|
-
callback();
|
|
138
|
-
}, 100);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* returns the number of registered servers
|
|
144
|
-
*/
|
|
145
|
-
get registeredServerCount() {
|
|
146
|
-
return Object.keys(this.registeredServers).length;
|
|
147
|
-
}
|
|
148
|
-
getServers(channel) {
|
|
149
|
-
this.serverInfo.discoveryUrls = this.getDiscoveryUrls();
|
|
150
|
-
const servers = [this.serverInfo];
|
|
151
|
-
for (const registered_server of Object.values(this.registeredServers)) {
|
|
152
|
-
const serverInfo = new node_opcua_service_endpoints_1.ApplicationDescription(registered_server.serverInfo);
|
|
153
|
-
servers.push(serverInfo);
|
|
154
|
-
}
|
|
155
|
-
return servers;
|
|
156
|
-
}
|
|
157
|
-
_on_RegisterServer2Request(message, channel) {
|
|
158
|
-
(0, node_opcua_assert_1.assert)(message.request instanceof node_opcua_service_discovery_1.RegisterServer2Request);
|
|
159
|
-
const request = message.request;
|
|
160
|
-
(0, node_opcua_assert_1.assert)(request.schema.name === "RegisterServer2Request");
|
|
161
|
-
request.discoveryConfiguration = request.discoveryConfiguration || [];
|
|
162
|
-
this.__internalRegisterServerWithCallback(node_opcua_service_discovery_1.RegisterServer2Response, request.server, request.discoveryConfiguration, (err, response) => {
|
|
163
|
-
// istanbul ignore next
|
|
164
|
-
if (err) {
|
|
165
|
-
// tslint:disable-next-line: no-console
|
|
166
|
-
console.log("What shall I do ?", err.message);
|
|
167
|
-
// tslint:disable-next-line: no-console
|
|
168
|
-
console.log(err);
|
|
169
|
-
let additional_messages = [];
|
|
170
|
-
additional_messages.push("EXCEPTION CAUGHT WHILE PROCESSING REQUEST !!! " + request.schema.name);
|
|
171
|
-
additional_messages.push(err.message);
|
|
172
|
-
if (err.stack) {
|
|
173
|
-
additional_messages = additional_messages.concat(err.stack.split("\n"));
|
|
174
|
-
}
|
|
175
|
-
response = OPCUADiscoveryServer.makeServiceFault(node_opcua_status_code_1.StatusCodes.BadInternalError, additional_messages);
|
|
176
|
-
channel.send_response("MSG", response, message);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
channel.send_response("MSG", response, message);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
_on_RegisterServerRequest(message, channel) {
|
|
184
|
-
(0, node_opcua_assert_1.assert)(message.request instanceof node_opcua_service_discovery_1.RegisterServerRequest);
|
|
185
|
-
const request = message.request;
|
|
186
|
-
(0, node_opcua_assert_1.assert)(request.schema.name === "RegisterServerRequest");
|
|
187
|
-
this.__internalRegisterServerWithCallback(node_opcua_service_discovery_1.RegisterServerResponse, request.server, undefined, (err, response) => {
|
|
188
|
-
channel.send_response("MSG", response, message);
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
_on_FindServersOnNetworkRequest(message, channel) {
|
|
192
|
-
// from OPCUA 1.04 part 4
|
|
193
|
-
// This Service returns the Servers known to a Discovery Server. Unlike FindServer, this Service is
|
|
194
|
-
// only implemented by Discovery Servers.
|
|
195
|
-
// The Client may reduce the number of results returned by specifying filter criteria. An empty list is
|
|
196
|
-
// returned if no Server matches the criteria specified by the Client.
|
|
197
|
-
// This Service shall not require message security but it may require transport layer security.
|
|
198
|
-
// Each time the Discovery Server creates or updates a record in its cache it shall assign a
|
|
199
|
-
// monotonically increasing identifier to the record. This allows Clients to request records in batches
|
|
200
|
-
// by specifying the identifier for the last record received in the last call to FindServersOnNetwork.
|
|
201
|
-
// To support this the Discovery Server shall return records in numerical order starting from the
|
|
202
|
-
// lowest record identifier. The Discovery Server shall also return the last time the counter was reset
|
|
203
|
-
// for example due to a restart of the Discovery Server. If a Client detects that this time is more
|
|
204
|
-
// recent than the last time the Client called the Service it shall call the Service again with a
|
|
205
|
-
// startingRecordId of 0.
|
|
206
|
-
// This Service can be used without security and it is therefore vulnerable to Denial Of Service
|
|
207
|
-
// (DOS) attacks. A Server should minimize the amount of processing required to send the response
|
|
208
|
-
// for this Service. This can be achieved by preparing the result in advance
|
|
209
|
-
(0, node_opcua_assert_1.assert)(message.request instanceof node_opcua_service_discovery_1.FindServersOnNetworkRequest);
|
|
210
|
-
const request = message.request;
|
|
211
|
-
(0, node_opcua_assert_1.assert)(request.schema.name === "FindServersOnNetworkRequest");
|
|
212
|
-
function sendError(statusCode) {
|
|
213
|
-
const response1 = new node_opcua_service_discovery_1.FindServersOnNetworkResponse({ responseHeader: { serviceResult: statusCode } });
|
|
214
|
-
return channel.send_response("MSG", response1, message);
|
|
215
|
-
}
|
|
216
|
-
// startingRecordId Counter Only records with an identifier greater than this number will be
|
|
217
|
-
// returned.
|
|
218
|
-
// Specify 0 to start with the first record in the cache.
|
|
219
|
-
// maxRecordsToReturn UInt32 The maximum number of records to return in the response.
|
|
220
|
-
// 0 indicates that there is no limit.
|
|
221
|
-
// serverCapabilityFilter[] String List of Server capability filters. The set of allowed server capabilities
|
|
222
|
-
// are defined in Part 12.
|
|
223
|
-
// Only records with all of the specified server capabilities are
|
|
224
|
-
// returned.
|
|
225
|
-
// The comparison is case insensitive.
|
|
226
|
-
// If this list is empty then no filtering is performed
|
|
227
|
-
// ------------------------
|
|
228
|
-
// The last time the counters were reset.
|
|
229
|
-
const lastCounterResetTime = new Date();
|
|
230
|
-
// servers[] ServerOnNetwork List of DNS service records that meet criteria specified in the
|
|
231
|
-
// request. This list is empty if no Servers meet the criteria
|
|
232
|
-
const servers = [];
|
|
233
|
-
request.serverCapabilityFilter = request.serverCapabilityFilter || [];
|
|
234
|
-
const serverCapabilityFilter = request.serverCapabilityFilter
|
|
235
|
-
.map((x) => x.toUpperCase())
|
|
236
|
-
.sort()
|
|
237
|
-
.join(" ");
|
|
238
|
-
debugLog(" startingRecordId = ", request.startingRecordId);
|
|
239
|
-
if (this.mDnsResponder) {
|
|
240
|
-
for (const server of this.mDnsResponder.registeredServers) {
|
|
241
|
-
debugLog("Exploring server ", server.serverName);
|
|
242
|
-
if (server.recordId <= request.startingRecordId) {
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
if (!hasCapabilities(server.serverCapabilities, serverCapabilityFilter)) {
|
|
246
|
-
// istanbul ignore next
|
|
247
|
-
if (doDebug) {
|
|
248
|
-
debugLog(" server ", server.serverName, server.serverCapabilities ? server.serverCapabilities.join(",") : [], " does not match serverCapabilities ", serverCapabilityFilter);
|
|
249
|
-
}
|
|
250
|
-
continue;
|
|
251
|
-
}
|
|
252
|
-
debugLog(" server ", server.serverName, " found");
|
|
253
|
-
servers.push(server);
|
|
254
|
-
if (servers.length === request.maxRecordsToReturn) {
|
|
255
|
-
debugLog("max records to return reached", request.maxRecordsToReturn);
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
const response = new node_opcua_service_discovery_1.FindServersOnNetworkResponse({
|
|
261
|
-
lastCounterResetTime,
|
|
262
|
-
servers
|
|
263
|
-
});
|
|
264
|
-
channel.send_response("MSG", response, message);
|
|
265
|
-
}
|
|
266
|
-
__internalRegisterServerWithCallback(RegisterServerXResponse /* RegisterServer2Response | RegisterServerResponse */, rawServer, discoveryConfigurations, callback) {
|
|
267
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
-
// istanbul ignore next
|
|
269
|
-
callback(new Error("internal Error"));
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
// eslint-disable-next-line max-statements
|
|
273
|
-
__internalRegisterServer(RegisterServerXResponse /* RegisterServer2Response | RegisterServerResponse */, rawServer, discoveryConfigurations) {
|
|
274
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
275
|
-
const server = rawServer;
|
|
276
|
-
if (!discoveryConfigurations) {
|
|
277
|
-
discoveryConfigurations = [
|
|
278
|
-
new node_opcua_service_discovery_1.MdnsDiscoveryConfiguration({
|
|
279
|
-
mdnsServerName: undefined,
|
|
280
|
-
serverCapabilities: ["NA"]
|
|
281
|
-
})
|
|
282
|
-
];
|
|
283
|
-
}
|
|
284
|
-
function sendError(statusCode) {
|
|
285
|
-
debugLog(chalk.red("_on_RegisterServer(2)Request error"), statusCode.toString());
|
|
286
|
-
const response1 = new node_opcua_secure_channel_1.ServiceFault({
|
|
287
|
-
responseHeader: { serviceResult: statusCode }
|
|
288
|
-
});
|
|
289
|
-
return response1;
|
|
290
|
-
}
|
|
291
|
-
function _stop_announcedOnMulticastSubnet(conf) {
|
|
292
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
-
const b = conf.bonjourHolder;
|
|
294
|
-
yield b.stopAnnnouncedOnMulticastSubnet();
|
|
295
|
-
conf.bonjourHolder = undefined;
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
function _announcedOnMulticastSubnet(conf, announcement) {
|
|
299
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
300
|
-
const serviceConfig = (0, node_opcua_service_discovery_1.announcementToServiceConfig)(announcement);
|
|
301
|
-
let b = conf.bonjourHolder;
|
|
302
|
-
if (b && b.serviceConfig) {
|
|
303
|
-
if ((0, node_opcua_service_discovery_1.sameService)(b.serviceConfig, serviceConfig)) {
|
|
304
|
-
debugLog("Configuration ", conf.mdnsServerName, " has not changed !");
|
|
305
|
-
// nothing to do
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
// istanbul ignore next
|
|
310
|
-
if (doDebug) {
|
|
311
|
-
debugLog("Configuration ", conf.mdnsServerName, " HAS changed !");
|
|
312
|
-
debugLog(" Was ", (0, node_opcua_service_discovery_1.serviceToString)(b.serviceConfig));
|
|
313
|
-
debugLog(" is ", announcement);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
yield _stop_announcedOnMulticastSubnet(conf);
|
|
317
|
-
}
|
|
318
|
-
b = new node_opcua_service_discovery_1.BonjourHolder();
|
|
319
|
-
conf.bonjourHolder = b;
|
|
320
|
-
yield b.announcedOnMulticastSubnet(announcement);
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
function dealWithDiscoveryConfiguration(previousConfMap, server1, serverInfo, discoveryConfiguration) {
|
|
324
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
-
// mdnsServerName String The name of the Server when it is announced via mDNS.
|
|
326
|
-
// See Part 12 for the details about mDNS. This string shall be less than 64 bytes.
|
|
327
|
-
// If not specified the first element of the serverNames array is used
|
|
328
|
-
// (truncated to 63 bytes if necessary).
|
|
329
|
-
// serverCapabilities [] String The set of Server capabilities supported by the Server.
|
|
330
|
-
// A Server capability is a short identifier for a feature
|
|
331
|
-
// The set of allowed Server capabilities are defined in Part 12.
|
|
332
|
-
discoveryConfiguration.mdnsServerName = discoveryConfiguration.mdnsServerName || server1.serverNames[0].text;
|
|
333
|
-
serverInfo.discoveryUrls = serverInfo.discoveryUrls || [];
|
|
334
|
-
const endpointUrl = serverInfo.discoveryUrls[0];
|
|
335
|
-
const parsedUrl = url.parse(endpointUrl);
|
|
336
|
-
discoveryConfiguration.serverCapabilities = discoveryConfiguration.serverCapabilities || [];
|
|
337
|
-
const announcement = {
|
|
338
|
-
capabilities: discoveryConfiguration.serverCapabilities.map((x) => x) || ["DA"],
|
|
339
|
-
name: discoveryConfiguration.mdnsServerName,
|
|
340
|
-
path: parsedUrl.pathname || "/",
|
|
341
|
-
port: parseInt(parsedUrl.port, 10)
|
|
342
|
-
};
|
|
343
|
-
if (previousConfMap[discoveryConfiguration.mdnsServerName]) {
|
|
344
|
-
// configuration already exists
|
|
345
|
-
debugLog("Configuration ", discoveryConfiguration.mdnsServerName, " already exists !");
|
|
346
|
-
const prevConf = previousConfMap[discoveryConfiguration.mdnsServerName];
|
|
347
|
-
delete previousConfMap[discoveryConfiguration.mdnsServerName];
|
|
348
|
-
discoveryConfiguration.bonjourHolder = prevConf.bonjourHolder;
|
|
349
|
-
}
|
|
350
|
-
// let's announce the server on the multicast DNS
|
|
351
|
-
yield _announcedOnMulticastSubnet(discoveryConfiguration, announcement);
|
|
352
|
-
return node_opcua_status_code_1.StatusCodes.Good;
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
// check serverType is valid
|
|
356
|
-
if (!_isValidServerType(server.serverType)) {
|
|
357
|
-
debugLog("Invalid server Type", node_opcua_service_endpoints_2.ApplicationType[server.serverType]);
|
|
358
|
-
return sendError(node_opcua_status_code_1.StatusCodes.BadInvalidArgument);
|
|
359
|
-
}
|
|
360
|
-
if (!server.serverUri) {
|
|
361
|
-
debugLog("Missing serverURI");
|
|
362
|
-
return sendError(node_opcua_status_code_1.StatusCodes.BadInvalidArgument);
|
|
363
|
-
}
|
|
364
|
-
// BadServerUriInvalid
|
|
365
|
-
// TODO
|
|
366
|
-
server.serverNames = server.serverNames || [];
|
|
367
|
-
// BadServerNameMissing
|
|
368
|
-
if (server.serverNames.length === 0 || !server.serverNames[0].text) {
|
|
369
|
-
return sendError(node_opcua_status_code_1.StatusCodes.BadServerNameMissing);
|
|
370
|
-
}
|
|
371
|
-
// BadDiscoveryUrlMissing
|
|
372
|
-
server.discoveryUrls = server.discoveryUrls || [];
|
|
373
|
-
if (server.discoveryUrls.length === 0 || !server.discoveryUrls[0]) {
|
|
374
|
-
return sendError(node_opcua_status_code_1.StatusCodes.BadDiscoveryUrlMissing);
|
|
375
|
-
}
|
|
376
|
-
const key = server.serverUri;
|
|
377
|
-
let configurationResults = null;
|
|
378
|
-
if (server.isOnline) {
|
|
379
|
-
debugLog(chalk.cyan(" registering server : "), chalk.yellow(server.serverUri));
|
|
380
|
-
// prepare serverInfo which will be used by FindServers
|
|
381
|
-
const serverInfo = {
|
|
382
|
-
applicationName: server.serverNames[0],
|
|
383
|
-
applicationType: server.serverType,
|
|
384
|
-
applicationUri: server.serverUri,
|
|
385
|
-
discoveryUrls: server.discoveryUrls,
|
|
386
|
-
gatewayServerUri: server.gatewayServerUri,
|
|
387
|
-
productUri: server.productUri
|
|
388
|
-
// XXX ?????? serverInfo.discoveryProfileUri = serverInfo.discoveryProfileUri;
|
|
389
|
-
};
|
|
390
|
-
const previousConfMap = [];
|
|
391
|
-
if (this.registeredServers[key]) {
|
|
392
|
-
// server already exists and must only be updated
|
|
393
|
-
const previousServer = this.registeredServers[key];
|
|
394
|
-
for (const conf of previousServer.discoveryConfiguration) {
|
|
395
|
-
previousConfMap[conf.mdnsServerName] = conf;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
this.registeredServers[key] = server;
|
|
399
|
-
// xx server.semaphoreFilePath = server.semaphoreFilePath;
|
|
400
|
-
// xx server.serverNames = server.serverNames;
|
|
401
|
-
server.serverInfo = serverInfo;
|
|
402
|
-
server.discoveryConfiguration = discoveryConfigurations;
|
|
403
|
-
(0, node_opcua_assert_1.assert)(discoveryConfigurations);
|
|
404
|
-
configurationResults = [];
|
|
405
|
-
for (const conf of discoveryConfigurations) {
|
|
406
|
-
const statusCode = yield dealWithDiscoveryConfiguration(previousConfMap, server, serverInfo, conf);
|
|
407
|
-
configurationResults.push(statusCode);
|
|
408
|
-
}
|
|
409
|
-
// now also unregister unprocessed
|
|
410
|
-
if (Object.keys(previousConfMap).length !== 0) {
|
|
411
|
-
debugLog(" Warning some conf need to be removed !");
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
// server is announced offline
|
|
416
|
-
if (key in this.registeredServers) {
|
|
417
|
-
const server1 = this.registeredServers[key];
|
|
418
|
-
debugLog(chalk.cyan("unregistering server : "), chalk.yellow(server1.serverUri));
|
|
419
|
-
configurationResults = [];
|
|
420
|
-
discoveryConfigurations = server1.discoveryConfiguration || [];
|
|
421
|
-
for (const conf of discoveryConfigurations) {
|
|
422
|
-
yield _stop_announcedOnMulticastSubnet(conf);
|
|
423
|
-
configurationResults.push(node_opcua_status_code_1.StatusCodes.Good);
|
|
424
|
-
}
|
|
425
|
-
delete this.registeredServers[key];
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
const response = new RegisterServerXResponse({
|
|
429
|
-
configurationResults
|
|
430
|
-
});
|
|
431
|
-
return response;
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
exports.OPCUADiscoveryServer = OPCUADiscoveryServer;
|
|
436
|
-
/*== private
|
|
437
|
-
* returns true if the serverType can be added to a discovery server.
|
|
438
|
-
* @param serverType
|
|
439
|
-
* @return {boolean}
|
|
440
|
-
* @private
|
|
441
|
-
*/
|
|
442
|
-
function _isValidServerType(serverType) {
|
|
443
|
-
switch (serverType) {
|
|
444
|
-
case node_opcua_service_endpoints_2.ApplicationType.Client:
|
|
445
|
-
return false;
|
|
446
|
-
case node_opcua_service_endpoints_2.ApplicationType.Server:
|
|
447
|
-
case node_opcua_service_endpoints_2.ApplicationType.ClientAndServer:
|
|
448
|
-
case node_opcua_service_endpoints_2.ApplicationType.DiscoveryServer:
|
|
449
|
-
return true;
|
|
450
|
-
}
|
|
451
|
-
return false;
|
|
452
|
-
}
|
|
453
|
-
OPCUADiscoveryServer.prototype.__internalRegisterServerWithCallback = (0, util_1.callbackify)(OPCUADiscoveryServer.prototype.__internalRegisterServer);
|
|
454
|
-
// tslint:disable-next-line: no-var-requires
|
|
455
|
-
const thenify = require("thenify");
|
|
456
|
-
const opts = { multiArgs: false };
|
|
457
|
-
OPCUADiscoveryServer.prototype.start = thenify.withCallback(OPCUADiscoveryServer.prototype.start, opts);
|
|
458
|
-
OPCUADiscoveryServer.prototype.shutdown = thenify.withCallback(OPCUADiscoveryServer.prototype.shutdown, opts);
|
|
459
|
-
//# sourceMappingURL=opcua_discovery_server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opcua_discovery_server.js","sourceRoot":"","sources":["../source/opcua_discovery_server.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,2BAA2B;AAC3B,+BAAmC;AAEnC,+BAA+B;AAC/B,yCAAiC;AAEjC,yDAA2C;AAE3C,yDAAuD;AACvD,uDAAiE;AACjE,yEAA2I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