fix(config): Update dns config interface within DcRouter
This commit is contained in:
parent
ad0ab6c103
commit
eb26a62a87
@ -53,12 +53,26 @@ export interface IDcRouterOptions {
|
||||
caPath?: string;
|
||||
};
|
||||
|
||||
/** DNS server configuration */
|
||||
dnsServerConfig?: plugins.smartdns.dnsServerMod.IDnsServerOptions;
|
||||
|
||||
/** DNS domain for automatic DNS server setup with DoH */
|
||||
/**
|
||||
* DNS domain for automatic DNS server setup with DoH
|
||||
* When set, DNS server will:
|
||||
* - Always bind to UDP port 53 on the VM's IP address
|
||||
* - Use socket-handler approach for DNS-over-HTTPS
|
||||
* - Automatically handle NS delegation validation
|
||||
*/
|
||||
dnsDomain?: string;
|
||||
|
||||
/**
|
||||
* DNS records to register when using dnsDomain
|
||||
* These are in addition to auto-generated records from email domains with internal-dns mode
|
||||
*/
|
||||
dnsRecords?: Array<{
|
||||
name: string;
|
||||
type: 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS' | 'SOA';
|
||||
value: string;
|
||||
ttl?: number;
|
||||
}>;
|
||||
|
||||
/** DNS challenge configuration for ACME (optional) */
|
||||
dnsChallenge?: {
|
||||
/** Cloudflare API key for DNS challenges */
|
||||
@ -128,18 +142,6 @@ export class DcRouter {
|
||||
// Set up DNS server if configured by dnsDomain
|
||||
if (this.options.dnsDomain) {
|
||||
await this.setupDnsWithSocketHandler();
|
||||
} else if (this.options.dnsServerConfig) {
|
||||
// Legacy DNS server setup
|
||||
const { records, ...dnsServerOptions } = this.options.dnsServerConfig as any;
|
||||
this.dnsServer = new plugins.smartdns.dnsServerMod.DnsServer(dnsServerOptions);
|
||||
|
||||
// Register DNS record handlers if records provided
|
||||
if (records && records.length > 0) {
|
||||
this.registerDnsRecords(records);
|
||||
}
|
||||
|
||||
await this.dnsServer.start();
|
||||
console.log(`DNS server started on UDP port ${dnsServerOptions.udpPort || 53}`);
|
||||
}
|
||||
|
||||
console.log('DcRouter started successfully');
|
||||
@ -768,6 +770,12 @@ export class DcRouter {
|
||||
// Start the DNS server (UDP only)
|
||||
await this.dnsServer.start();
|
||||
logger.log('info', `DNS server started on UDP ${vmIpAddress}:53`);
|
||||
|
||||
// Register DNS records if provided
|
||||
if (this.options.dnsRecords && this.options.dnsRecords.length > 0) {
|
||||
this.registerDnsRecords(this.options.dnsRecords);
|
||||
logger.log('info', `Registered ${this.options.dnsRecords.length} DNS records`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user