@serve.zone/dcrouter 11.14.0 → 11.15.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 +4 -4
  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 +392 -0
  21. package/dist_ts/classes.dcrouter.js +1703 -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 +199 -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 +127 -0
  127. package/dist_ts/vpn/classes.vpn-manager.js +335 -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 -1
  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 +369 -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 +33 -3
  202. package/ts/config/classes.route-config-manager.ts +7 -6
  203. package/ts/opsserver/handlers/vpn.handler.ts +3 -3
  204. package/ts/vpn/classes.vpn-manager.ts +56 -5
  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 +4 -4
@@ -0,0 +1,392 @@
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
+ /** Override forwarding mode. Default: auto-detect (tun if root, socket otherwise) */
176
+ forwardingMode?: 'tun' | 'socket';
177
+ /** Pre-defined VPN clients created on startup */
178
+ clients?: Array<{
179
+ clientId: string;
180
+ serverDefinedClientTags?: string[];
181
+ description?: string;
182
+ }>;
183
+ };
184
+ }
185
+ /**
186
+ * DcRouter can be run on ingress and egress to and from a datacenter site.
187
+ */
188
+ /**
189
+ * Context passed to HTTP routing rules
190
+ */
191
+ /**
192
+ * Context passed to port proxy (SmartProxy) routing rules
193
+ */
194
+ export interface PortProxyRuleContext {
195
+ proxy: plugins.smartproxy.SmartProxy;
196
+ routes: plugins.smartproxy.IRouteConfig[];
197
+ }
198
+ export declare class DcRouter {
199
+ options: IDcRouterOptions;
200
+ resolvedPaths: ReturnType<typeof paths.resolvePaths>;
201
+ smartProxy?: plugins.smartproxy.SmartProxy;
202
+ smartAcme?: plugins.smartacme.SmartAcme;
203
+ dnsServer?: plugins.smartdns.dnsServerMod.DnsServer;
204
+ emailServer?: UnifiedEmailServer;
205
+ radiusServer?: RadiusServer;
206
+ storageManager: StorageManager;
207
+ opsServer: OpsServer;
208
+ metricsManager?: MetricsManager;
209
+ cacheDb?: CacheDb;
210
+ cacheCleaner?: CacheCleaner;
211
+ remoteIngressManager?: RemoteIngressManager;
212
+ tunnelManager?: TunnelManager;
213
+ vpnManager?: VpnManager;
214
+ routeConfigManager?: RouteConfigManager;
215
+ apiTokenManager?: ApiTokenManager;
216
+ detectedPublicIp: string | null;
217
+ private dnsLogWindowSecond;
218
+ private dnsLogWindowCount;
219
+ private dnsBatchCount;
220
+ private dnsBatchTimer;
221
+ certificateStatusMap: Map<string, {
222
+ status: "valid" | "failed";
223
+ routeNames: string[];
224
+ expiryDate?: string;
225
+ issuedAt?: string;
226
+ source?: string;
227
+ error?: string;
228
+ }>;
229
+ certProvisionScheduler?: CertProvisionScheduler;
230
+ serviceManager: plugins.taskbuffer.ServiceManager;
231
+ private serviceSubjectSubscription?;
232
+ smartAcmeReady: boolean;
233
+ typedrouter: plugins.typedrequest.TypedRouter<import("@api.global/typedrequest-interfaces").ITypedRequest>;
234
+ private constructorRoutes;
235
+ private qenv;
236
+ constructor(optionsArg: IDcRouterOptions);
237
+ /**
238
+ * Register all dcrouter services with the ServiceManager.
239
+ * Services are started in dependency order, with failure isolation for optional services.
240
+ */
241
+ private registerServices;
242
+ start(): Promise<void>;
243
+ /**
244
+ * Detect OS-level resource limits and warn if they are too low for production use.
245
+ * This is detection only — no attempts to raise limits.
246
+ */
247
+ private checkSystemLimits;
248
+ /**
249
+ * Log comprehensive startup summary
250
+ */
251
+ private logStartupSummary;
252
+ /**
253
+ * Set up the cache database (smartdata + LocalTsmDb)
254
+ */
255
+ private setupCacheDb;
256
+ /**
257
+ * Set up SmartProxy with direct configuration and automatic email routes
258
+ */
259
+ private setupSmartProxy;
260
+ /**
261
+ * Generate SmartProxy routes for email configuration
262
+ */
263
+ private generateEmailRoutes;
264
+ /**
265
+ * Generate SmartProxy routes for DNS configuration
266
+ */
267
+ private generateDnsRoutes;
268
+ /**
269
+ * Check if a domain matches a pattern (including wildcard support)
270
+ * @param domain The domain to check
271
+ * @param pattern The pattern to match against (e.g., "*.example.com")
272
+ * @returns Whether the domain matches the pattern
273
+ */
274
+ private isDomainMatch;
275
+ /**
276
+ * Find ALL route names that match a given domain
277
+ */
278
+ findRouteNamesForDomain(domain: string): string[];
279
+ /**
280
+ * Get the routes derived from constructor config (smartProxy + email + DNS).
281
+ * Used by RouteConfigManager as the "hardcoded" base.
282
+ */
283
+ getConstructorRoutes(): plugins.smartproxy.IRouteConfig[];
284
+ stop(): Promise<void>;
285
+ /**
286
+ * Update SmartProxy configuration
287
+ * @param config New SmartProxy configuration
288
+ */
289
+ updateSmartProxyConfig(config: plugins.smartproxy.ISmartProxyOptions): Promise<void>;
290
+ /**
291
+ * Set up unified email handling with pattern-based routing
292
+ * This implements the consolidated emailConfig approach
293
+ */
294
+ private setupUnifiedEmailHandling;
295
+ /**
296
+ * Update the unified email configuration
297
+ * @param config New email configuration
298
+ */
299
+ updateEmailConfig(config: IUnifiedEmailServerOptions): Promise<void>;
300
+ /**
301
+ * Stop all unified email components
302
+ */
303
+ private stopUnifiedEmailComponents;
304
+ /**
305
+ * Update domain rules for email routing
306
+ * @param rules New domain rules to apply
307
+ */
308
+ updateEmailRoutes(routes: IEmailRoute[]): Promise<void>;
309
+ /**
310
+ * Get statistics from all components
311
+ */
312
+ getStats(): any;
313
+ /**
314
+ * Register DNS records with the DNS server
315
+ * @param records Array of DNS records to register
316
+ */
317
+ private registerDnsRecords;
318
+ /**
319
+ * Parse DNS record data based on record type
320
+ * @param type DNS record type
321
+ * @param value DNS record value
322
+ * @returns Parsed data for the DNS response
323
+ */
324
+ private parseDnsRecordData;
325
+ /**
326
+ * Set up DNS server with socket handler for DoH
327
+ */
328
+ private setupDnsWithSocketHandler;
329
+ /**
330
+ * Create DNS socket handler for DoH
331
+ */
332
+ private createDnsSocketHandler;
333
+ /**
334
+ * Validate DNS configuration
335
+ */
336
+ private validateDnsConfiguration;
337
+ /**
338
+ * Generate email DNS records for domains with internal-dns mode
339
+ */
340
+ private generateEmailDnsRecords;
341
+ /**
342
+ * Load DKIM records from JSON files
343
+ * Reads all *.dkimrecord.json files from the DNS records directory
344
+ */
345
+ private loadDkimRecords;
346
+ /**
347
+ * Initialize DKIM keys for all configured email domains
348
+ * This ensures DKIM records are available immediately at startup
349
+ */
350
+ private initializeDkimForEmailDomains;
351
+ /**
352
+ * Generate authoritative DNS records (NS only) for all domains in dnsScopes
353
+ * SOA records are now automatically generated by smartdns with primaryNameserver setting
354
+ */
355
+ private generateAuthoritativeRecords;
356
+ /**
357
+ * Extract the base domain from a DNS record name
358
+ */
359
+ private extractDomain;
360
+ /**
361
+ * Apply proxy IP replacement logic to DNS records
362
+ */
363
+ private applyProxyIpReplacement;
364
+ /**
365
+ * Detect the server's public IP address
366
+ */
367
+ private detectServerPublicIp;
368
+ /**
369
+ * Set up Remote Ingress hub for edge tunnel connections
370
+ */
371
+ private setupRemoteIngress;
372
+ /**
373
+ * Set up VPN server for VPN-based route access control.
374
+ */
375
+ private setupVpnServer;
376
+ /**
377
+ * Inject VPN security into routes that have vpn.required === true.
378
+ * Adds the VPN subnet to security.ipAllowList so only VPN clients can access them.
379
+ */
380
+ private injectVpnSecurity;
381
+ /**
382
+ * Set up RADIUS server for network authentication
383
+ */
384
+ private setupRadiusServer;
385
+ /**
386
+ * Update RADIUS configuration at runtime
387
+ */
388
+ updateRadiusConfig(config: IRadiusServerConfig): Promise<void>;
389
+ }
390
+ export type { IUnifiedEmailServerOptions };
391
+ export type { IRadiusServerConfig };
392
+ export default DcRouter;