This commit is contained in:
2025-09-05 14:10:35 +00:00
parent 8785536950
commit e78509ea4f
3 changed files with 1010 additions and 1054 deletions

View File

@@ -159,7 +159,7 @@ export class DcRouter {
this.opsServer = new OpsServer(this);
// await this.opsServer.start();
await this.opsServer.start();
try {
// Initialize MetricsManager
@@ -507,28 +507,32 @@ export class DcRouter {
// Add email domain-based routes if configured
if (emailConfig.routes) {
for (const route of emailConfig.routes) {
const domains = route.match.recipients ?
extractDomainsFromRecipients(route.match.recipients) : [];
// Only create SmartProxy route if we have domains to match
if (domains.length > 0) {
emailRoutes.push({
name: route.name,
match: {
ports: emailConfig.ports,
domains: domains
},
action: {
type: 'forward' as TRouteActionType,
targets: route.action.type === 'forward' && route.action.forward ? [{
host: route.action.forward.host,
port: route.action.forward.port || 25
}] : [],
tls: {
mode: 'passthrough' as TTlsMode
// Only create SmartProxy routes for forward actions
// Other email actions (deliver, process, reject) are handled internally by the email server
if (route.action.type === 'forward' && route.action.forward) {
const domains = route.match.recipients ?
extractDomainsFromRecipients(route.match.recipients) : [];
// Only create SmartProxy route if we have domains to match
if (domains.length > 0) {
emailRoutes.push({
name: route.name,
match: {
ports: emailConfig.ports,
domains: domains
},
action: {
type: 'forward' as TRouteActionType,
targets: [{
host: route.action.forward.host,
port: route.action.forward.port || 25
}],
tls: {
mode: 'passthrough' as TTlsMode
}
}
}
});
});
}
}
}
}