34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
|
import * as plugins from './coreflow.plugins.js';
|
||
|
import { Coreflow } from './coreflow.classes.coreflow.js';
|
||
|
import { logger } from './coreflow.logging.js';
|
||
|
|
||
|
export class CoretrafficConnector {
|
||
|
public coreflowRef: Coreflow;
|
||
|
public readyDeferred = plugins.smartpromise.defer();
|
||
|
|
||
|
constructor(coreflowRefArg: Coreflow) {
|
||
|
this.coreflowRef = coreflowRefArg;
|
||
|
}
|
||
|
|
||
|
public async start() {
|
||
|
// any work necessary to get connected
|
||
|
this.readyDeferred.resolve();
|
||
|
}
|
||
|
|
||
|
public async setReverseConfigs(
|
||
|
reverseConfigsArg: plugins.servezoneInterfaces.data.IReverseProxyConfig[]
|
||
|
) {
|
||
|
await this.start();
|
||
|
const reactionRequest =
|
||
|
this.coreflowRef.internalServer.typedsocketServer.createTypedRequest<plugins.servezoneInterfaces.requests.routing.IRequest_Coreflow_Coretraffic_RoutingUpdate>(
|
||
|
'updateRouting',
|
||
|
await this.coreflowRef.internalServer.typedsocketServer.findTargetConnection(
|
||
|
async (targetConnection) => targetConnection.alias === 'coretraffic'
|
||
|
)
|
||
|
);
|
||
|
const response = await reactionRequest.fire({
|
||
|
reverseConfigs: reverseConfigsArg,
|
||
|
});
|
||
|
}
|
||
|
}
|