feat(remoteingress): add ability to generate remote ingress connection tokens and UI copy action; add hubDomain config option; update remoteingress dependency to ^3.1.1

This commit is contained in:
2026-02-18 06:05:46 +00:00
parent b21f3385e1
commit 0618755236
10 changed files with 113 additions and 8 deletions

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/dcrouter',
version: '6.10.0',
version: '6.11.0',
description: 'A multifaceted routing service handling mail and SMS delivery functions.'
}

View File

@@ -166,6 +166,8 @@ export interface IDcRouterOptions {
enabled?: boolean;
/** Port for tunnel connections from edge nodes (default: 8443) */
tunnelPort?: number;
/** External hostname of this hub, embedded in connection tokens */
hubDomain?: string;
/** TLS configuration for the tunnel server */
tls?: {
certPath?: string;

View File

@@ -177,5 +177,46 @@ export class RemoteIngressHandler {
},
),
);
// Get a connection token for an edge
this.typedrouter.addTypedHandler(
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_GetRemoteIngressConnectionToken>(
'getRemoteIngressConnectionToken',
async (dataArg, toolsArg) => {
const manager = this.opsServerRef.dcRouterRef.remoteIngressManager;
if (!manager) {
return { success: false, message: 'RemoteIngress not configured' };
}
const edge = manager.getEdge(dataArg.edgeId);
if (!edge) {
return { success: false, message: 'Edge not found' };
}
if (!edge.enabled) {
return { success: false, message: 'Edge is disabled' };
}
const hubHost = dataArg.hubHost
|| this.opsServerRef.dcRouterRef.options.remoteIngressConfig?.hubDomain;
if (!hubHost) {
return {
success: false,
message: 'No hub hostname configured. Set hubDomain in remoteIngressConfig or provide hubHost.',
};
}
const hubPort = this.opsServerRef.dcRouterRef.options.remoteIngressConfig?.tunnelPort ?? 8443;
const token = plugins.remoteingress.encodeConnectionToken({
hubHost,
hubPort,
edgeId: edge.id,
secret: edge.secret,
});
return { success: true, token };
},
),
);
}
}