feat(http3): add automatic HTTP/3 route augmentation for qualifying HTTPS routes

This commit is contained in:
2026-03-19 19:06:15 +00:00
parent 6d4e30e8a9
commit c7de3873d8
11 changed files with 503 additions and 10 deletions

View File

@@ -24,6 +24,7 @@ import { RadiusServer, type IRadiusServerConfig } from './radius/index.js';
import { RemoteIngressManager, TunnelManager } from './remoteingress/index.js';
import { RouteConfigManager, ApiTokenManager } from './config/index.js';
import { SecurityLogger, ContentScanner, IPReputationChecker } from './security/index.js';
import { type IHttp3Config, augmentRoutesWithHttp3 } from './http3/index.js';
export interface IDcRouterOptions {
/** Base directory for all dcrouter data. Defaults to ~/.serve.zone/dcrouter */
@@ -163,6 +164,14 @@ export interface IDcRouterOptions {
* Remote Ingress configuration for edge tunnel nodes
* Enables edge nodes to accept incoming connections and tunnel them to this DcRouter
*/
/**
* HTTP/3 (QUIC) configuration for HTTPS routes.
* Enabled by default — qualifying HTTPS routes on port 443 are automatically
* augmented with QUIC/H3 fields. Set { enabled: false } to disable globally.
* Individual routes can opt out via action.options.http3 = false.
*/
http3?: IHttp3Config;
/** Port for the OpsServer web UI (default: 3000) */
opsServerPort?: number;
@@ -297,6 +306,7 @@ export class DcRouter {
this.storageManager,
() => this.getConstructorRoutes(),
() => this.smartProxy,
() => this.options.http3,
);
this.apiTokenManager = new ApiTokenManager(this.storageManager);
await this.apiTokenManager.initialize();
@@ -469,6 +479,13 @@ export class DcRouter {
challengeHandlers.push(dns01Handler);
}
// HTTP/3 augmentation (enabled by default unless explicitly disabled)
if (this.options.http3?.enabled !== false) {
const http3Config: IHttp3Config = { enabled: true, ...this.options.http3 };
routes = augmentRoutesWithHttp3(routes, http3Config);
logger.log('info', 'HTTP/3: Augmented qualifying HTTPS routes with QUIC/H3 configuration');
}
// Cache constructor routes for RouteConfigManager
this.constructorRoutes = [...routes];