Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
): Promise {
let b = ((conf as any).bonjourHolder) as BonjourHolder;
if (b) {
if (sameAnnouncement(b.announcement!, announcement)) {
debugLog("Configuration ", conf.mdnsServerName, " has not changed !");
// nothing to do
return;
} else {
debugLog("Configuration ", conf.mdnsServerName, " HAS changed !");
debugLog(" Was ", b.announcement!);
debugLog(" is ", announcement);
}
await _stop_announcedOnMulticastSubnet(conf);
}
b = new BonjourHolder();
((conf as any).bonjourHolder) = b;
await b._announcedOnMulticastSubnet(announcement);
}
const defaultApplicationUri = makeApplicationUrn("%FQDN%", "NodeOPCUA-DiscoveryServer");
options.serverInfo = options.serverInfo || {};
const serverInfo = options.serverInfo;
serverInfo.applicationType = ApplicationType.DiscoveryServer;
serverInfo.applicationUri = serverInfo.applicationUri || defaultApplicationUri;
serverInfo.productUri = serverInfo.productUri || "NodeOPCUA-DiscoveryServer";
serverInfo.applicationName = serverInfo.applicationName || { text: "NodeOPCUA-DiscoveryServer", locale: null };
serverInfo.gatewayServerUri = serverInfo.gatewayServerUri || "";
serverInfo.discoveryProfileUri = serverInfo.discoveryProfileUri || "";
serverInfo.discoveryUrls = serverInfo.discoveryUrls || [];
super(options);
this.bonjourHolder = new BonjourHolder();
const port = options.port || 4840;
this.capabilitiesForMDNS = ["LDS"];
this.registeredServers = {};
this.mDnsResponder = undefined;
// see OPC UA Spec 1.2 part 6 : 7.4 Well Known Addresses
// opc.tcp://localhost:4840/UADiscovery
this._delayInit = () => {
const endPoint = new OPCUAServerEndPoint({
port,
certificateChain: this.getCertificateChain(),
constructor(options: any) {
super();
this.server = options.server;
assert(this.server);
assert(this.server instanceof OPCUABaseServer);
this.bonjour = new BonjourHolder();
}