@serve.zone/dcrouter 11.14.0 → 11.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist_serve/bundle.js +5 -9
  2. package/dist_ts/00_commitinfo_data.d.ts +8 -0
  3. package/dist_ts/00_commitinfo_data.js +9 -0
  4. package/dist_ts/cache/classes.cache.cleaner.d.ts +47 -0
  5. package/dist_ts/cache/classes.cache.cleaner.js +130 -0
  6. package/dist_ts/cache/classes.cached.document.d.ts +76 -0
  7. package/dist_ts/cache/classes.cached.document.js +100 -0
  8. package/dist_ts/cache/classes.cachedb.d.ts +60 -0
  9. package/dist_ts/cache/classes.cachedb.js +126 -0
  10. package/dist_ts/cache/documents/classes.cached.email.d.ts +125 -0
  11. package/dist_ts/cache/documents/classes.cached.email.js +337 -0
  12. package/dist_ts/cache/documents/classes.cached.ip.reputation.d.ts +119 -0
  13. package/dist_ts/cache/documents/classes.cached.ip.reputation.js +323 -0
  14. package/dist_ts/cache/documents/index.d.ts +2 -0
  15. package/dist_ts/cache/documents/index.js +3 -0
  16. package/dist_ts/cache/index.d.ts +4 -0
  17. package/dist_ts/cache/index.js +7 -0
  18. package/dist_ts/classes.cert-provision-scheduler.d.ts +54 -0
  19. package/dist_ts/classes.cert-provision-scheduler.js +118 -0
  20. package/dist_ts/classes.dcrouter.d.ts +399 -0
  21. package/dist_ts/classes.dcrouter.js +1697 -0
  22. package/dist_ts/classes.storage-cert-manager.d.ts +18 -0
  23. package/dist_ts/classes.storage-cert-manager.js +43 -0
  24. package/dist_ts/config/classes.api-token-manager.d.ts +46 -0
  25. package/dist_ts/config/classes.api-token-manager.js +150 -0
  26. package/dist_ts/config/classes.route-config-manager.d.ts +38 -0
  27. package/dist_ts/config/classes.route-config-manager.js +257 -0
  28. package/dist_ts/config/index.d.ts +3 -0
  29. package/dist_ts/config/index.js +5 -0
  30. package/dist_ts/config/validator.d.ts +104 -0
  31. package/dist_ts/config/validator.js +152 -0
  32. package/dist_ts/errors/base.errors.d.ts +224 -0
  33. package/dist_ts/errors/base.errors.js +320 -0
  34. package/dist_ts/errors/error-handler.d.ts +98 -0
  35. package/dist_ts/errors/error-handler.js +282 -0
  36. package/dist_ts/errors/error.codes.d.ts +115 -0
  37. package/dist_ts/errors/error.codes.js +136 -0
  38. package/dist_ts/errors/index.d.ts +54 -0
  39. package/dist_ts/errors/index.js +136 -0
  40. package/dist_ts/errors/reputation.errors.d.ts +183 -0
  41. package/dist_ts/errors/reputation.errors.js +292 -0
  42. package/dist_ts/http3/http3-route-augmentation.d.ts +50 -0
  43. package/dist_ts/http3/http3-route-augmentation.js +98 -0
  44. package/dist_ts/http3/index.d.ts +1 -0
  45. package/dist_ts/http3/index.js +2 -0
  46. package/dist_ts/index.d.ts +8 -0
  47. package/dist_ts/index.js +29 -0
  48. package/dist_ts/logger.d.ts +21 -0
  49. package/dist_ts/logger.js +81 -0
  50. package/dist_ts/monitoring/classes.metricscache.d.ts +32 -0
  51. package/dist_ts/monitoring/classes.metricscache.js +63 -0
  52. package/dist_ts/monitoring/classes.metricsmanager.d.ts +184 -0
  53. package/dist_ts/monitoring/classes.metricsmanager.js +744 -0
  54. package/dist_ts/monitoring/index.d.ts +1 -0
  55. package/dist_ts/monitoring/index.js +2 -0
  56. package/dist_ts/opsserver/classes.opsserver.d.ts +38 -0
  57. package/dist_ts/opsserver/classes.opsserver.js +87 -0
  58. package/dist_ts/opsserver/handlers/admin.handler.d.ts +31 -0
  59. package/dist_ts/opsserver/handlers/admin.handler.js +180 -0
  60. package/dist_ts/opsserver/handlers/api-token.handler.d.ts +6 -0
  61. package/dist_ts/opsserver/handlers/api-token.handler.js +62 -0
  62. package/dist_ts/opsserver/handlers/certificate.handler.d.ts +32 -0
  63. package/dist_ts/opsserver/handlers/certificate.handler.js +421 -0
  64. package/dist_ts/opsserver/handlers/config.handler.d.ts +7 -0
  65. package/dist_ts/opsserver/handlers/config.handler.js +192 -0
  66. package/dist_ts/opsserver/handlers/email-ops.handler.d.ts +30 -0
  67. package/dist_ts/opsserver/handlers/email-ops.handler.js +227 -0
  68. package/dist_ts/opsserver/handlers/index.d.ts +12 -0
  69. package/dist_ts/opsserver/handlers/index.js +13 -0
  70. package/dist_ts/opsserver/handlers/logs.handler.d.ts +25 -0
  71. package/dist_ts/opsserver/handlers/logs.handler.js +256 -0
  72. package/dist_ts/opsserver/handlers/radius.handler.d.ts +6 -0
  73. package/dist_ts/opsserver/handlers/radius.handler.js +295 -0
  74. package/dist_ts/opsserver/handlers/remoteingress.handler.d.ts +6 -0
  75. package/dist_ts/opsserver/handlers/remoteingress.handler.js +156 -0
  76. package/dist_ts/opsserver/handlers/route-management.handler.d.ts +14 -0
  77. package/dist_ts/opsserver/handlers/route-management.handler.js +117 -0
  78. package/dist_ts/opsserver/handlers/security.handler.d.ts +9 -0
  79. package/dist_ts/opsserver/handlers/security.handler.js +233 -0
  80. package/dist_ts/opsserver/handlers/stats.handler.d.ts +11 -0
  81. package/dist_ts/opsserver/handlers/stats.handler.js +403 -0
  82. package/dist_ts/opsserver/handlers/vpn.handler.d.ts +6 -0
  83. package/dist_ts/opsserver/handlers/vpn.handler.js +197 -0
  84. package/dist_ts/opsserver/helpers/guards.d.ts +27 -0
  85. package/dist_ts/opsserver/helpers/guards.js +43 -0
  86. package/dist_ts/opsserver/index.d.ts +1 -0
  87. package/dist_ts/opsserver/index.js +2 -0
  88. package/dist_ts/paths.d.ts +26 -0
  89. package/dist_ts/paths.js +45 -0
  90. package/dist_ts/plugins.d.ts +81 -0
  91. package/dist_ts/plugins.js +115 -0
  92. package/dist_ts/radius/classes.accounting.manager.d.ts +231 -0
  93. package/dist_ts/radius/classes.accounting.manager.js +462 -0
  94. package/dist_ts/radius/classes.radius.server.d.ts +171 -0
  95. package/dist_ts/radius/classes.radius.server.js +386 -0
  96. package/dist_ts/radius/classes.vlan.manager.d.ts +128 -0
  97. package/dist_ts/radius/classes.vlan.manager.js +279 -0
  98. package/dist_ts/radius/index.d.ts +13 -0
  99. package/dist_ts/radius/index.js +14 -0
  100. package/dist_ts/remoteingress/classes.remoteingress-manager.d.ts +94 -0
  101. package/dist_ts/remoteingress/classes.remoteingress-manager.js +271 -0
  102. package/dist_ts/remoteingress/classes.tunnel-manager.d.ts +59 -0
  103. package/dist_ts/remoteingress/classes.tunnel-manager.js +165 -0
  104. package/dist_ts/remoteingress/index.d.ts +2 -0
  105. package/dist_ts/remoteingress/index.js +3 -0
  106. package/dist_ts/security/classes.contentscanner.d.ts +164 -0
  107. package/dist_ts/security/classes.contentscanner.js +642 -0
  108. package/dist_ts/security/classes.ipreputationchecker.d.ts +160 -0
  109. package/dist_ts/security/classes.ipreputationchecker.js +537 -0
  110. package/dist_ts/security/classes.securitylogger.d.ts +144 -0
  111. package/dist_ts/security/classes.securitylogger.js +235 -0
  112. package/dist_ts/security/index.d.ts +3 -0
  113. package/dist_ts/security/index.js +4 -0
  114. package/dist_ts/sms/classes.smsservice.d.ts +15 -0
  115. package/dist_ts/sms/classes.smsservice.js +72 -0
  116. package/dist_ts/sms/config/sms.config.d.ts +93 -0
  117. package/dist_ts/sms/config/sms.config.js +2 -0
  118. package/dist_ts/sms/config/sms.schema.d.ts +5 -0
  119. package/dist_ts/sms/config/sms.schema.js +121 -0
  120. package/dist_ts/sms/index.d.ts +1 -0
  121. package/dist_ts/sms/index.js +2 -0
  122. package/dist_ts/storage/classes.storagemanager.d.ts +83 -0
  123. package/dist_ts/storage/classes.storagemanager.js +348 -0
  124. package/dist_ts/storage/index.d.ts +1 -0
  125. package/dist_ts/storage/index.js +3 -0
  126. package/dist_ts/vpn/classes.vpn-manager.d.ts +129 -0
  127. package/dist_ts/vpn/classes.vpn-manager.js +329 -0
  128. package/dist_ts/vpn/index.d.ts +1 -0
  129. package/dist_ts/vpn/index.js +2 -0
  130. package/dist_ts_apiclient/classes.apitoken.d.ts +41 -0
  131. package/dist_ts_apiclient/classes.apitoken.js +115 -0
  132. package/dist_ts_apiclient/classes.certificate.d.ts +57 -0
  133. package/dist_ts_apiclient/classes.certificate.js +69 -0
  134. package/dist_ts_apiclient/classes.config.d.ts +7 -0
  135. package/dist_ts_apiclient/classes.config.js +11 -0
  136. package/dist_ts_apiclient/classes.dcrouterapiclient.d.ts +41 -0
  137. package/dist_ts_apiclient/classes.dcrouterapiclient.js +81 -0
  138. package/dist_ts_apiclient/classes.email.d.ts +30 -0
  139. package/dist_ts_apiclient/classes.email.js +52 -0
  140. package/dist_ts_apiclient/classes.logs.d.ts +21 -0
  141. package/dist_ts_apiclient/classes.logs.js +14 -0
  142. package/dist_ts_apiclient/classes.radius.d.ts +59 -0
  143. package/dist_ts_apiclient/classes.radius.js +95 -0
  144. package/dist_ts_apiclient/classes.remoteingress.d.ts +54 -0
  145. package/dist_ts_apiclient/classes.remoteingress.js +136 -0
  146. package/dist_ts_apiclient/classes.route.d.ts +42 -0
  147. package/dist_ts_apiclient/classes.route.js +154 -0
  148. package/dist_ts_apiclient/classes.stats.d.ts +47 -0
  149. package/dist_ts_apiclient/classes.stats.js +38 -0
  150. package/dist_ts_apiclient/index.d.ts +10 -0
  151. package/dist_ts_apiclient/index.js +14 -0
  152. package/dist_ts_apiclient/plugins.d.ts +3 -0
  153. package/dist_ts_apiclient/plugins.js +5 -0
  154. package/dist_ts_interfaces/data/remoteingress.d.ts +2 -0
  155. package/dist_ts_interfaces/data/vpn.d.ts +1 -2
  156. package/dist_ts_interfaces/requests/vpn.d.ts +1 -1
  157. package/dist_ts_web/00_commitinfo_data.d.ts +8 -0
  158. package/dist_ts_web/00_commitinfo_data.js +9 -0
  159. package/dist_ts_web/appstate.d.ts +238 -0
  160. package/dist_ts_web/appstate.js +1174 -0
  161. package/dist_ts_web/elements/index.d.ts +13 -0
  162. package/dist_ts_web/elements/index.js +14 -0
  163. package/dist_ts_web/elements/ops-dashboard.d.ts +23 -0
  164. package/dist_ts_web/elements/ops-dashboard.js +323 -0
  165. package/dist_ts_web/elements/ops-view-apitokens.d.ts +13 -0
  166. package/dist_ts_web/elements/ops-view-apitokens.js +371 -0
  167. package/dist_ts_web/elements/ops-view-certificates.d.ts +22 -0
  168. package/dist_ts_web/elements/ops-view-certificates.js +528 -0
  169. package/dist_ts_web/elements/ops-view-config.d.ts +19 -0
  170. package/dist_ts_web/elements/ops-view-config.js +339 -0
  171. package/dist_ts_web/elements/ops-view-emails.d.ts +21 -0
  172. package/dist_ts_web/elements/ops-view-emails.js +165 -0
  173. package/dist_ts_web/elements/ops-view-logs.d.ts +13 -0
  174. package/dist_ts_web/elements/ops-view-logs.js +159 -0
  175. package/dist_ts_web/elements/ops-view-network.d.ts +71 -0
  176. package/dist_ts_web/elements/ops-view-network.js +764 -0
  177. package/dist_ts_web/elements/ops-view-overview.d.ts +22 -0
  178. package/dist_ts_web/elements/ops-view-overview.js +456 -0
  179. package/dist_ts_web/elements/ops-view-remoteingress.d.ts +20 -0
  180. package/dist_ts_web/elements/ops-view-remoteingress.js +494 -0
  181. package/dist_ts_web/elements/ops-view-routes.d.ts +12 -0
  182. package/dist_ts_web/elements/ops-view-routes.js +404 -0
  183. package/dist_ts_web/elements/ops-view-security.d.ts +21 -0
  184. package/dist_ts_web/elements/ops-view-security.js +574 -0
  185. package/dist_ts_web/elements/ops-view-vpn.d.ts +14 -0
  186. package/dist_ts_web/elements/ops-view-vpn.js +365 -0
  187. package/dist_ts_web/elements/shared/css.d.ts +1 -0
  188. package/dist_ts_web/elements/shared/css.js +10 -0
  189. package/dist_ts_web/elements/shared/index.d.ts +2 -0
  190. package/dist_ts_web/elements/shared/index.js +3 -0
  191. package/dist_ts_web/elements/shared/ops-sectionheading.d.ts +5 -0
  192. package/dist_ts_web/elements/shared/ops-sectionheading.js +82 -0
  193. package/dist_ts_web/index.d.ts +1 -0
  194. package/dist_ts_web/index.js +10 -0
  195. package/dist_ts_web/plugins.d.ts +6 -0
  196. package/dist_ts_web/plugins.js +11 -0
  197. package/dist_ts_web/router.d.ts +19 -0
  198. package/dist_ts_web/router.js +91 -0
  199. package/package.json +2 -2
  200. package/ts/00_commitinfo_data.ts +1 -1
  201. package/ts/classes.dcrouter.ts +51 -20
  202. package/ts/config/classes.route-config-manager.ts +7 -6
  203. package/ts/opsserver/handlers/vpn.handler.ts +3 -5
  204. package/ts/vpn/classes.vpn-manager.ts +68 -19
  205. package/ts_web/00_commitinfo_data.ts +1 -1
  206. package/ts_web/appstate.ts +2 -2
  207. package/ts_web/elements/ops-view-vpn.ts +5 -9
@@ -0,0 +1,399 @@
1
+ import * as plugins from './plugins.js';
2
+ import * as paths from './paths.js';
3
+ import { UnifiedEmailServer, type IUnifiedEmailServerOptions, type IEmailRoute } from '@push.rocks/smartmta';
4
+ import { StorageManager, type IStorageConfig } from './storage/index.js';
5
+ import { CertProvisionScheduler } from './classes.cert-provision-scheduler.js';
6
+ import { CacheDb, CacheCleaner } from './cache/index.js';
7
+ import { OpsServer } from './opsserver/index.js';
8
+ import { MetricsManager } from './monitoring/index.js';
9
+ import { RadiusServer, type IRadiusServerConfig } from './radius/index.js';
10
+ import { RemoteIngressManager, TunnelManager } from './remoteingress/index.js';
11
+ import { VpnManager } from './vpn/index.js';
12
+ import { RouteConfigManager, ApiTokenManager } from './config/index.js';
13
+ import { type IHttp3Config } from './http3/index.js';
14
+ export interface IDcRouterOptions {
15
+ /** Base directory for all dcrouter data. Defaults to ~/.serve.zone/dcrouter */
16
+ baseDir?: string;
17
+ /**
18
+ * Direct SmartProxy configuration - gives full control over HTTP/HTTPS and TCP/SNI traffic
19
+ * This is the preferred way to configure HTTP/HTTPS and general TCP/SNI traffic
20
+ */
21
+ smartProxyConfig?: plugins.smartproxy.ISmartProxyOptions;
22
+ /**
23
+ * Email server configuration
24
+ * This enables all email handling with pattern-based routing
25
+ */
26
+ emailConfig?: IUnifiedEmailServerOptions;
27
+ /**
28
+ * Custom email port configuration
29
+ * Allows configuring specific ports for email handling
30
+ * This overrides the default port mapping in the emailConfig
31
+ */
32
+ emailPortConfig?: {
33
+ /** External to internal port mapping */
34
+ portMapping?: Record<number, number>;
35
+ /** Custom port configuration for specific ports */
36
+ portSettings?: Record<number, any>;
37
+ /** Path to store received emails */
38
+ receivedEmailsPath?: string;
39
+ };
40
+ /** TLS/certificate configuration */
41
+ tls?: {
42
+ /** Contact email for ACME certificates */
43
+ contactEmail: string;
44
+ /** Domain for main certificate */
45
+ domain?: string;
46
+ /** Path to certificate file (if not using auto-provisioning) */
47
+ certPath?: string;
48
+ /** Path to key file (if not using auto-provisioning) */
49
+ keyPath?: string;
50
+ /** Path to CA certificate file (for custom CAs) */
51
+ caPath?: string;
52
+ };
53
+ /**
54
+ * The nameserver domains (e.g., ['ns1.example.com', 'ns2.example.com'])
55
+ * These will automatically get A records pointing to publicIp or proxyIps[0]
56
+ * These are what go in the NS records for ALL domains in dnsScopes
57
+ */
58
+ dnsNsDomains?: string[];
59
+ /**
60
+ * Domains this DNS server is authoritative for (e.g., ['example.com', 'mail.example.org'])
61
+ * NS records will be auto-generated for these domains
62
+ * Any DNS record outside these scopes will trigger a warning
63
+ * Email domains with `internal-dns` mode must be included here
64
+ */
65
+ dnsScopes?: string[];
66
+ /**
67
+ * IPs of proxies that forward traffic to your server (optional)
68
+ * When defined AND useIngressProxy is true, A records with server IP are replaced with proxy IPs
69
+ * If not defined or empty, all A records use the real server IP
70
+ * Helps hide real server IP for security/privacy
71
+ */
72
+ proxyIps?: string[];
73
+ /**
74
+ * Public IP address for nameserver A records (required if proxyIps not set)
75
+ * This is the IP that will be used for the nameserver domains (dnsNsDomains)
76
+ * If proxyIps is set, the first proxy IP will be used instead
77
+ */
78
+ publicIp?: string;
79
+ /**
80
+ * DNS records to register
81
+ * Must be within the defined dnsScopes (or receive warning)
82
+ * Only need A, CNAME, TXT, MX records (NS records auto-generated, SOA handled by smartdns)
83
+ * Can use `useIngressProxy: false` to expose real server IP (defaults to true)
84
+ */
85
+ dnsRecords?: Array<{
86
+ name: string;
87
+ type: 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS' | 'SOA';
88
+ value: string;
89
+ ttl?: number;
90
+ useIngressProxy?: boolean;
91
+ }>;
92
+ /** DNS challenge configuration for ACME (optional) */
93
+ dnsChallenge?: {
94
+ /** Cloudflare API key for DNS challenges */
95
+ cloudflareApiKey?: string;
96
+ };
97
+ /** Storage configuration */
98
+ storage?: IStorageConfig;
99
+ /**
100
+ * Cache database configuration using smartdata and LocalTsmDb
101
+ * Provides persistent caching for emails, IP reputation, bounces, etc.
102
+ */
103
+ cacheConfig?: {
104
+ /** Enable cache database (default: true) */
105
+ enabled?: boolean;
106
+ /** Storage path for TsmDB data (default: ~/.serve.zone/dcrouter/tsmdb) */
107
+ storagePath?: string;
108
+ /** Database name (default: dcrouter) */
109
+ dbName?: string;
110
+ /** Default TTL in days for cached items (default: 30) */
111
+ defaultTTLDays?: number;
112
+ /** Cleanup interval in hours (default: 1) */
113
+ cleanupIntervalHours?: number;
114
+ /** TTL configuration per data type (in days) */
115
+ ttlConfig?: {
116
+ /** Email cache TTL (default: 30 days) */
117
+ emails?: number;
118
+ /** IP reputation cache TTL (default: 1 day) */
119
+ ipReputation?: number;
120
+ /** Bounce records TTL (default: 30 days) */
121
+ bounces?: number;
122
+ /** DKIM keys TTL (default: 90 days) */
123
+ dkimKeys?: number;
124
+ /** Suppression list TTL (default: 30 days, can be permanent) */
125
+ suppression?: number;
126
+ };
127
+ };
128
+ /**
129
+ * RADIUS server configuration for network authentication
130
+ * Enables MAC Authentication Bypass (MAB) and VLAN assignment
131
+ */
132
+ radiusConfig?: IRadiusServerConfig;
133
+ /**
134
+ * Remote Ingress configuration for edge tunnel nodes
135
+ * Enables edge nodes to accept incoming connections and tunnel them to this DcRouter
136
+ */
137
+ /**
138
+ * HTTP/3 (QUIC) configuration for HTTPS routes.
139
+ * Enabled by default — qualifying HTTPS routes on port 443 are automatically
140
+ * augmented with QUIC/H3 fields. Set { enabled: false } to disable globally.
141
+ * Individual routes can opt out via action.options.http3 = false.
142
+ */
143
+ http3?: IHttp3Config;
144
+ /** Port for the OpsServer web UI (default: 3000) */
145
+ opsServerPort?: number;
146
+ remoteIngressConfig?: {
147
+ /** Enable remote ingress hub (default: false) */
148
+ enabled?: boolean;
149
+ /** Port for tunnel connections from edge nodes (default: 8443) */
150
+ tunnelPort?: number;
151
+ /** External hostname of this hub, embedded in connection tokens */
152
+ hubDomain?: string;
153
+ /** TLS configuration for the tunnel server */
154
+ tls?: {
155
+ certPath?: string;
156
+ keyPath?: string;
157
+ };
158
+ };
159
+ /**
160
+ * VPN server configuration.
161
+ * Enables VPN-based access control: routes with vpn.required are only
162
+ * accessible from VPN clients. Supports WireGuard + native (WS/QUIC) transports.
163
+ */
164
+ vpnConfig?: {
165
+ /** Enable VPN server (default: false) */
166
+ enabled?: boolean;
167
+ /** VPN subnet CIDR (default: '10.8.0.0/24') */
168
+ subnet?: string;
169
+ /** WireGuard UDP listen port (default: 51820) */
170
+ wgListenPort?: number;
171
+ /** DNS servers pushed to VPN clients */
172
+ dns?: string[];
173
+ /** Server endpoint hostname for client configs (e.g. 'vpn.example.com') */
174
+ serverEndpoint?: string;
175
+ /** Pre-defined VPN clients created on startup */
176
+ clients?: Array<{
177
+ clientId: string;
178
+ serverDefinedClientTags?: string[];
179
+ description?: string;
180
+ }>;
181
+ /** Destination routing policy for VPN client traffic.
182
+ * Default in socket mode: { default: 'forceTarget', target: '127.0.0.1' } (all traffic → SmartProxy).
183
+ * Default in tun mode: not set (all traffic passes through). */
184
+ destinationPolicy?: {
185
+ default: 'forceTarget' | 'block' | 'allow';
186
+ target?: string;
187
+ allowList?: string[];
188
+ blockList?: string[];
189
+ };
190
+ };
191
+ }
192
+ /**
193
+ * DcRouter can be run on ingress and egress to and from a datacenter site.
194
+ */
195
+ /**
196
+ * Context passed to HTTP routing rules
197
+ */
198
+ /**
199
+ * Context passed to port proxy (SmartProxy) routing rules
200
+ */
201
+ export interface PortProxyRuleContext {
202
+ proxy: plugins.smartproxy.SmartProxy;
203
+ routes: plugins.smartproxy.IRouteConfig[];
204
+ }
205
+ export declare class DcRouter {
206
+ options: IDcRouterOptions;
207
+ resolvedPaths: ReturnType<typeof paths.resolvePaths>;
208
+ smartProxy?: plugins.smartproxy.SmartProxy;
209
+ smartAcme?: plugins.smartacme.SmartAcme;
210
+ dnsServer?: plugins.smartdns.dnsServerMod.DnsServer;
211
+ emailServer?: UnifiedEmailServer;
212
+ radiusServer?: RadiusServer;
213
+ storageManager: StorageManager;
214
+ opsServer: OpsServer;
215
+ metricsManager?: MetricsManager;
216
+ cacheDb?: CacheDb;
217
+ cacheCleaner?: CacheCleaner;
218
+ remoteIngressManager?: RemoteIngressManager;
219
+ tunnelManager?: TunnelManager;
220
+ vpnManager?: VpnManager;
221
+ routeConfigManager?: RouteConfigManager;
222
+ apiTokenManager?: ApiTokenManager;
223
+ detectedPublicIp: string | null;
224
+ private dnsLogWindowSecond;
225
+ private dnsLogWindowCount;
226
+ private dnsBatchCount;
227
+ private dnsBatchTimer;
228
+ certificateStatusMap: Map<string, {
229
+ status: "valid" | "failed";
230
+ routeNames: string[];
231
+ expiryDate?: string;
232
+ issuedAt?: string;
233
+ source?: string;
234
+ error?: string;
235
+ }>;
236
+ certProvisionScheduler?: CertProvisionScheduler;
237
+ serviceManager: plugins.taskbuffer.ServiceManager;
238
+ private serviceSubjectSubscription?;
239
+ smartAcmeReady: boolean;
240
+ typedrouter: plugins.typedrequest.TypedRouter<import("@api.global/typedrequest-interfaces").ITypedRequest>;
241
+ private constructorRoutes;
242
+ private qenv;
243
+ constructor(optionsArg: IDcRouterOptions);
244
+ /**
245
+ * Register all dcrouter services with the ServiceManager.
246
+ * Services are started in dependency order, with failure isolation for optional services.
247
+ */
248
+ private registerServices;
249
+ start(): Promise<void>;
250
+ /**
251
+ * Detect OS-level resource limits and warn if they are too low for production use.
252
+ * This is detection only — no attempts to raise limits.
253
+ */
254
+ private checkSystemLimits;
255
+ /**
256
+ * Log comprehensive startup summary
257
+ */
258
+ private logStartupSummary;
259
+ /**
260
+ * Set up the cache database (smartdata + LocalTsmDb)
261
+ */
262
+ private setupCacheDb;
263
+ /**
264
+ * Set up SmartProxy with direct configuration and automatic email routes
265
+ */
266
+ private setupSmartProxy;
267
+ /**
268
+ * Generate SmartProxy routes for email configuration
269
+ */
270
+ private generateEmailRoutes;
271
+ /**
272
+ * Generate SmartProxy routes for DNS configuration
273
+ */
274
+ private generateDnsRoutes;
275
+ /**
276
+ * Check if a domain matches a pattern (including wildcard support)
277
+ * @param domain The domain to check
278
+ * @param pattern The pattern to match against (e.g., "*.example.com")
279
+ * @returns Whether the domain matches the pattern
280
+ */
281
+ private isDomainMatch;
282
+ /**
283
+ * Find ALL route names that match a given domain
284
+ */
285
+ findRouteNamesForDomain(domain: string): string[];
286
+ /**
287
+ * Get the routes derived from constructor config (smartProxy + email + DNS).
288
+ * Used by RouteConfigManager as the "hardcoded" base.
289
+ */
290
+ getConstructorRoutes(): plugins.smartproxy.IRouteConfig[];
291
+ stop(): Promise<void>;
292
+ /**
293
+ * Update SmartProxy configuration
294
+ * @param config New SmartProxy configuration
295
+ */
296
+ updateSmartProxyConfig(config: plugins.smartproxy.ISmartProxyOptions): Promise<void>;
297
+ /**
298
+ * Set up unified email handling with pattern-based routing
299
+ * This implements the consolidated emailConfig approach
300
+ */
301
+ private setupUnifiedEmailHandling;
302
+ /**
303
+ * Update the unified email configuration
304
+ * @param config New email configuration
305
+ */
306
+ updateEmailConfig(config: IUnifiedEmailServerOptions): Promise<void>;
307
+ /**
308
+ * Stop all unified email components
309
+ */
310
+ private stopUnifiedEmailComponents;
311
+ /**
312
+ * Update domain rules for email routing
313
+ * @param rules New domain rules to apply
314
+ */
315
+ updateEmailRoutes(routes: IEmailRoute[]): Promise<void>;
316
+ /**
317
+ * Get statistics from all components
318
+ */
319
+ getStats(): any;
320
+ /**
321
+ * Register DNS records with the DNS server
322
+ * @param records Array of DNS records to register
323
+ */
324
+ private registerDnsRecords;
325
+ /**
326
+ * Parse DNS record data based on record type
327
+ * @param type DNS record type
328
+ * @param value DNS record value
329
+ * @returns Parsed data for the DNS response
330
+ */
331
+ private parseDnsRecordData;
332
+ /**
333
+ * Set up DNS server with socket handler for DoH
334
+ */
335
+ private setupDnsWithSocketHandler;
336
+ /**
337
+ * Create DNS socket handler for DoH
338
+ */
339
+ private createDnsSocketHandler;
340
+ /**
341
+ * Validate DNS configuration
342
+ */
343
+ private validateDnsConfiguration;
344
+ /**
345
+ * Generate email DNS records for domains with internal-dns mode
346
+ */
347
+ private generateEmailDnsRecords;
348
+ /**
349
+ * Load DKIM records from JSON files
350
+ * Reads all *.dkimrecord.json files from the DNS records directory
351
+ */
352
+ private loadDkimRecords;
353
+ /**
354
+ * Initialize DKIM keys for all configured email domains
355
+ * This ensures DKIM records are available immediately at startup
356
+ */
357
+ private initializeDkimForEmailDomains;
358
+ /**
359
+ * Generate authoritative DNS records (NS only) for all domains in dnsScopes
360
+ * SOA records are now automatically generated by smartdns with primaryNameserver setting
361
+ */
362
+ private generateAuthoritativeRecords;
363
+ /**
364
+ * Extract the base domain from a DNS record name
365
+ */
366
+ private extractDomain;
367
+ /**
368
+ * Apply proxy IP replacement logic to DNS records
369
+ */
370
+ private applyProxyIpReplacement;
371
+ /**
372
+ * Detect the server's public IP address
373
+ */
374
+ private detectServerPublicIp;
375
+ /**
376
+ * Set up Remote Ingress hub for edge tunnel connections
377
+ */
378
+ private setupRemoteIngress;
379
+ /**
380
+ * Set up VPN server for VPN-based route access control.
381
+ */
382
+ private setupVpnServer;
383
+ /**
384
+ * Inject VPN security into routes that have vpn.required === true.
385
+ * Adds the VPN subnet to security.ipAllowList so only VPN clients can access them.
386
+ */
387
+ private injectVpnSecurity;
388
+ /**
389
+ * Set up RADIUS server for network authentication
390
+ */
391
+ private setupRadiusServer;
392
+ /**
393
+ * Update RADIUS configuration at runtime
394
+ */
395
+ updateRadiusConfig(config: IRadiusServerConfig): Promise<void>;
396
+ }
397
+ export type { IUnifiedEmailServerOptions };
398
+ export type { IRadiusServerConfig };
399
+ export default DcRouter;