@serve.zone/dcrouter 2.12.4

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 (737) hide show
  1. package/.dockerignore +1 -0
  2. package/.gitea/workflows/docker_nottags.yaml +71 -0
  3. package/.gitea/workflows/docker_tags.yaml +106 -0
  4. package/.vscode/launch.json +11 -0
  5. package/.vscode/settings.json +26 -0
  6. package/Dockerfile +46 -0
  7. package/changelog.md +247 -0
  8. package/cli.child.js +4 -0
  9. package/cli.child.ts +4 -0
  10. package/cli.js +4 -0
  11. package/cli.ts.js +5 -0
  12. package/dist_ts/00_commitinfo_data.d.ts +8 -0
  13. package/dist_ts/00_commitinfo_data.js +9 -0
  14. package/dist_ts/classes.dcrouter.d.ts +238 -0
  15. package/dist_ts/classes.dcrouter.js +1008 -0
  16. package/dist_ts/config/index.d.ts +1 -0
  17. package/dist_ts/config/index.js +3 -0
  18. package/dist_ts/config/validator.d.ts +104 -0
  19. package/dist_ts/config/validator.js +152 -0
  20. package/dist_ts/deliverability/classes.ipwarmupmanager.d.ts +253 -0
  21. package/dist_ts/deliverability/classes.ipwarmupmanager.js +639 -0
  22. package/dist_ts/deliverability/classes.senderreputationmonitor.d.ts +300 -0
  23. package/dist_ts/deliverability/classes.senderreputationmonitor.js +961 -0
  24. package/dist_ts/deliverability/index.d.ts +2 -0
  25. package/dist_ts/deliverability/index.js +3 -0
  26. package/dist_ts/errors/base.errors.d.ts +224 -0
  27. package/dist_ts/errors/base.errors.js +310 -0
  28. package/dist_ts/errors/email.errors.d.ts +175 -0
  29. package/dist_ts/errors/email.errors.js +265 -0
  30. package/dist_ts/errors/error-handler.d.ts +98 -0
  31. package/dist_ts/errors/error-handler.js +282 -0
  32. package/dist_ts/errors/error.codes.d.ts +115 -0
  33. package/dist_ts/errors/error.codes.js +136 -0
  34. package/dist_ts/errors/index.d.ts +56 -0
  35. package/dist_ts/errors/index.js +138 -0
  36. package/dist_ts/errors/mta.errors.d.ts +259 -0
  37. package/dist_ts/errors/mta.errors.js +472 -0
  38. package/dist_ts/errors/reputation.errors.d.ts +183 -0
  39. package/dist_ts/errors/reputation.errors.js +292 -0
  40. package/dist_ts/index.d.ts +4 -0
  41. package/dist_ts/index.js +6 -0
  42. package/dist_ts/logger.d.ts +17 -0
  43. package/dist_ts/logger.js +77 -0
  44. package/dist_ts/mail/core/classes.bouncemanager.d.ts +200 -0
  45. package/dist_ts/mail/core/classes.bouncemanager.js +778 -0
  46. package/dist_ts/mail/core/classes.email.d.ts +291 -0
  47. package/dist_ts/mail/core/classes.email.js +780 -0
  48. package/dist_ts/mail/core/classes.emailvalidator.d.ts +61 -0
  49. package/dist_ts/mail/core/classes.emailvalidator.js +182 -0
  50. package/dist_ts/mail/core/classes.templatemanager.d.ts +95 -0
  51. package/dist_ts/mail/core/classes.templatemanager.js +239 -0
  52. package/dist_ts/mail/core/index.d.ts +4 -0
  53. package/dist_ts/mail/core/index.js +6 -0
  54. package/dist_ts/mail/delivery/classes.delivery.queue.d.ts +163 -0
  55. package/dist_ts/mail/delivery/classes.delivery.queue.js +485 -0
  56. package/dist_ts/mail/delivery/classes.delivery.system.d.ts +186 -0
  57. package/dist_ts/mail/delivery/classes.delivery.system.js +846 -0
  58. package/dist_ts/mail/delivery/classes.emailsendjob.d.ts +84 -0
  59. package/dist_ts/mail/delivery/classes.emailsendjob.js +362 -0
  60. package/dist_ts/mail/delivery/classes.emailsignjob.d.ts +18 -0
  61. package/dist_ts/mail/delivery/classes.emailsignjob.js +44 -0
  62. package/dist_ts/mail/delivery/classes.mta.config.d.ts +22 -0
  63. package/dist_ts/mail/delivery/classes.mta.config.js +51 -0
  64. package/dist_ts/mail/delivery/classes.ratelimiter.d.ts +98 -0
  65. package/dist_ts/mail/delivery/classes.ratelimiter.js +205 -0
  66. package/dist_ts/mail/delivery/classes.smtp.client.legacy.d.ts +275 -0
  67. package/dist_ts/mail/delivery/classes.smtp.client.legacy.js +973 -0
  68. package/dist_ts/mail/delivery/classes.unified.rate.limiter.d.ts +200 -0
  69. package/dist_ts/mail/delivery/classes.unified.rate.limiter.js +817 -0
  70. package/dist_ts/mail/delivery/index.d.ts +12 -0
  71. package/dist_ts/mail/delivery/index.js +18 -0
  72. package/dist_ts/mail/delivery/interfaces.d.ts +243 -0
  73. package/dist_ts/mail/delivery/interfaces.js +17 -0
  74. package/dist_ts/mail/delivery/smtpclient/auth-handler.d.ts +43 -0
  75. package/dist_ts/mail/delivery/smtpclient/auth-handler.js +188 -0
  76. package/dist_ts/mail/delivery/smtpclient/command-handler.d.ts +67 -0
  77. package/dist_ts/mail/delivery/smtpclient/command-handler.js +276 -0
  78. package/dist_ts/mail/delivery/smtpclient/connection-manager.d.ts +48 -0
  79. package/dist_ts/mail/delivery/smtpclient/connection-manager.js +238 -0
  80. package/dist_ts/mail/delivery/smtpclient/constants.d.ts +129 -0
  81. package/dist_ts/mail/delivery/smtpclient/constants.js +135 -0
  82. package/dist_ts/mail/delivery/smtpclient/create-client.d.ts +22 -0
  83. package/dist_ts/mail/delivery/smtpclient/create-client.js +86 -0
  84. package/dist_ts/mail/delivery/smtpclient/error-handler.d.ts +28 -0
  85. package/dist_ts/mail/delivery/smtpclient/error-handler.js +110 -0
  86. package/dist_ts/mail/delivery/smtpclient/index.d.ts +16 -0
  87. package/dist_ts/mail/delivery/smtpclient/index.js +21 -0
  88. package/dist_ts/mail/delivery/smtpclient/interfaces.d.ts +183 -0
  89. package/dist_ts/mail/delivery/smtpclient/interfaces.js +19 -0
  90. package/dist_ts/mail/delivery/smtpclient/smtp-client.d.ts +58 -0
  91. package/dist_ts/mail/delivery/smtpclient/smtp-client.js +279 -0
  92. package/dist_ts/mail/delivery/smtpclient/tls-handler.d.ts +33 -0
  93. package/dist_ts/mail/delivery/smtpclient/tls-handler.js +202 -0
  94. package/dist_ts/mail/delivery/smtpclient/utils/helpers.d.ts +77 -0
  95. package/dist_ts/mail/delivery/smtpclient/utils/helpers.js +196 -0
  96. package/dist_ts/mail/delivery/smtpclient/utils/logging.d.ts +46 -0
  97. package/dist_ts/mail/delivery/smtpclient/utils/logging.js +153 -0
  98. package/dist_ts/mail/delivery/smtpclient/utils/validation.d.ts +38 -0
  99. package/dist_ts/mail/delivery/smtpclient/utils/validation.js +139 -0
  100. package/dist_ts/mail/delivery/smtpserver/certificate-utils.d.ts +45 -0
  101. package/dist_ts/mail/delivery/smtpserver/certificate-utils.js +345 -0
  102. package/dist_ts/mail/delivery/smtpserver/command-handler.d.ts +156 -0
  103. package/dist_ts/mail/delivery/smtpserver/command-handler.js +1159 -0
  104. package/dist_ts/mail/delivery/smtpserver/connection-manager.d.ts +159 -0
  105. package/dist_ts/mail/delivery/smtpserver/connection-manager.js +894 -0
  106. package/dist_ts/mail/delivery/smtpserver/constants.d.ts +130 -0
  107. package/dist_ts/mail/delivery/smtpserver/constants.js +162 -0
  108. package/dist_ts/mail/delivery/smtpserver/create-server.d.ts +14 -0
  109. package/dist_ts/mail/delivery/smtpserver/create-server.js +28 -0
  110. package/dist_ts/mail/delivery/smtpserver/data-handler.d.ts +123 -0
  111. package/dist_ts/mail/delivery/smtpserver/data-handler.js +1148 -0
  112. package/dist_ts/mail/delivery/smtpserver/index.d.ts +20 -0
  113. package/dist_ts/mail/delivery/smtpserver/index.js +27 -0
  114. package/dist_ts/mail/delivery/smtpserver/interfaces.d.ts +530 -0
  115. package/dist_ts/mail/delivery/smtpserver/interfaces.js +10 -0
  116. package/dist_ts/mail/delivery/smtpserver/secure-server.d.ts +15 -0
  117. package/dist_ts/mail/delivery/smtpserver/secure-server.js +79 -0
  118. package/dist_ts/mail/delivery/smtpserver/security-handler.d.ts +86 -0
  119. package/dist_ts/mail/delivery/smtpserver/security-handler.js +234 -0
  120. package/dist_ts/mail/delivery/smtpserver/session-manager.d.ts +140 -0
  121. package/dist_ts/mail/delivery/smtpserver/session-manager.js +469 -0
  122. package/dist_ts/mail/delivery/smtpserver/smtp-server.d.ts +137 -0
  123. package/dist_ts/mail/delivery/smtpserver/smtp-server.js +666 -0
  124. package/dist_ts/mail/delivery/smtpserver/starttls-handler.d.ts +21 -0
  125. package/dist_ts/mail/delivery/smtpserver/starttls-handler.js +207 -0
  126. package/dist_ts/mail/delivery/smtpserver/tls-handler.d.ts +66 -0
  127. package/dist_ts/mail/delivery/smtpserver/tls-handler.js +261 -0
  128. package/dist_ts/mail/delivery/smtpserver/utils/adaptive-logging.d.ts +117 -0
  129. package/dist_ts/mail/delivery/smtpserver/utils/adaptive-logging.js +411 -0
  130. package/dist_ts/mail/delivery/smtpserver/utils/helpers.d.ts +78 -0
  131. package/dist_ts/mail/delivery/smtpserver/utils/helpers.js +208 -0
  132. package/dist_ts/mail/delivery/smtpserver/utils/logging.d.ts +106 -0
  133. package/dist_ts/mail/delivery/smtpserver/utils/logging.js +181 -0
  134. package/dist_ts/mail/delivery/smtpserver/utils/validation.d.ts +69 -0
  135. package/dist_ts/mail/delivery/smtpserver/utils/validation.js +360 -0
  136. package/dist_ts/mail/index.d.ts +8 -0
  137. package/dist_ts/mail/index.js +13 -0
  138. package/dist_ts/mail/routing/classes.dns.manager.d.ts +65 -0
  139. package/dist_ts/mail/routing/classes.dns.manager.js +413 -0
  140. package/dist_ts/mail/routing/classes.dnsmanager.d.ts +165 -0
  141. package/dist_ts/mail/routing/classes.dnsmanager.js +430 -0
  142. package/dist_ts/mail/routing/classes.domain.registry.d.ts +54 -0
  143. package/dist_ts/mail/routing/classes.domain.registry.js +118 -0
  144. package/dist_ts/mail/routing/classes.email.config.d.ts +64 -0
  145. package/dist_ts/mail/routing/classes.email.config.js +2 -0
  146. package/dist_ts/mail/routing/classes.email.router.d.ts +171 -0
  147. package/dist_ts/mail/routing/classes.email.router.js +491 -0
  148. package/dist_ts/mail/routing/classes.unified.email.server.d.ts +426 -0
  149. package/dist_ts/mail/routing/classes.unified.email.server.js +1454 -0
  150. package/dist_ts/mail/routing/index.d.ts +5 -0
  151. package/dist_ts/mail/routing/index.js +7 -0
  152. package/dist_ts/mail/routing/interfaces.d.ts +187 -0
  153. package/dist_ts/mail/routing/interfaces.js +2 -0
  154. package/dist_ts/mail/security/classes.dkimcreator.d.ts +68 -0
  155. package/dist_ts/mail/security/classes.dkimcreator.js +346 -0
  156. package/dist_ts/mail/security/classes.dkimverifier.d.ts +46 -0
  157. package/dist_ts/mail/security/classes.dkimverifier.js +317 -0
  158. package/dist_ts/mail/security/classes.dmarcverifier.d.ts +123 -0
  159. package/dist_ts/mail/security/classes.dmarcverifier.js +365 -0
  160. package/dist_ts/mail/security/classes.spfverifier.d.ts +103 -0
  161. package/dist_ts/mail/security/classes.spfverifier.js +492 -0
  162. package/dist_ts/mail/security/index.d.ts +4 -0
  163. package/dist_ts/mail/security/index.js +6 -0
  164. package/dist_ts/opsserver/classes.opsserver.d.ts +14 -0
  165. package/dist_ts/opsserver/classes.opsserver.js +37 -0
  166. package/dist_ts/opsserver/index.d.ts +1 -0
  167. package/dist_ts/opsserver/index.js +2 -0
  168. package/dist_ts/paths.d.ts +14 -0
  169. package/dist_ts/paths.js +39 -0
  170. package/dist_ts/plugins.d.ts +43 -0
  171. package/dist_ts/plugins.js +50 -0
  172. package/dist_ts/security/classes.contentscanner.d.ts +160 -0
  173. package/dist_ts/security/classes.contentscanner.js +634 -0
  174. package/dist_ts/security/classes.ipreputationchecker.d.ts +150 -0
  175. package/dist_ts/security/classes.ipreputationchecker.js +508 -0
  176. package/dist_ts/security/classes.securitylogger.d.ts +140 -0
  177. package/dist_ts/security/classes.securitylogger.js +232 -0
  178. package/dist_ts/security/index.d.ts +3 -0
  179. package/dist_ts/security/index.js +4 -0
  180. package/dist_ts/sms/classes.smsservice.d.ts +15 -0
  181. package/dist_ts/sms/classes.smsservice.js +72 -0
  182. package/dist_ts/sms/config/sms.config.d.ts +93 -0
  183. package/dist_ts/sms/config/sms.config.js +2 -0
  184. package/dist_ts/sms/config/sms.schema.d.ts +5 -0
  185. package/dist_ts/sms/config/sms.schema.js +121 -0
  186. package/dist_ts/sms/index.d.ts +1 -0
  187. package/dist_ts/sms/index.js +2 -0
  188. package/dist_ts/storage/classes.storagemanager.d.ts +82 -0
  189. package/dist_ts/storage/classes.storagemanager.js +341 -0
  190. package/dist_ts/storage/index.d.ts +1 -0
  191. package/dist_ts/storage/index.js +3 -0
  192. package/dist_ts/ts/00_commitinfo_data.d.ts +8 -0
  193. package/dist_ts/ts/00_commitinfo_data.js +9 -0
  194. package/dist_ts/ts/classes.dcrouter.d.ts +238 -0
  195. package/dist_ts/ts/classes.dcrouter.js +1008 -0
  196. package/dist_ts/ts/config/index.d.ts +1 -0
  197. package/dist_ts/ts/config/index.js +3 -0
  198. package/dist_ts/ts/config/validator.d.ts +104 -0
  199. package/dist_ts/ts/config/validator.js +152 -0
  200. package/dist_ts/ts/deliverability/classes.ipwarmupmanager.d.ts +253 -0
  201. package/dist_ts/ts/deliverability/classes.ipwarmupmanager.js +639 -0
  202. package/dist_ts/ts/deliverability/classes.senderreputationmonitor.d.ts +300 -0
  203. package/dist_ts/ts/deliverability/classes.senderreputationmonitor.js +961 -0
  204. package/dist_ts/ts/deliverability/index.d.ts +2 -0
  205. package/dist_ts/ts/deliverability/index.js +3 -0
  206. package/dist_ts/ts/errors/base.errors.d.ts +224 -0
  207. package/dist_ts/ts/errors/base.errors.js +310 -0
  208. package/dist_ts/ts/errors/email.errors.d.ts +175 -0
  209. package/dist_ts/ts/errors/email.errors.js +265 -0
  210. package/dist_ts/ts/errors/error-handler.d.ts +98 -0
  211. package/dist_ts/ts/errors/error-handler.js +282 -0
  212. package/dist_ts/ts/errors/error.codes.d.ts +115 -0
  213. package/dist_ts/ts/errors/error.codes.js +136 -0
  214. package/dist_ts/ts/errors/index.d.ts +56 -0
  215. package/dist_ts/ts/errors/index.js +138 -0
  216. package/dist_ts/ts/errors/mta.errors.d.ts +259 -0
  217. package/dist_ts/ts/errors/mta.errors.js +472 -0
  218. package/dist_ts/ts/errors/reputation.errors.d.ts +183 -0
  219. package/dist_ts/ts/errors/reputation.errors.js +292 -0
  220. package/dist_ts/ts/index.d.ts +4 -0
  221. package/dist_ts/ts/index.js +6 -0
  222. package/dist_ts/ts/logger.d.ts +17 -0
  223. package/dist_ts/ts/logger.js +77 -0
  224. package/dist_ts/ts/mail/core/classes.bouncemanager.d.ts +200 -0
  225. package/dist_ts/ts/mail/core/classes.bouncemanager.js +778 -0
  226. package/dist_ts/ts/mail/core/classes.email.d.ts +291 -0
  227. package/dist_ts/ts/mail/core/classes.email.js +780 -0
  228. package/dist_ts/ts/mail/core/classes.emailvalidator.d.ts +61 -0
  229. package/dist_ts/ts/mail/core/classes.emailvalidator.js +182 -0
  230. package/dist_ts/ts/mail/core/classes.templatemanager.d.ts +95 -0
  231. package/dist_ts/ts/mail/core/classes.templatemanager.js +239 -0
  232. package/dist_ts/ts/mail/core/index.d.ts +4 -0
  233. package/dist_ts/ts/mail/core/index.js +6 -0
  234. package/dist_ts/ts/mail/delivery/classes.delivery.queue.d.ts +163 -0
  235. package/dist_ts/ts/mail/delivery/classes.delivery.queue.js +485 -0
  236. package/dist_ts/ts/mail/delivery/classes.delivery.system.d.ts +186 -0
  237. package/dist_ts/ts/mail/delivery/classes.delivery.system.js +846 -0
  238. package/dist_ts/ts/mail/delivery/classes.emailsendjob.d.ts +84 -0
  239. package/dist_ts/ts/mail/delivery/classes.emailsendjob.js +362 -0
  240. package/dist_ts/ts/mail/delivery/classes.emailsignjob.d.ts +18 -0
  241. package/dist_ts/ts/mail/delivery/classes.emailsignjob.js +44 -0
  242. package/dist_ts/ts/mail/delivery/classes.mta.config.d.ts +22 -0
  243. package/dist_ts/ts/mail/delivery/classes.mta.config.js +51 -0
  244. package/dist_ts/ts/mail/delivery/classes.ratelimiter.d.ts +98 -0
  245. package/dist_ts/ts/mail/delivery/classes.ratelimiter.js +205 -0
  246. package/dist_ts/ts/mail/delivery/classes.smtp.client.legacy.d.ts +275 -0
  247. package/dist_ts/ts/mail/delivery/classes.smtp.client.legacy.js +973 -0
  248. package/dist_ts/ts/mail/delivery/classes.unified.rate.limiter.d.ts +200 -0
  249. package/dist_ts/ts/mail/delivery/classes.unified.rate.limiter.js +817 -0
  250. package/dist_ts/ts/mail/delivery/index.d.ts +12 -0
  251. package/dist_ts/ts/mail/delivery/index.js +18 -0
  252. package/dist_ts/ts/mail/delivery/interfaces.d.ts +243 -0
  253. package/dist_ts/ts/mail/delivery/interfaces.js +17 -0
  254. package/dist_ts/ts/mail/delivery/smtpclient/auth-handler.d.ts +43 -0
  255. package/dist_ts/ts/mail/delivery/smtpclient/auth-handler.js +188 -0
  256. package/dist_ts/ts/mail/delivery/smtpclient/command-handler.d.ts +67 -0
  257. package/dist_ts/ts/mail/delivery/smtpclient/command-handler.js +276 -0
  258. package/dist_ts/ts/mail/delivery/smtpclient/connection-manager.d.ts +48 -0
  259. package/dist_ts/ts/mail/delivery/smtpclient/connection-manager.js +238 -0
  260. package/dist_ts/ts/mail/delivery/smtpclient/constants.d.ts +129 -0
  261. package/dist_ts/ts/mail/delivery/smtpclient/constants.js +135 -0
  262. package/dist_ts/ts/mail/delivery/smtpclient/create-client.d.ts +22 -0
  263. package/dist_ts/ts/mail/delivery/smtpclient/create-client.js +86 -0
  264. package/dist_ts/ts/mail/delivery/smtpclient/error-handler.d.ts +28 -0
  265. package/dist_ts/ts/mail/delivery/smtpclient/error-handler.js +110 -0
  266. package/dist_ts/ts/mail/delivery/smtpclient/index.d.ts +16 -0
  267. package/dist_ts/ts/mail/delivery/smtpclient/index.js +21 -0
  268. package/dist_ts/ts/mail/delivery/smtpclient/interfaces.d.ts +183 -0
  269. package/dist_ts/ts/mail/delivery/smtpclient/interfaces.js +19 -0
  270. package/dist_ts/ts/mail/delivery/smtpclient/smtp-client.d.ts +58 -0
  271. package/dist_ts/ts/mail/delivery/smtpclient/smtp-client.js +279 -0
  272. package/dist_ts/ts/mail/delivery/smtpclient/tls-handler.d.ts +33 -0
  273. package/dist_ts/ts/mail/delivery/smtpclient/tls-handler.js +202 -0
  274. package/dist_ts/ts/mail/delivery/smtpclient/utils/helpers.d.ts +77 -0
  275. package/dist_ts/ts/mail/delivery/smtpclient/utils/helpers.js +196 -0
  276. package/dist_ts/ts/mail/delivery/smtpclient/utils/logging.d.ts +46 -0
  277. package/dist_ts/ts/mail/delivery/smtpclient/utils/logging.js +153 -0
  278. package/dist_ts/ts/mail/delivery/smtpclient/utils/validation.d.ts +38 -0
  279. package/dist_ts/ts/mail/delivery/smtpclient/utils/validation.js +139 -0
  280. package/dist_ts/ts/mail/delivery/smtpserver/certificate-utils.d.ts +45 -0
  281. package/dist_ts/ts/mail/delivery/smtpserver/certificate-utils.js +345 -0
  282. package/dist_ts/ts/mail/delivery/smtpserver/command-handler.d.ts +156 -0
  283. package/dist_ts/ts/mail/delivery/smtpserver/command-handler.js +1159 -0
  284. package/dist_ts/ts/mail/delivery/smtpserver/connection-manager.d.ts +159 -0
  285. package/dist_ts/ts/mail/delivery/smtpserver/connection-manager.js +894 -0
  286. package/dist_ts/ts/mail/delivery/smtpserver/constants.d.ts +130 -0
  287. package/dist_ts/ts/mail/delivery/smtpserver/constants.js +162 -0
  288. package/dist_ts/ts/mail/delivery/smtpserver/create-server.d.ts +14 -0
  289. package/dist_ts/ts/mail/delivery/smtpserver/create-server.js +28 -0
  290. package/dist_ts/ts/mail/delivery/smtpserver/data-handler.d.ts +123 -0
  291. package/dist_ts/ts/mail/delivery/smtpserver/data-handler.js +1148 -0
  292. package/dist_ts/ts/mail/delivery/smtpserver/index.d.ts +20 -0
  293. package/dist_ts/ts/mail/delivery/smtpserver/index.js +27 -0
  294. package/dist_ts/ts/mail/delivery/smtpserver/interfaces.d.ts +530 -0
  295. package/dist_ts/ts/mail/delivery/smtpserver/interfaces.js +10 -0
  296. package/dist_ts/ts/mail/delivery/smtpserver/secure-server.d.ts +15 -0
  297. package/dist_ts/ts/mail/delivery/smtpserver/secure-server.js +79 -0
  298. package/dist_ts/ts/mail/delivery/smtpserver/security-handler.d.ts +86 -0
  299. package/dist_ts/ts/mail/delivery/smtpserver/security-handler.js +234 -0
  300. package/dist_ts/ts/mail/delivery/smtpserver/session-manager.d.ts +140 -0
  301. package/dist_ts/ts/mail/delivery/smtpserver/session-manager.js +469 -0
  302. package/dist_ts/ts/mail/delivery/smtpserver/smtp-server.d.ts +137 -0
  303. package/dist_ts/ts/mail/delivery/smtpserver/smtp-server.js +666 -0
  304. package/dist_ts/ts/mail/delivery/smtpserver/starttls-handler.d.ts +21 -0
  305. package/dist_ts/ts/mail/delivery/smtpserver/starttls-handler.js +207 -0
  306. package/dist_ts/ts/mail/delivery/smtpserver/tls-handler.d.ts +66 -0
  307. package/dist_ts/ts/mail/delivery/smtpserver/tls-handler.js +261 -0
  308. package/dist_ts/ts/mail/delivery/smtpserver/utils/adaptive-logging.d.ts +117 -0
  309. package/dist_ts/ts/mail/delivery/smtpserver/utils/adaptive-logging.js +411 -0
  310. package/dist_ts/ts/mail/delivery/smtpserver/utils/helpers.d.ts +78 -0
  311. package/dist_ts/ts/mail/delivery/smtpserver/utils/helpers.js +208 -0
  312. package/dist_ts/ts/mail/delivery/smtpserver/utils/logging.d.ts +106 -0
  313. package/dist_ts/ts/mail/delivery/smtpserver/utils/logging.js +181 -0
  314. package/dist_ts/ts/mail/delivery/smtpserver/utils/validation.d.ts +69 -0
  315. package/dist_ts/ts/mail/delivery/smtpserver/utils/validation.js +360 -0
  316. package/dist_ts/ts/mail/index.d.ts +8 -0
  317. package/dist_ts/ts/mail/index.js +13 -0
  318. package/dist_ts/ts/mail/routing/classes.dns.manager.d.ts +65 -0
  319. package/dist_ts/ts/mail/routing/classes.dns.manager.js +413 -0
  320. package/dist_ts/ts/mail/routing/classes.dnsmanager.d.ts +165 -0
  321. package/dist_ts/ts/mail/routing/classes.dnsmanager.js +430 -0
  322. package/dist_ts/ts/mail/routing/classes.domain.registry.d.ts +54 -0
  323. package/dist_ts/ts/mail/routing/classes.domain.registry.js +118 -0
  324. package/dist_ts/ts/mail/routing/classes.email.config.d.ts +64 -0
  325. package/dist_ts/ts/mail/routing/classes.email.config.js +2 -0
  326. package/dist_ts/ts/mail/routing/classes.email.router.d.ts +171 -0
  327. package/dist_ts/ts/mail/routing/classes.email.router.js +491 -0
  328. package/dist_ts/ts/mail/routing/classes.unified.email.server.d.ts +426 -0
  329. package/dist_ts/ts/mail/routing/classes.unified.email.server.js +1454 -0
  330. package/dist_ts/ts/mail/routing/index.d.ts +5 -0
  331. package/dist_ts/ts/mail/routing/index.js +7 -0
  332. package/dist_ts/ts/mail/routing/interfaces.d.ts +187 -0
  333. package/dist_ts/ts/mail/routing/interfaces.js +2 -0
  334. package/dist_ts/ts/mail/security/classes.dkimcreator.d.ts +68 -0
  335. package/dist_ts/ts/mail/security/classes.dkimcreator.js +346 -0
  336. package/dist_ts/ts/mail/security/classes.dkimverifier.d.ts +46 -0
  337. package/dist_ts/ts/mail/security/classes.dkimverifier.js +317 -0
  338. package/dist_ts/ts/mail/security/classes.dmarcverifier.d.ts +123 -0
  339. package/dist_ts/ts/mail/security/classes.dmarcverifier.js +365 -0
  340. package/dist_ts/ts/mail/security/classes.spfverifier.d.ts +103 -0
  341. package/dist_ts/ts/mail/security/classes.spfverifier.js +492 -0
  342. package/dist_ts/ts/mail/security/index.d.ts +4 -0
  343. package/dist_ts/ts/mail/security/index.js +6 -0
  344. package/dist_ts/ts/opsserver/classes.opsserver.d.ts +20 -0
  345. package/dist_ts/ts/opsserver/classes.opsserver.js +44 -0
  346. package/dist_ts/ts/opsserver/handlers/admin.handler.d.ts +31 -0
  347. package/dist_ts/ts/opsserver/handlers/admin.handler.js +177 -0
  348. package/dist_ts/ts/opsserver/handlers/config.handler.d.ts +10 -0
  349. package/dist_ts/ts/opsserver/handlers/config.handler.js +100 -0
  350. package/dist_ts/ts/opsserver/handlers/index.d.ts +5 -0
  351. package/dist_ts/ts/opsserver/handlers/index.js +6 -0
  352. package/dist_ts/ts/opsserver/handlers/logs.handler.d.ts +10 -0
  353. package/dist_ts/ts/opsserver/handlers/logs.handler.js +121 -0
  354. package/dist_ts/ts/opsserver/handlers/security.handler.d.ts +11 -0
  355. package/dist_ts/ts/opsserver/handlers/security.handler.js +118 -0
  356. package/dist_ts/ts/opsserver/handlers/stats.handler.d.ts +13 -0
  357. package/dist_ts/ts/opsserver/handlers/stats.handler.js +233 -0
  358. package/dist_ts/ts/opsserver/helpers/guards.d.ts +25 -0
  359. package/dist_ts/ts/opsserver/helpers/guards.js +41 -0
  360. package/dist_ts/ts/opsserver/index.d.ts +1 -0
  361. package/dist_ts/ts/opsserver/index.js +2 -0
  362. package/dist_ts/ts/paths.d.ts +14 -0
  363. package/dist_ts/ts/paths.js +39 -0
  364. package/dist_ts/ts/plugins.d.ts +46 -0
  365. package/dist_ts/ts/plugins.js +53 -0
  366. package/dist_ts/ts/security/classes.contentscanner.d.ts +160 -0
  367. package/dist_ts/ts/security/classes.contentscanner.js +634 -0
  368. package/dist_ts/ts/security/classes.ipreputationchecker.d.ts +150 -0
  369. package/dist_ts/ts/security/classes.ipreputationchecker.js +508 -0
  370. package/dist_ts/ts/security/classes.securitylogger.d.ts +140 -0
  371. package/dist_ts/ts/security/classes.securitylogger.js +232 -0
  372. package/dist_ts/ts/security/index.d.ts +3 -0
  373. package/dist_ts/ts/security/index.js +4 -0
  374. package/dist_ts/ts/sms/classes.smsservice.d.ts +15 -0
  375. package/dist_ts/ts/sms/classes.smsservice.js +72 -0
  376. package/dist_ts/ts/sms/config/sms.config.d.ts +93 -0
  377. package/dist_ts/ts/sms/config/sms.config.js +2 -0
  378. package/dist_ts/ts/sms/config/sms.schema.d.ts +5 -0
  379. package/dist_ts/ts/sms/config/sms.schema.js +121 -0
  380. package/dist_ts/ts/sms/index.d.ts +1 -0
  381. package/dist_ts/ts/sms/index.js +2 -0
  382. package/dist_ts/ts/storage/classes.storagemanager.d.ts +82 -0
  383. package/dist_ts/ts/storage/classes.storagemanager.js +341 -0
  384. package/dist_ts/ts/storage/index.d.ts +1 -0
  385. package/dist_ts/ts/storage/index.js +3 -0
  386. package/dist_ts/ts_interfaces/data/auth.d.ts +8 -0
  387. package/dist_ts/ts_interfaces/data/auth.js +2 -0
  388. package/dist_ts/ts_interfaces/data/index.d.ts +2 -0
  389. package/dist_ts/ts_interfaces/data/index.js +3 -0
  390. package/dist_ts/ts_interfaces/data/stats.d.ts +93 -0
  391. package/dist_ts/ts_interfaces/data/stats.js +2 -0
  392. package/dist_ts/ts_interfaces/index.d.ts +5 -0
  393. package/dist_ts/ts_interfaces/index.js +8 -0
  394. package/dist_ts/ts_interfaces/plugins.d.ts +2 -0
  395. package/dist_ts/ts_interfaces/plugins.js +4 -0
  396. package/dist_ts/ts_interfaces/requests/admin.d.ts +31 -0
  397. package/dist_ts/ts_interfaces/requests/admin.js +3 -0
  398. package/dist_ts/ts_interfaces/requests/config.d.ts +25 -0
  399. package/dist_ts/ts_interfaces/requests/config.js +3 -0
  400. package/dist_ts/ts_interfaces/requests/index.d.ts +4 -0
  401. package/dist_ts/ts_interfaces/requests/index.js +5 -0
  402. package/dist_ts/ts_interfaces/requests/logs.d.ts +34 -0
  403. package/dist_ts/ts_interfaces/requests/logs.js +4 -0
  404. package/dist_ts/ts_interfaces/requests/stats.d.ts +131 -0
  405. package/dist_ts/ts_interfaces/requests/stats.js +4 -0
  406. package/html/index.html +121 -0
  407. package/npmextra.json +45 -0
  408. package/package.json +83 -0
  409. package/readme.hints.md +906 -0
  410. package/readme.md +1253 -0
  411. package/readme.opsserver.md +351 -0
  412. package/test/helpers/server.loader.ts +347 -0
  413. package/test/helpers/smtp.client.ts +209 -0
  414. package/test/helpers/utils.ts +311 -0
  415. package/test/readme.md +443 -0
  416. package/test/suite/smtpclient_commands/test.ccmd-01.ehlo-helo-sending.ts +168 -0
  417. package/test/suite/smtpclient_commands/test.ccmd-02.mail-from-parameters.ts +277 -0
  418. package/test/suite/smtpclient_commands/test.ccmd-03.rcpt-to-multiple.ts +283 -0
  419. package/test/suite/smtpclient_commands/test.ccmd-04.data-transmission.ts +274 -0
  420. package/test/suite/smtpclient_commands/test.ccmd-05.auth-mechanisms.ts +306 -0
  421. package/test/suite/smtpclient_commands/test.ccmd-06.command-pipelining.ts +233 -0
  422. package/test/suite/smtpclient_commands/test.ccmd-07.response-parsing.ts +243 -0
  423. package/test/suite/smtpclient_commands/test.ccmd-08.rset-command.ts +333 -0
  424. package/test/suite/smtpclient_commands/test.ccmd-09.noop-command.ts +339 -0
  425. package/test/suite/smtpclient_commands/test.ccmd-10.vrfy-expn.ts +457 -0
  426. package/test/suite/smtpclient_commands/test.ccmd-11.help-command.ts +409 -0
  427. package/test/suite/smtpclient_connection/test.ccm-01.basic-tcp-connection.ts +150 -0
  428. package/test/suite/smtpclient_connection/test.ccm-02.tls-connection.ts +140 -0
  429. package/test/suite/smtpclient_connection/test.ccm-03.starttls-upgrade.ts +208 -0
  430. package/test/suite/smtpclient_connection/test.ccm-04.connection-pooling.ts +250 -0
  431. package/test/suite/smtpclient_connection/test.ccm-05.connection-reuse.ts +288 -0
  432. package/test/suite/smtpclient_connection/test.ccm-06.connection-timeout.ts +267 -0
  433. package/test/suite/smtpclient_connection/test.ccm-07.automatic-reconnection.ts +324 -0
  434. package/test/suite/smtpclient_connection/test.ccm-08.dns-resolution.ts +139 -0
  435. package/test/suite/smtpclient_connection/test.ccm-09.ipv6-dual-stack.ts +167 -0
  436. package/test/suite/smtpclient_connection/test.ccm-10.proxy-support.ts +305 -0
  437. package/test/suite/smtpclient_connection/test.ccm-11.keepalive.ts +299 -0
  438. package/test/suite/smtpclient_edge-cases/test.cedge-01.unusual-server-responses.ts +529 -0
  439. package/test/suite/smtpclient_edge-cases/test.cedge-02.malformed-commands.ts +438 -0
  440. package/test/suite/smtpclient_edge-cases/test.cedge-03.protocol-violations.ts +446 -0
  441. package/test/suite/smtpclient_edge-cases/test.cedge-04.resource-constraints.ts +530 -0
  442. package/test/suite/smtpclient_edge-cases/test.cedge-05.encoding-issues.ts +145 -0
  443. package/test/suite/smtpclient_edge-cases/test.cedge-06.large-headers.ts +180 -0
  444. package/test/suite/smtpclient_edge-cases/test.cedge-07.concurrent-operations.ts +204 -0
  445. package/test/suite/smtpclient_email-composition/test.cep-01.basic-headers.ts +245 -0
  446. package/test/suite/smtpclient_email-composition/test.cep-02.mime-multipart.ts +321 -0
  447. package/test/suite/smtpclient_email-composition/test.cep-03.attachment-encoding.ts +334 -0
  448. package/test/suite/smtpclient_email-composition/test.cep-04.bcc-handling.ts +187 -0
  449. package/test/suite/smtpclient_email-composition/test.cep-05.reply-to-return-path.ts +277 -0
  450. package/test/suite/smtpclient_email-composition/test.cep-06.utf8-international.ts +235 -0
  451. package/test/suite/smtpclient_email-composition/test.cep-07.html-inline-images.ts +489 -0
  452. package/test/suite/smtpclient_email-composition/test.cep-08.custom-headers.ts +293 -0
  453. package/test/suite/smtpclient_email-composition/test.cep-09.priority-importance.ts +314 -0
  454. package/test/suite/smtpclient_email-composition/test.cep-10.receipts-dsn.ts +411 -0
  455. package/test/suite/smtpclient_error-handling/test.cerr-01.4xx-errors.ts +232 -0
  456. package/test/suite/smtpclient_error-handling/test.cerr-02.5xx-errors.ts +309 -0
  457. package/test/suite/smtpclient_error-handling/test.cerr-03.network-failures.ts +299 -0
  458. package/test/suite/smtpclient_error-handling/test.cerr-04.greylisting-handling.ts +255 -0
  459. package/test/suite/smtpclient_error-handling/test.cerr-05.quota-exceeded.ts +273 -0
  460. package/test/suite/smtpclient_error-handling/test.cerr-06.invalid-recipients.ts +320 -0
  461. package/test/suite/smtpclient_error-handling/test.cerr-07.message-size-limits.ts +320 -0
  462. package/test/suite/smtpclient_error-handling/test.cerr-08.rate-limiting.ts +261 -0
  463. package/test/suite/smtpclient_error-handling/test.cerr-09.connection-pool-errors.ts +299 -0
  464. package/test/suite/smtpclient_error-handling/test.cerr-10.partial-failure.ts +373 -0
  465. package/test/suite/smtpclient_performance/test.cperf-01.bulk-sending.ts +332 -0
  466. package/test/suite/smtpclient_performance/test.cperf-02.message-throughput.ts +304 -0
  467. package/test/suite/smtpclient_performance/test.cperf-03.memory-usage.ts +332 -0
  468. package/test/suite/smtpclient_performance/test.cperf-04.cpu-utilization.ts +373 -0
  469. package/test/suite/smtpclient_performance/test.cperf-05.network-efficiency.ts +181 -0
  470. package/test/suite/smtpclient_performance/test.cperf-06.caching-strategies.ts +190 -0
  471. package/test/suite/smtpclient_performance/test.cperf-07.queue-management.ts +171 -0
  472. package/test/suite/smtpclient_performance/test.cperf-08.dns-caching.ts +50 -0
  473. package/test/suite/smtpclient_reliability/test.crel-01.reconnection-logic.ts +305 -0
  474. package/test/suite/smtpclient_reliability/test.crel-02.network-interruption.ts +207 -0
  475. package/test/suite/smtpclient_reliability/test.crel-03.queue-persistence.ts +469 -0
  476. package/test/suite/smtpclient_reliability/test.crel-04.crash-recovery.ts +520 -0
  477. package/test/suite/smtpclient_reliability/test.crel-05.memory-leaks.ts +503 -0
  478. package/test/suite/smtpclient_reliability/test.crel-06.concurrency-safety.ts +558 -0
  479. package/test/suite/smtpclient_reliability/test.crel-07.resource-cleanup.ts +52 -0
  480. package/test/suite/smtpclient_rfc-compliance/test.crfc-01.rfc5321-client.ts +283 -0
  481. package/test/suite/smtpclient_rfc-compliance/test.crfc-02.esmtp-compliance.ts +77 -0
  482. package/test/suite/smtpclient_rfc-compliance/test.crfc-03.command-syntax.ts +67 -0
  483. package/test/suite/smtpclient_rfc-compliance/test.crfc-04.response-codes.ts +54 -0
  484. package/test/suite/smtpclient_rfc-compliance/test.crfc-05.state-machine.ts +703 -0
  485. package/test/suite/smtpclient_rfc-compliance/test.crfc-06.protocol-negotiation.ts +688 -0
  486. package/test/suite/smtpclient_rfc-compliance/test.crfc-07.interoperability.ts +728 -0
  487. package/test/suite/smtpclient_rfc-compliance/test.crfc-08.smtp-extensions.ts +656 -0
  488. package/test/suite/smtpclient_security/test.csec-01.tls-verification.ts +88 -0
  489. package/test/suite/smtpclient_security/test.csec-02.oauth2-authentication.ts +132 -0
  490. package/test/suite/smtpclient_security/test.csec-03.dkim-signing.ts +138 -0
  491. package/test/suite/smtpclient_security/test.csec-04.spf-compliance.ts +163 -0
  492. package/test/suite/smtpclient_security/test.csec-05.dmarc-policy.ts +200 -0
  493. package/test/suite/smtpclient_security/test.csec-06.certificate-validation.ts +145 -0
  494. package/test/suite/smtpclient_security/test.csec-07.cipher-suites.ts +153 -0
  495. package/test/suite/smtpclient_security/test.csec-08.authentication-fallback.ts +154 -0
  496. package/test/suite/smtpclient_security/test.csec-09.relay-restrictions.ts +166 -0
  497. package/test/suite/smtpclient_security/test.csec-10.anti-spam-measures.ts +196 -0
  498. package/test/suite/smtpserver_commands/test.cmd-01.ehlo-command.ts +193 -0
  499. package/test/suite/smtpserver_commands/test.cmd-02.mail-from.ts +330 -0
  500. package/test/suite/smtpserver_commands/test.cmd-03.rcpt-to.ts +296 -0
  501. package/test/suite/smtpserver_commands/test.cmd-04.data-command.ts +395 -0
  502. package/test/suite/smtpserver_commands/test.cmd-05.noop-command.ts +320 -0
  503. package/test/suite/smtpserver_commands/test.cmd-06.rset-command.ts +399 -0
  504. package/test/suite/smtpserver_commands/test.cmd-07.vrfy-command.ts +391 -0
  505. package/test/suite/smtpserver_commands/test.cmd-08.expn-command.ts +450 -0
  506. package/test/suite/smtpserver_commands/test.cmd-09.size-extension.ts +465 -0
  507. package/test/suite/smtpserver_commands/test.cmd-10.help-command.ts +454 -0
  508. package/test/suite/smtpserver_commands/test.cmd-11.command-pipelining.ts +334 -0
  509. package/test/suite/smtpserver_commands/test.cmd-12.helo-command.ts +420 -0
  510. package/test/suite/smtpserver_commands/test.cmd-13.quit-command.ts +384 -0
  511. package/test/suite/smtpserver_connection/test.cm-01.tls-connection.ts +61 -0
  512. package/test/suite/smtpserver_connection/test.cm-02.multiple-connections.ts +112 -0
  513. package/test/suite/smtpserver_connection/test.cm-03.connection-timeout.ts +134 -0
  514. package/test/suite/smtpserver_connection/test.cm-04.connection-limits.ts +374 -0
  515. package/test/suite/smtpserver_connection/test.cm-05.connection-rejection.ts +296 -0
  516. package/test/suite/smtpserver_connection/test.cm-06.starttls-upgrade.ts +468 -0
  517. package/test/suite/smtpserver_connection/test.cm-07.abrupt-disconnection.ts +321 -0
  518. package/test/suite/smtpserver_connection/test.cm-08.tls-versions.ts +361 -0
  519. package/test/suite/smtpserver_connection/test.cm-09.tls-ciphers.ts +556 -0
  520. package/test/suite/smtpserver_connection/test.cm-10.plain-connection.ts +293 -0
  521. package/test/suite/smtpserver_connection/test.cm-11.keepalive.ts +382 -0
  522. package/test/suite/smtpserver_edge-cases/test.edge-01.very-large-email.ts +239 -0
  523. package/test/suite/smtpserver_edge-cases/test.edge-02.very-small-email.ts +389 -0
  524. package/test/suite/smtpserver_edge-cases/test.edge-03.invalid-character-handling.ts +479 -0
  525. package/test/suite/smtpserver_edge-cases/test.edge-04.empty-commands.ts +430 -0
  526. package/test/suite/smtpserver_edge-cases/test.edge-05.extremely-long-lines.ts +425 -0
  527. package/test/suite/smtpserver_edge-cases/test.edge-06.extremely-long-headers.ts +404 -0
  528. package/test/suite/smtpserver_edge-cases/test.edge-07.unusual-mime-types.ts +333 -0
  529. package/test/suite/smtpserver_edge-cases/test.edge-08.nested-mime-structures.ts +379 -0
  530. package/test/suite/smtpserver_email-processing/test.ep-01.basic-email-sending.ts +338 -0
  531. package/test/suite/smtpserver_email-processing/test.ep-02.invalid-email-addresses.ts +315 -0
  532. package/test/suite/smtpserver_email-processing/test.ep-03.multiple-recipients.ts +493 -0
  533. package/test/suite/smtpserver_email-processing/test.ep-04.large-email.ts +528 -0
  534. package/test/suite/smtpserver_email-processing/test.ep-05.mime-handling.ts +515 -0
  535. package/test/suite/smtpserver_email-processing/test.ep-06.attachment-handling.ts +629 -0
  536. package/test/suite/smtpserver_email-processing/test.ep-07.special-character-handling.ts +462 -0
  537. package/test/suite/smtpserver_email-processing/test.ep-08.email-routing.ts +527 -0
  538. package/test/suite/smtpserver_email-processing/test.ep-09.delivery-status-notifications.ts +486 -0
  539. package/test/suite/smtpserver_error-handling/test.err-01.syntax-errors.ts +475 -0
  540. package/test/suite/smtpserver_error-handling/test.err-02.invalid-sequence.ts +450 -0
  541. package/test/suite/smtpserver_error-handling/test.err-03.temporary-failures.ts +453 -0
  542. package/test/suite/smtpserver_error-handling/test.err-04.permanent-failures.ts +325 -0
  543. package/test/suite/smtpserver_error-handling/test.err-05.resource-exhaustion.ts +302 -0
  544. package/test/suite/smtpserver_error-handling/test.err-06.malformed-mime.ts +374 -0
  545. package/test/suite/smtpserver_error-handling/test.err-07.exception-handling.ts +333 -0
  546. package/test/suite/smtpserver_error-handling/test.err-08.error-logging.ts +324 -0
  547. package/test/suite/smtpserver_performance/test.perf-01.throughput.ts +183 -0
  548. package/test/suite/smtpserver_performance/test.perf-02.concurrency.ts +388 -0
  549. package/test/suite/smtpserver_performance/test.perf-03.cpu-utilization.ts +245 -0
  550. package/test/suite/smtpserver_performance/test.perf-04.memory-usage.ts +238 -0
  551. package/test/suite/smtpserver_performance/test.perf-05.connection-processing-time.ts +363 -0
  552. package/test/suite/smtpserver_performance/test.perf-06.message-processing-time.ts +252 -0
  553. package/test/suite/smtpserver_performance/test.perf-07.resource-cleanup.ts +317 -0
  554. package/test/suite/smtpserver_reliability/test.rel-01.long-running-operation.ts +344 -0
  555. package/test/suite/smtpserver_reliability/test.rel-02.restart-recovery.ts +328 -0
  556. package/test/suite/smtpserver_reliability/test.rel-03.resource-leak-detection.ts +394 -0
  557. package/test/suite/smtpserver_reliability/test.rel-04.error-recovery.ts +401 -0
  558. package/test/suite/smtpserver_reliability/test.rel-05.dns-resolution-failure.ts +335 -0
  559. package/test/suite/smtpserver_reliability/test.rel-06.network-interruption.ts +410 -0
  560. package/test/suite/smtpserver_rfc-compliance/test.rfc-01.rfc5321-compliance.ts +382 -0
  561. package/test/suite/smtpserver_rfc-compliance/test.rfc-02.rfc5322-compliance.ts +428 -0
  562. package/test/suite/smtpserver_rfc-compliance/test.rfc-03.rfc7208-spf-compliance.ts +330 -0
  563. package/test/suite/smtpserver_rfc-compliance/test.rfc-04.rfc6376-dkim-compliance.ts +450 -0
  564. package/test/suite/smtpserver_rfc-compliance/test.rfc-05.rfc7489-dmarc-compliance.ts +408 -0
  565. package/test/suite/smtpserver_rfc-compliance/test.rfc-06.rfc8314-tls-compliance.ts +366 -0
  566. package/test/suite/smtpserver_rfc-compliance/test.rfc-07.rfc3461-dsn-compliance.ts +399 -0
  567. package/test/suite/smtpserver_security/test.sec-01.authentication.ts +218 -0
  568. package/test/suite/smtpserver_security/test.sec-02.authorization.ts +286 -0
  569. package/test/suite/smtpserver_security/test.sec-03.dkim-processing.ts +414 -0
  570. package/test/suite/smtpserver_security/test.sec-04.spf-checking.ts +280 -0
  571. package/test/suite/smtpserver_security/test.sec-05.dmarc-policy.ts +374 -0
  572. package/test/suite/smtpserver_security/test.sec-06.ip-reputation.ts +303 -0
  573. package/test/suite/smtpserver_security/test.sec-07.content-scanning.ts +409 -0
  574. package/test/suite/smtpserver_security/test.sec-08.rate-limiting.ts +324 -0
  575. package/test/suite/smtpserver_security/test.sec-09.tls-certificate-validation.ts +312 -0
  576. package/test/suite/smtpserver_security/test.sec-10.header-injection-prevention.ts +332 -0
  577. package/test/suite/smtpserver_security/test.sec-11.bounce-management.ts +363 -0
  578. package/test/test.base.ts +65 -0
  579. package/test/test.bouncemanager.ts +196 -0
  580. package/test/test.config.md +175 -0
  581. package/test/test.contentscanner.ts +265 -0
  582. package/test/test.dcrouter.email.ts +201 -0
  583. package/test/test.deliverability.ts +55 -0
  584. package/test/test.dns-manager-creation.ts +141 -0
  585. package/test/test.dns-mode-switching.ts +257 -0
  586. package/test/test.dns-server-config.ts +140 -0
  587. package/test/test.dns-socket-handler.ts +169 -0
  588. package/test/test.dns-validation.ts +283 -0
  589. package/test/test.email-socket-handler.ts +228 -0
  590. package/test/test.email.integration.ts +377 -0
  591. package/test/test.email.router.ts +283 -0
  592. package/test/test.emailauth.ts +195 -0
  593. package/test/test.errors.ts +408 -0
  594. package/test/test.integration.storage.ts +313 -0
  595. package/test/test.integration.ts +75 -0
  596. package/test/test.ipreputationchecker.ts +179 -0
  597. package/test/test.ipwarmupmanager.ts +323 -0
  598. package/test/test.jwt-auth.ts +130 -0
  599. package/test/test.minimal.ts +66 -0
  600. package/test/test.opsserver-api.ts +83 -0
  601. package/test/test.protected-endpoint.ts +115 -0
  602. package/test/test.rate-limiting-integration.ts +236 -0
  603. package/test/test.ratelimiter.ts +141 -0
  604. package/test/test.reputationmonitor.ts +262 -0
  605. package/test/test.smartmail.ts +248 -0
  606. package/test/test.smtp.client.compatibility.ts +154 -0
  607. package/test/test.smtp.client.ts +191 -0
  608. package/test/test.smtp.server.ts +180 -0
  609. package/test/test.socket-handler-integration.ts +240 -0
  610. package/test/test.socket-handler-unit.ts +198 -0
  611. package/test/test.storagemanager.ts +289 -0
  612. package/ts/00_commitinfo_data.ts +8 -0
  613. package/ts/classes.dcrouter.ts +1310 -0
  614. package/ts/config/index.ts +2 -0
  615. package/ts/config/validator.ts +266 -0
  616. package/ts/deliverability/classes.ipwarmupmanager.ts +896 -0
  617. package/ts/deliverability/classes.senderreputationmonitor.ts +1244 -0
  618. package/ts/deliverability/index.ts +13 -0
  619. package/ts/errors/base.errors.ts +525 -0
  620. package/ts/errors/email.errors.ts +383 -0
  621. package/ts/errors/error-handler.ts +412 -0
  622. package/ts/errors/error.codes.ts +165 -0
  623. package/ts/errors/index.ts +195 -0
  624. package/ts/errors/mta.errors.ts +681 -0
  625. package/ts/errors/reputation.errors.ts +422 -0
  626. package/ts/index.ts +7 -0
  627. package/ts/logger.ts +91 -0
  628. package/ts/mail/core/classes.bouncemanager.ts +965 -0
  629. package/ts/mail/core/classes.email.ts +941 -0
  630. package/ts/mail/core/classes.emailvalidator.ts +239 -0
  631. package/ts/mail/core/classes.templatemanager.ts +320 -0
  632. package/ts/mail/core/index.ts +5 -0
  633. package/ts/mail/delivery/classes.delivery.queue.ts +645 -0
  634. package/ts/mail/delivery/classes.delivery.system.ts +1089 -0
  635. package/ts/mail/delivery/classes.emailsendjob.ts +447 -0
  636. package/ts/mail/delivery/classes.emailsendjob.ts.backup +691 -0
  637. package/ts/mail/delivery/classes.emailsignjob.ts +67 -0
  638. package/ts/mail/delivery/classes.mta.config.ts +73 -0
  639. package/ts/mail/delivery/classes.ratelimiter.ts +281 -0
  640. package/ts/mail/delivery/classes.smtp.client.legacy.ts +1422 -0
  641. package/ts/mail/delivery/classes.unified.rate.limiter.ts +1053 -0
  642. package/ts/mail/delivery/index.ts +24 -0
  643. package/ts/mail/delivery/interfaces.ts +291 -0
  644. package/ts/mail/delivery/smtpclient/auth-handler.ts +232 -0
  645. package/ts/mail/delivery/smtpclient/command-handler.ts +343 -0
  646. package/ts/mail/delivery/smtpclient/connection-manager.ts +289 -0
  647. package/ts/mail/delivery/smtpclient/constants.ts +145 -0
  648. package/ts/mail/delivery/smtpclient/create-client.ts +94 -0
  649. package/ts/mail/delivery/smtpclient/error-handler.ts +141 -0
  650. package/ts/mail/delivery/smtpclient/index.ts +24 -0
  651. package/ts/mail/delivery/smtpclient/interfaces.ts +242 -0
  652. package/ts/mail/delivery/smtpclient/smtp-client.ts +357 -0
  653. package/ts/mail/delivery/smtpclient/tls-handler.ts +254 -0
  654. package/ts/mail/delivery/smtpclient/utils/helpers.ts +224 -0
  655. package/ts/mail/delivery/smtpclient/utils/logging.ts +212 -0
  656. package/ts/mail/delivery/smtpclient/utils/validation.ts +170 -0
  657. package/ts/mail/delivery/smtpserver/certificate-utils.ts +398 -0
  658. package/ts/mail/delivery/smtpserver/command-handler.ts +1340 -0
  659. package/ts/mail/delivery/smtpserver/connection-manager.ts +1045 -0
  660. package/ts/mail/delivery/smtpserver/constants.ts +181 -0
  661. package/ts/mail/delivery/smtpserver/create-server.ts +31 -0
  662. package/ts/mail/delivery/smtpserver/data-handler.ts +1283 -0
  663. package/ts/mail/delivery/smtpserver/index.ts +32 -0
  664. package/ts/mail/delivery/smtpserver/interfaces.ts +655 -0
  665. package/ts/mail/delivery/smtpserver/secure-server.ts +97 -0
  666. package/ts/mail/delivery/smtpserver/security-handler.ts +345 -0
  667. package/ts/mail/delivery/smtpserver/session-manager.ts +557 -0
  668. package/ts/mail/delivery/smtpserver/smtp-server.ts +804 -0
  669. package/ts/mail/delivery/smtpserver/starttls-handler.ts +262 -0
  670. package/ts/mail/delivery/smtpserver/tls-handler.ts +346 -0
  671. package/ts/mail/delivery/smtpserver/utils/adaptive-logging.ts +514 -0
  672. package/ts/mail/delivery/smtpserver/utils/helpers.ts +246 -0
  673. package/ts/mail/delivery/smtpserver/utils/logging.ts +246 -0
  674. package/ts/mail/delivery/smtpserver/utils/validation.ts +436 -0
  675. package/ts/mail/index.ts +19 -0
  676. package/ts/mail/routing/classes.dns.manager.ts +563 -0
  677. package/ts/mail/routing/classes.dnsmanager.ts +559 -0
  678. package/ts/mail/routing/classes.domain.registry.ts +139 -0
  679. package/ts/mail/routing/classes.email.config.ts +82 -0
  680. package/ts/mail/routing/classes.email.router.ts +575 -0
  681. package/ts/mail/routing/classes.unified.email.server.ts +1873 -0
  682. package/ts/mail/routing/index.ts +6 -0
  683. package/ts/mail/routing/interfaces.ts +202 -0
  684. package/ts/mail/security/classes.dkimcreator.ts +431 -0
  685. package/ts/mail/security/classes.dkimverifier.ts +382 -0
  686. package/ts/mail/security/classes.dmarcverifier.ts +478 -0
  687. package/ts/mail/security/classes.spfverifier.ts +606 -0
  688. package/ts/mail/security/index.ts +5 -0
  689. package/ts/opsserver/classes.opsserver.ts +65 -0
  690. package/ts/opsserver/handlers/admin.handler.ts +240 -0
  691. package/ts/opsserver/handlers/config.handler.ts +150 -0
  692. package/ts/opsserver/handlers/index.ts +5 -0
  693. package/ts/opsserver/handlers/logs.handler.ts +195 -0
  694. package/ts/opsserver/handlers/security.handler.ts +208 -0
  695. package/ts/opsserver/handlers/stats.handler.ts +344 -0
  696. package/ts/opsserver/helpers/guards.ts +56 -0
  697. package/ts/opsserver/index.ts +1 -0
  698. package/ts/paths.ts +48 -0
  699. package/ts/plugins.ts +94 -0
  700. package/ts/security/classes.contentscanner.ts +739 -0
  701. package/ts/security/classes.ipreputationchecker.ts +592 -0
  702. package/ts/security/classes.securitylogger.ts +299 -0
  703. package/ts/security/index.ts +21 -0
  704. package/ts/sms/classes.smsservice.ts +98 -0
  705. package/ts/sms/config/sms.config.ts +109 -0
  706. package/ts/sms/config/sms.schema.ts +122 -0
  707. package/ts/sms/index.ts +1 -0
  708. package/ts/storage/classes.storagemanager.ts +400 -0
  709. package/ts/storage/index.ts +2 -0
  710. package/ts/tspublish.json +3 -0
  711. package/ts_interfaces/data/auth.ts +8 -0
  712. package/ts_interfaces/data/index.ts +2 -0
  713. package/ts_interfaces/data/stats.ts +101 -0
  714. package/ts_interfaces/index.ts +9 -0
  715. package/ts_interfaces/plugins.ts +6 -0
  716. package/ts_interfaces/requests/admin.ts +46 -0
  717. package/ts_interfaces/requests/config.ts +35 -0
  718. package/ts_interfaces/requests/index.ts +4 -0
  719. package/ts_interfaces/requests/logs.ts +44 -0
  720. package/ts_interfaces/requests/stats.ts +162 -0
  721. package/ts_interfaces/tspublish.json +3 -0
  722. package/ts_web/00_commitinfo_data.ts +8 -0
  723. package/ts_web/appstate.ts +361 -0
  724. package/ts_web/elements/index.ts +7 -0
  725. package/ts_web/elements/ops-dashboard.ts +165 -0
  726. package/ts_web/elements/ops-view-config.ts +268 -0
  727. package/ts_web/elements/ops-view-logs.ts +207 -0
  728. package/ts_web/elements/ops-view-overview.ts +222 -0
  729. package/ts_web/elements/ops-view-security.ts +471 -0
  730. package/ts_web/elements/ops-view-stats.ts +299 -0
  731. package/ts_web/elements/shared/css.ts +10 -0
  732. package/ts_web/elements/shared/index.ts +2 -0
  733. package/ts_web/elements/shared/ops-sectionheading.ts +42 -0
  734. package/ts_web/index.ts +9 -0
  735. package/ts_web/plugins.ts +11 -0
  736. package/ts_web/tspublish.json +3 -0
  737. package/tsconfig.json +15 -0
package/readme.md ADDED
@@ -0,0 +1,1253 @@
1
+ # dcrouter
2
+
3
+ **dcrouter: a traffic router intended to be gating your datacenter.**
4
+
5
+ A comprehensive traffic routing solution that provides unified gateway capabilities for HTTP/HTTPS, TCP/SNI, email (SMTP), and DNS protocols. Designed for enterprises requiring robust traffic management, automatic certificate provisioning, and enterprise-grade email infrastructure.
6
+
7
+ ## Table of Contents
8
+
9
+ - [Features](#features)
10
+ - [Installation](#installation)
11
+ - [Quick Start](#quick-start)
12
+ - [Architecture](#architecture)
13
+ - [Configuration](#configuration)
14
+ - [Email System](#email-system)
15
+ - [SmartProxy Routing](#smartproxy-routing)
16
+ - [Security Features](#security-features)
17
+ - [API Reference](#api-reference)
18
+ - [Examples](#examples)
19
+ - [Troubleshooting](#troubleshooting)
20
+
21
+ ## Features
22
+
23
+ ### 🌐 **Universal Traffic Router**
24
+ - **HTTP/HTTPS routing** with pattern matching and virtual hosts
25
+ - **TCP/SNI proxy** for any protocol with TLS termination/passthrough
26
+ - **DNS server** with authoritative and dynamic record management
27
+ - **Multi-protocol support** on the same infrastructure
28
+
29
+ ### 🔒 **Enterprise Security**
30
+ - **Automatic TLS certificates** via ACME with DNS-01 challenges
31
+ - **IP reputation checking** and real-time threat detection
32
+ - **Content scanning** for spam, viruses, and malicious content
33
+ - **Comprehensive security logging** with correlation tracking
34
+
35
+ ### 📧 **Complete Email Infrastructure**
36
+ - **Multi-domain SMTP server** on standard ports (25, 587, 465)
37
+ - **Pattern-based email routing** with three processing modes
38
+ - **DKIM, SPF, DMARC** authentication and verification
39
+ - **Enterprise deliverability** with IP warmup and reputation management
40
+
41
+ ### ⚡ **High Performance**
42
+ - **Connection pooling** and efficient resource management
43
+ - **Load balancing** with automatic failover
44
+ - **Rate limiting** at multiple levels
45
+ - **Real-time metrics** and monitoring
46
+
47
+ ### 💾 **Flexible Storage System**
48
+ - **Multiple storage backends**: filesystem, custom functions, or memory
49
+ - **Unified storage interface** for all components
50
+ - **Automatic data migration** between backends
51
+ - **Persistent configuration** for domains, routes, and security data
52
+
53
+ ## Installation
54
+
55
+ ```bash
56
+ npm install @serve.zone/dcrouter --save
57
+ ```
58
+
59
+ ### Prerequisites
60
+
61
+ - Node.js 18+ with ES modules support
62
+ - Valid domain with DNS control (for ACME certificates)
63
+ - Cloudflare API token (for DNS challenges)
64
+
65
+ ## Quick Start
66
+
67
+ ### Basic HTTP/HTTPS Router
68
+
69
+ ```typescript
70
+ import { DcRouter } from '@serve.zone/dcrouter';
71
+
72
+ const router = new DcRouter({
73
+ smartProxyConfig: {
74
+ routes: [
75
+ {
76
+ name: 'web-service',
77
+ match: { domains: ['example.com'], ports: [443] },
78
+ action: {
79
+ type: 'forward',
80
+ target: { host: '192.168.1.10', port: 8080 },
81
+ tls: { mode: 'terminate', certificate: 'auto' }
82
+ }
83
+ }
84
+ ],
85
+ acme: {
86
+ email: 'admin@example.com',
87
+ enabled: true,
88
+ useProduction: true
89
+ }
90
+ }
91
+ });
92
+
93
+ await router.start();
94
+ console.log('DcRouter started successfully');
95
+ ```
96
+
97
+ ### Basic Email Router
98
+
99
+ ```typescript
100
+ import { DcRouter } from '@serve.zone/dcrouter';
101
+
102
+ const router = new DcRouter({
103
+ emailConfig: {
104
+ ports: [25, 587, 465],
105
+ hostname: 'mail.example.com',
106
+ routes: [
107
+ {
108
+ name: 'local-mail',
109
+ match: { recipients: '*@example.com' },
110
+ action: {
111
+ type: 'process',
112
+ process: {
113
+ scan: true,
114
+ dkim: true,
115
+ queue: 'normal'
116
+ }
117
+ }
118
+ }
119
+ ],
120
+ tls: {
121
+ keyPath: './certs/key.pem',
122
+ certPath: './certs/cert.pem'
123
+ }
124
+ }
125
+ });
126
+
127
+ await router.start();
128
+ ```
129
+
130
+ ## Architecture
131
+
132
+ ### System Overview
133
+
134
+ ```mermaid
135
+ graph TB
136
+ subgraph "External Traffic"
137
+ HTTP[HTTP/HTTPS Clients]
138
+ SMTP[SMTP Clients]
139
+ TCP[TCP Clients]
140
+ DNS[DNS Queries]
141
+ end
142
+
143
+ subgraph "DcRouter Core"
144
+ DcRouter[DcRouter Orchestrator]
145
+ SmartProxy[SmartProxy Engine]
146
+ EmailServer[Unified Email Server]
147
+ DnsServer[DNS Server]
148
+ CertManager[Certificate Manager]
149
+ end
150
+
151
+ subgraph "Backend Services"
152
+ WebServices[Web Services]
153
+ MailServers[Mail Servers]
154
+ Databases[Databases]
155
+ APIs[Internal APIs]
156
+ end
157
+
158
+ HTTP --> SmartProxy
159
+ TCP --> SmartProxy
160
+ SMTP --> EmailServer
161
+ DNS --> DnsServer
162
+
163
+ DcRouter --> SmartProxy
164
+ DcRouter --> EmailServer
165
+ DcRouter --> DnsServer
166
+ DcRouter --> CertManager
167
+
168
+ SmartProxy --> WebServices
169
+ SmartProxy --> APIs
170
+ EmailServer --> MailServers
171
+ EmailServer --> Databases
172
+
173
+ CertManager -.-> SmartProxy
174
+ CertManager -.-> EmailServer
175
+ ```
176
+
177
+ ### Core Components
178
+
179
+ #### **DcRouter Orchestrator**
180
+ Central coordination engine that manages all services and provides unified configuration.
181
+
182
+ #### **SmartProxy Engine**
183
+ High-performance HTTP/HTTPS and TCP/SNI proxy with:
184
+ - Pattern-based routing
185
+ - TLS termination/passthrough
186
+ - Load balancing
187
+ - Connection pooling
188
+
189
+ #### **Unified Email Server**
190
+ Enterprise-grade SMTP server with:
191
+ - Multi-domain support
192
+ - Pattern-based routing
193
+ - Three processing modes
194
+ - Complete authentication stack
195
+
196
+ #### **Certificate Manager**
197
+ Automatic TLS certificate provisioning via ACME with DNS-01 challenges.
198
+
199
+ ## Configuration
200
+
201
+ ### Complete Configuration Interface
202
+
203
+ ```typescript
204
+ interface IDcRouterOptions {
205
+ // SmartProxy configuration for HTTP/HTTPS/TCP routing
206
+ smartProxyConfig?: {
207
+ routes: IRouteConfig[];
208
+ acme?: IAcmeConfig;
209
+ allowSessionTicket?: boolean;
210
+ };
211
+
212
+ // Email system configuration
213
+ emailConfig?: {
214
+ ports: number[];
215
+ hostname: string;
216
+ domains?: IEmailDomainConfig[]; // Domain infrastructure setup
217
+ routes: IEmailRoute[]; // Route-based email handling
218
+ auth?: IAuthConfig;
219
+ tls?: ITlsConfig;
220
+ maxMessageSize?: number;
221
+ rateLimits?: IRateLimitConfig;
222
+ useSocketHandler?: boolean; // Enable socket-handler mode (no port binding)
223
+ defaults?: { // Global defaults for all domains
224
+ dnsMode?: 'forward' | 'internal-dns' | 'external-dns';
225
+ dkim?: IDkimConfig;
226
+ rateLimits?: IRateLimitConfig;
227
+ };
228
+ };
229
+
230
+ // DNS server configuration
231
+ dnsServerConfig?: {
232
+ port?: number;
233
+ authoritative?: boolean;
234
+ records?: IDnsRecord[];
235
+ };
236
+
237
+ // DNS domain for automatic DNS-over-HTTPS setup
238
+ dnsDomain?: string; // e.g., 'dns.example.com'
239
+
240
+ // TLS and certificate configuration
241
+ tls?: {
242
+ contactEmail: string;
243
+ domain: string;
244
+ };
245
+
246
+ // DNS challenge configuration
247
+ dnsChallenge?: {
248
+ cloudflareApiKey: string;
249
+ };
250
+
251
+ // Storage configuration
252
+ storage?: {
253
+ fsPath?: string; // Filesystem storage path
254
+ readFunction?: (key: string) => Promise<string>; // Custom read function
255
+ writeFunction?: (key: string, value: string) => Promise<void>; // Custom write function
256
+ };
257
+ }
258
+ ```
259
+
260
+ ### Route Configuration
261
+
262
+ ```typescript
263
+ interface IRouteConfig {
264
+ name: string;
265
+ priority?: number;
266
+ match: {
267
+ domains?: string[];
268
+ ports?: number | number[] | { from: number; to: number }[];
269
+ };
270
+ action: {
271
+ type: 'forward' | 'redirect' | 'serve';
272
+ target?: {
273
+ host: string;
274
+ port: number | 'preserve' | ((context: any) => number);
275
+ };
276
+ tls?: {
277
+ mode: 'terminate' | 'passthrough';
278
+ certificate?: 'auto' | string;
279
+ };
280
+ security?: {
281
+ ipAllowList?: string[];
282
+ ipBlockList?: string[];
283
+ };
284
+ };
285
+ }
286
+ ```
287
+
288
+ ## Socket-Handler Mode
289
+
290
+ DcRouter supports an advanced socket-handler mode that eliminates internal port binding for both DNS and email services. Instead of services listening on internal ports, SmartProxy passes sockets directly to the services.
291
+
292
+ ### DNS Socket-Handler
293
+
294
+ When `dnsDomain` is configured, DcRouter automatically:
295
+ - Sets up DNS server for UDP on port 53
296
+ - Creates SmartProxy routes for DNS-over-HTTPS (DoH) on the specified domain
297
+ - Uses socket-handler for HTTPS/DoH traffic (no HTTPS port binding)
298
+
299
+ ```typescript
300
+ const router = new DcRouter({
301
+ dnsDomain: 'dns.example.com', // Enables DNS with DoH
302
+ smartProxyConfig: {
303
+ // DNS routes are automatically created
304
+ }
305
+ });
306
+ ```
307
+
308
+ This creates:
309
+ - UDP DNS service on port 53 (standard DNS queries)
310
+ - HTTPS routes for `dns.example.com/dns-query` and `dns.example.com/resolve`
311
+ - Automatic TLS certificates via Let's Encrypt
312
+
313
+ ### Email Socket-Handler
314
+
315
+ When `useSocketHandler` is enabled in email config:
316
+ - Email server doesn't bind to any ports
317
+ - SmartProxy passes sockets directly to email handlers
318
+ - Reduces latency and resource usage
319
+
320
+ ```typescript
321
+ const router = new DcRouter({
322
+ emailConfig: {
323
+ ports: [25, 587, 465],
324
+ hostname: 'mail.example.com',
325
+ useSocketHandler: true, // Enable socket-handler mode
326
+ routes: [/* email routes */]
327
+ }
328
+ });
329
+ ```
330
+
331
+ ### Benefits of Socket-Handler Mode
332
+
333
+ 1. **Performance**: Eliminates internal port forwarding overhead
334
+ 2. **Security**: No exposed internal ports
335
+ 3. **Resource Efficiency**: Fewer open ports and listeners
336
+ 4. **Simplified Networking**: Direct socket passing
337
+ 5. **Automatic Configuration**: Routes created automatically
338
+
339
+ ### Traditional vs Socket-Handler Mode
340
+
341
+ **Traditional Mode (default):**
342
+ ```
343
+ External Port → SmartProxy → Internal Port → Service
344
+ 25 → 10025 → Email
345
+ ```
346
+
347
+ **Socket-Handler Mode:**
348
+ ```
349
+ External Port → SmartProxy → Socket Handler → Service
350
+ 25 → (direct socket) → Email
351
+ ```
352
+
353
+ ## Email System
354
+
355
+ ### Email Domain Configuration
356
+
357
+ DcRouter separates email infrastructure (which domains to handle) from routing logic (how to handle emails):
358
+
359
+ #### **DNS Modes**
360
+
361
+ **Forward Mode** - Simple mail forwarding without local DNS:
362
+ ```typescript
363
+ {
364
+ domain: 'forwarded.com',
365
+ dnsMode: 'forward',
366
+ dns: {
367
+ forward: {
368
+ skipDnsValidation: true,
369
+ targetDomain: 'mail.target.com'
370
+ }
371
+ }
372
+ }
373
+ ```
374
+
375
+ **Internal DNS Mode** - Use built-in DNS server (requires `dnsDomain` in DcRouter config):
376
+ ```typescript
377
+ {
378
+ domain: 'mail.example.com',
379
+ dnsMode: 'internal-dns',
380
+ dns: {
381
+ internal: {
382
+ mxPriority: 10,
383
+ ttl: 3600
384
+ }
385
+ },
386
+ dkim: {
387
+ selector: 'mail2024',
388
+ keySize: 2048,
389
+ rotateKeys: true,
390
+ rotationInterval: 90
391
+ }
392
+ }
393
+ ```
394
+
395
+ **External DNS Mode** - Use existing DNS infrastructure:
396
+ ```typescript
397
+ {
398
+ domain: 'mail.external.com',
399
+ dnsMode: 'external-dns',
400
+ dns: {
401
+ external: {
402
+ requiredRecords: ['MX', 'SPF', 'DKIM', 'DMARC']
403
+ }
404
+ },
405
+ rateLimits: {
406
+ inbound: {
407
+ messagesPerMinute: 100,
408
+ connectionsPerIp: 10
409
+ }
410
+ }
411
+ }
412
+ ```
413
+
414
+ #### **DKIM Management**
415
+
416
+ DKIM is always enabled for all domains. Keys are automatically:
417
+ - Generated on first use
418
+ - Stored persistently via StorageManager
419
+ - Rotated based on configuration
420
+ - Cleaned up after grace period
421
+
422
+ ### Email Route Actions
423
+
424
+ #### **Forward Action**
425
+ Routes emails to external SMTP servers.
426
+
427
+ ```typescript
428
+ {
429
+ name: 'forward-to-internal',
430
+ match: { recipients: '*@company.com' },
431
+ action: {
432
+ type: 'forward',
433
+ forward: {
434
+ host: 'internal-mail.company.com',
435
+ port: 25,
436
+ auth: {
437
+ username: 'relay-user',
438
+ password: 'relay-pass'
439
+ },
440
+ addHeaders: {
441
+ 'X-Forwarded-By': 'dcrouter'
442
+ }
443
+ }
444
+ }
445
+ }
446
+ ```
447
+
448
+ #### **Process Action**
449
+ Full Mail Transfer Agent functionality with scanning and delivery queues.
450
+
451
+ ```typescript
452
+ {
453
+ name: 'process-notifications',
454
+ match: { recipients: '*@notifications.company.com' },
455
+ action: {
456
+ type: 'process',
457
+ process: {
458
+ scan: true,
459
+ dkim: true,
460
+ queue: 'priority'
461
+ }
462
+ }
463
+ }
464
+ ```
465
+
466
+ #### **Deliver Action**
467
+ Local delivery for mailbox storage.
468
+
469
+ ```typescript
470
+ {
471
+ name: 'deliver-local',
472
+ match: { recipients: '*@marketing.company.com' },
473
+ action: {
474
+ type: 'deliver'
475
+ }
476
+ }
477
+ ```
478
+
479
+ #### **Reject Action**
480
+ Reject emails with custom SMTP responses.
481
+
482
+ ```typescript
483
+ {
484
+ name: 'reject-spam',
485
+ match: {
486
+ senders: '*@spam-domain.com',
487
+ sizeRange: { min: 1000000 } // > 1MB
488
+ },
489
+ action: {
490
+ type: 'reject',
491
+ reject: {
492
+ code: 550,
493
+ message: 'Message rejected due to policy'
494
+ }
495
+ }
496
+ }
497
+ ```
498
+
499
+ ### Common Email Routing Patterns
500
+
501
+ #### **IP-Based Relay**
502
+ Allow internal networks to relay through the server:
503
+ ```typescript
504
+ {
505
+ name: 'office-relay',
506
+ priority: 100,
507
+ match: { clientIp: ['192.168.0.0/16', '10.0.0.0/8'] },
508
+ action: {
509
+ type: 'forward',
510
+ forward: { host: 'internal-mail.company.com', port: 25 }
511
+ }
512
+ }
513
+ ```
514
+
515
+ #### **Domain-Based Routing**
516
+ Route different domains to different servers:
517
+ ```typescript
518
+ {
519
+ name: 'partner-domain',
520
+ match: { recipients: '*@partner.com' },
521
+ action: {
522
+ type: 'forward',
523
+ forward: { host: 'partner-mail.com', port: 587 }
524
+ }
525
+ }
526
+ ```
527
+
528
+ #### **Authentication-Based Processing**
529
+ Different handling for authenticated vs unauthenticated senders:
530
+ ```typescript
531
+ {
532
+ name: 'authenticated-users',
533
+ match: { authenticated: true },
534
+ action: {
535
+ type: 'process',
536
+ process: { scan: false, dkim: true, queue: 'priority' }
537
+ }
538
+ },
539
+ {
540
+ name: 'unauthenticated-reject',
541
+ match: { authenticated: false },
542
+ action: {
543
+ type: 'reject',
544
+ reject: { code: 550, message: 'Authentication required' }
545
+ }
546
+ }
547
+ ```
548
+
549
+ #### **Content-Based Filtering**
550
+ Filter based on size, subject, or headers:
551
+ ```typescript
552
+ {
553
+ name: 'large-email-reject',
554
+ match: { sizeRange: { min: 25000000 } }, // > 25MB
555
+ action: {
556
+ type: 'reject',
557
+ reject: { code: 552, message: 'Message too large' }
558
+ }
559
+ },
560
+ {
561
+ name: 'priority-emails',
562
+ match: {
563
+ headers: { 'X-Priority': 'high' },
564
+ subject: /urgent|emergency/i
565
+ },
566
+ action: {
567
+ type: 'process',
568
+ process: { queue: 'priority' }
569
+ }
570
+ }
571
+ ```
572
+
573
+ ### Email Security Features
574
+
575
+ #### **Route Matching Patterns**
576
+
577
+ **Glob Pattern Matching**
578
+ ```typescript
579
+ // Email address patterns
580
+ match: { recipients: '*@example.com' } // All addresses at domain
581
+ match: { recipients: 'admin@*' } // Admin at any domain
582
+ match: { senders: ['*@trusted.com', '*@partner.com'] } // Multiple patterns
583
+
584
+ // CIDR IP matching
585
+ match: { clientIp: '192.168.0.0/16' } // Private subnet
586
+ match: { clientIp: ['10.0.0.0/8', '172.16.0.0/12'] } // Multiple ranges
587
+
588
+ // Header matching
589
+ match: {
590
+ headers: {
591
+ 'X-Priority': 'high',
592
+ 'Subject': /urgent|emergency/i
593
+ }
594
+ }
595
+
596
+ // Size and content matching
597
+ match: {
598
+ sizeRange: { min: 1000, max: 5000000 }, // 1KB to 5MB
599
+ hasAttachments: true,
600
+ subject: /invoice|receipt/i
601
+ }
602
+ ```
603
+
604
+ #### **Content Scanning**
605
+ ```typescript
606
+ const scanners = [
607
+ {
608
+ type: 'spam',
609
+ threshold: 5.0,
610
+ action: 'tag',
611
+ headers: ['X-Spam-Score', 'X-Spam-Status']
612
+ },
613
+ {
614
+ type: 'virus',
615
+ action: 'reject',
616
+ quarantine: true
617
+ },
618
+ {
619
+ type: 'attachment',
620
+ blockedExtensions: ['.exe', '.bat', '.scr'],
621
+ maxSize: 25 * 1024 * 1024 // 25MB
622
+ }
623
+ ];
624
+ ```
625
+
626
+ ## SmartProxy Routing
627
+
628
+ ### HTTP/HTTPS Routing
629
+
630
+ ```typescript
631
+ const routes = [
632
+ // API routing with path-based forwarding
633
+ {
634
+ name: 'api-gateway',
635
+ match: {
636
+ domains: ['api.example.com'],
637
+ ports: [443]
638
+ },
639
+ action: {
640
+ type: 'forward',
641
+ target: {
642
+ host: '192.168.1.20',
643
+ port: (context) => {
644
+ // Route based on path
645
+ if (context.path.startsWith('/v1/')) return 8080;
646
+ if (context.path.startsWith('/v2/')) return 8081;
647
+ return 8080;
648
+ }
649
+ },
650
+ tls: {
651
+ mode: 'terminate',
652
+ certificate: 'auto'
653
+ }
654
+ }
655
+ },
656
+
657
+ // Static file serving
658
+ {
659
+ name: 'static-assets',
660
+ match: {
661
+ domains: ['cdn.example.com'],
662
+ ports: [443]
663
+ },
664
+ action: {
665
+ type: 'serve',
666
+ root: '/var/www/static',
667
+ tls: {
668
+ mode: 'terminate',
669
+ certificate: 'auto'
670
+ }
671
+ }
672
+ }
673
+ ];
674
+ ```
675
+
676
+ ### TCP/SNI Routing
677
+
678
+ ```typescript
679
+ const tcpRoutes = [
680
+ // Database connection routing
681
+ {
682
+ name: 'database-cluster',
683
+ match: {
684
+ ports: [{ from: 5432, to: 5439 }]
685
+ },
686
+ action: {
687
+ type: 'forward',
688
+ target: {
689
+ host: '192.168.1.30',
690
+ port: 'preserve'
691
+ },
692
+ security: {
693
+ ipAllowList: ['192.168.1.0/24']
694
+ }
695
+ }
696
+ },
697
+
698
+ // SNI-based routing for TLS services
699
+ {
700
+ name: 'secure-service',
701
+ match: {
702
+ domains: ['secure.example.com'],
703
+ ports: [8443]
704
+ },
705
+ action: {
706
+ type: 'forward',
707
+ target: {
708
+ host: '192.168.1.40',
709
+ port: 8443
710
+ },
711
+ tls: {
712
+ mode: 'passthrough'
713
+ }
714
+ }
715
+ }
716
+ ];
717
+ ```
718
+
719
+ ## Storage System
720
+
721
+ ### StorageManager
722
+
723
+ DcRouter includes a flexible storage system that supports multiple backends:
724
+
725
+ #### **Filesystem Storage**
726
+ ```typescript
727
+ const router = new DcRouter({
728
+ storage: {
729
+ fsPath: '/var/lib/dcrouter/data'
730
+ }
731
+ });
732
+ ```
733
+
734
+ #### **Custom Storage Backend**
735
+ ```typescript
736
+ const router = new DcRouter({
737
+ storage: {
738
+ readFunction: async (key) => {
739
+ // Read from Redis, S3, etc.
740
+ return await myDatabase.get(key);
741
+ },
742
+ writeFunction: async (key, value) => {
743
+ // Write to Redis, S3, etc.
744
+ await myDatabase.set(key, value);
745
+ }
746
+ }
747
+ });
748
+ ```
749
+
750
+ #### **Memory Storage (Development)**
751
+ ```typescript
752
+ const router = new DcRouter({
753
+ // No storage config = memory storage with warning
754
+ });
755
+ ```
756
+
757
+ ### Storage Usage
758
+
759
+ The storage system is used for:
760
+ - **DKIM Keys**: `/email/dkim/{domain}/private.key`, `/email/dkim/{domain}/public.key`
761
+ - **Email Routes**: `/email/routes/{routeId}.json`
762
+ - **Bounce Lists**: `/email/bounces/suppression.json`
763
+ - **IP Reputation**: `/security/ip-reputation/{ip}.json`
764
+ - **Domain Configs**: `/email/domains/{domain}.json`
765
+
766
+ ### Data Migration
767
+
768
+ Migrate data between storage backends:
769
+
770
+ ```typescript
771
+ import { StorageManager } from '@serve.zone/dcrouter';
772
+
773
+ // Export from filesystem
774
+ const fsStorage = new StorageManager({ fsPath: './data' });
775
+ const keys = await fsStorage.list('/');
776
+ const data = {};
777
+ for (const key of keys) {
778
+ data[key] = await fsStorage.get(key);
779
+ }
780
+
781
+ // Import to cloud storage
782
+ const cloudStorage = new StorageManager({
783
+ readFunction: cloudRead,
784
+ writeFunction: cloudWrite
785
+ });
786
+ for (const [key, value] of Object.entries(data)) {
787
+ await cloudStorage.set(key, value);
788
+ }
789
+ ```
790
+
791
+ ## Security Features
792
+
793
+ ### IP Reputation Checking
794
+
795
+ ```typescript
796
+ import { IpReputationChecker } from '@serve.zone/dcrouter';
797
+
798
+ const ipChecker = new IpReputationChecker({
799
+ providers: ['spamhaus', 'barracuda', 'surbl'],
800
+ cacheTimeout: 3600000, // 1 hour
801
+ threshold: 0.7
802
+ });
803
+
804
+ // Check IP reputation
805
+ const result = await ipChecker.checkIp('192.0.2.1');
806
+ if (result.isBlocked) {
807
+ console.log(`IP blocked: ${result.reason}`);
808
+ }
809
+ ```
810
+
811
+ ### Content Security Scanner
812
+
813
+ ```typescript
814
+ import { ContentScanner } from '@serve.zone/dcrouter';
815
+
816
+ const scanner = new ContentScanner({
817
+ spamThreshold: 5.0,
818
+ virusScanning: true,
819
+ attachmentFiltering: {
820
+ maxSize: 25 * 1024 * 1024,
821
+ blockedTypes: ['.exe', '.bat', '.scr']
822
+ }
823
+ });
824
+
825
+ const scanResult = await scanner.scanEmail(email);
826
+ ```
827
+
828
+ ## API Reference
829
+
830
+ ### DcRouter Class
831
+
832
+ #### Constructor
833
+ ```typescript
834
+ constructor(options: IDcRouterOptions)
835
+ ```
836
+
837
+ #### Methods
838
+
839
+ ##### `start(): Promise<void>`
840
+ Starts all configured services (SmartProxy, email server, DNS server).
841
+
842
+ ##### `stop(): Promise<void>`
843
+ Gracefully stops all services.
844
+
845
+ ##### `updateRoutes(routes: IRouteConfig[]): Promise<void>`
846
+ Updates SmartProxy routes dynamically.
847
+
848
+ ##### `updateDomainRules(rules: IDomainRule[]): Promise<void>`
849
+ Updates email domain routing rules.
850
+
851
+ ##### `getStats(): IStatsResponse`
852
+ Returns real-time statistics for all services.
853
+
854
+ ### Email Service API
855
+
856
+ #### `sendEmail(options: IEmailOptions): Promise<string>`
857
+ ```typescript
858
+ const emailId = await router.emailService.sendEmail({
859
+ from: 'sender@example.com',
860
+ to: 'recipient@example.com',
861
+ subject: 'Test Email',
862
+ html: '<p>Hello World</p>',
863
+ attachments: []
864
+ });
865
+ ```
866
+
867
+ #### `getEmailStatus(emailId: string): IEmailStatus`
868
+ ```typescript
869
+ const status = router.emailService.getEmailStatus(emailId);
870
+ console.log(status.status); // 'pending', 'sent', 'delivered', 'bounced'
871
+ ```
872
+
873
+ #### `getDeliveryReport(emailId: string): IDeliveryReport`
874
+ Detailed delivery information including bounce reasons and tracking data.
875
+
876
+ ## Examples
877
+
878
+ ### Complete Enterprise Setup
879
+
880
+ ```typescript
881
+ import { DcRouter } from '@serve.zone/dcrouter';
882
+
883
+ const router = new DcRouter({
884
+ // HTTP/HTTPS routing
885
+ smartProxyConfig: {
886
+ routes: [
887
+ // Main website
888
+ {
889
+ name: 'website',
890
+ priority: 100,
891
+ match: { domains: ['example.com', 'www.example.com'], ports: [443] },
892
+ action: {
893
+ type: 'forward',
894
+ target: { host: '192.168.1.10', port: 80 },
895
+ tls: { mode: 'terminate', certificate: 'auto' }
896
+ }
897
+ },
898
+
899
+ // API services
900
+ {
901
+ name: 'api',
902
+ priority: 110,
903
+ match: { domains: ['api.example.com'], ports: [443] },
904
+ action: {
905
+ type: 'forward',
906
+ target: { host: '192.168.1.20', port: 8080 },
907
+ tls: { mode: 'terminate', certificate: 'auto' }
908
+ }
909
+ },
910
+
911
+ // Internal services
912
+ {
913
+ name: 'internal',
914
+ match: { ports: [{ from: 8000, to: 8999 }] },
915
+ action: {
916
+ type: 'forward',
917
+ target: { host: '192.168.1.30', port: 'preserve' },
918
+ security: { ipAllowList: ['192.168.0.0/16'] }
919
+ }
920
+ }
921
+ ],
922
+
923
+ // ACME certificate automation
924
+ acme: {
925
+ email: 'ssl@example.com',
926
+ enabled: true,
927
+ useProduction: true,
928
+ autoRenew: true
929
+ }
930
+ },
931
+
932
+ // Enterprise email system
933
+ emailConfig: {
934
+ ports: [25, 587, 465],
935
+ hostname: 'mail.example.com',
936
+
937
+ // Domain configuration
938
+ domains: [
939
+ {
940
+ domain: 'example.com',
941
+ dnsMode: 'external-dns',
942
+ dkim: {
943
+ selector: 'mail',
944
+ rotateKeys: true
945
+ }
946
+ },
947
+ {
948
+ domain: 'notifications.example.com',
949
+ dnsMode: 'internal-dns',
950
+ rateLimits: {
951
+ outbound: { messagesPerHour: 10000 }
952
+ }
953
+ }
954
+ ],
955
+
956
+ // Authentication configuration
957
+ auth: {
958
+ required: true,
959
+ methods: ['PLAIN', 'LOGIN']
960
+ },
961
+
962
+ // TLS configuration
963
+ tls: {
964
+ keyPath: './certs/mail-key.pem',
965
+ certPath: './certs/mail-cert.pem'
966
+ },
967
+
968
+ // Email routing rules
969
+ routes: [
970
+ // Relay from office network
971
+ {
972
+ name: 'office-relay',
973
+ priority: 100,
974
+ match: { clientIp: '192.168.0.0/16' },
975
+ action: {
976
+ type: 'forward',
977
+ forward: {
978
+ host: 'internal-mail.example.com',
979
+ port: 25
980
+ }
981
+ }
982
+ },
983
+
984
+ // Transactional emails via processing
985
+ {
986
+ name: 'notifications',
987
+ priority: 50,
988
+ match: { recipients: '*@notifications.example.com' },
989
+ action: {
990
+ type: 'process',
991
+ process: {
992
+ scan: true,
993
+ dkim: true,
994
+ queue: 'priority'
995
+ }
996
+ }
997
+ },
998
+
999
+ // Internal emails forwarded to Exchange
1000
+ {
1001
+ name: 'internal-mail',
1002
+ priority: 25,
1003
+ match: { recipients: '*@example.com' },
1004
+ action: {
1005
+ type: 'forward',
1006
+ forward: {
1007
+ host: 'exchange.internal.example.com',
1008
+ port: 25
1009
+ }
1010
+ }
1011
+ },
1012
+
1013
+ // Default reject
1014
+ {
1015
+ name: 'default-reject',
1016
+ match: { recipients: '*' },
1017
+ action: {
1018
+ type: 'reject',
1019
+ reject: {
1020
+ code: 550,
1021
+ message: 'Relay denied'
1022
+ }
1023
+ }
1024
+ }
1025
+ ]
1026
+ },
1027
+
1028
+ // DNS server for ACME challenges
1029
+ dnsServerConfig: {
1030
+ port: 53,
1031
+ authoritative: true
1032
+ },
1033
+
1034
+ // Cloudflare DNS challenges
1035
+ dnsChallenge: {
1036
+ cloudflareApiKey: process.env.CLOUDFLARE_API_KEY
1037
+ },
1038
+
1039
+ // Persistent storage
1040
+ storage: {
1041
+ fsPath: '/var/lib/dcrouter/data'
1042
+ }
1043
+ });
1044
+
1045
+ // Start the router
1046
+ await router.start();
1047
+ console.log('Enterprise DcRouter started');
1048
+
1049
+ // Monitor statistics
1050
+ setInterval(() => {
1051
+ const stats = router.getStats();
1052
+ console.log('Active connections:', stats.activeConnections);
1053
+ console.log('Emails processed:', stats.emailsProcessed);
1054
+ }, 60000);
1055
+ ```
1056
+
1057
+ ### Email Template System
1058
+
1059
+ ```typescript
1060
+ import { EmailService, TemplateManager } from '@serve.zone/dcrouter';
1061
+
1062
+ // Setup email templates
1063
+ const templateManager = new TemplateManager();
1064
+ templateManager.addTemplate('welcome', {
1065
+ subject: 'Welcome to {{company}}!',
1066
+ html: `
1067
+ <h1>Welcome {{name}}!</h1>
1068
+ <p>Thank you for joining {{company}}.</p>
1069
+ <p>Your account: {{email}}</p>
1070
+ `,
1071
+ text: 'Welcome {{name}}! Thank you for joining {{company}}.'
1072
+ });
1073
+
1074
+ // Send templated email
1075
+ const emailService = new EmailService(router);
1076
+ await emailService.sendTemplatedEmail('welcome', {
1077
+ to: 'user@example.com',
1078
+ templateData: {
1079
+ name: 'John Doe',
1080
+ company: 'Example Corp',
1081
+ email: 'user@example.com'
1082
+ }
1083
+ });
1084
+ ```
1085
+
1086
+ ## Troubleshooting
1087
+
1088
+ ### Common Issues
1089
+
1090
+ #### Certificate Issues
1091
+ ```bash
1092
+ # Check certificate status
1093
+ curl -I https://your-domain.com
1094
+
1095
+ # Verify ACME challenge accessibility
1096
+ curl http://your-domain.com/.well-known/acme-challenge/test
1097
+ ```
1098
+
1099
+ #### Email Delivery Issues
1100
+ ```bash
1101
+ # Test SMTP connectivity
1102
+ telnet your-server.com 25
1103
+
1104
+ # Check DKIM record
1105
+ dig TXT mail._domainkey.your-domain.com
1106
+
1107
+ # Verify SPF record
1108
+ dig TXT your-domain.com
1109
+ ```
1110
+
1111
+ #### Email Routing Issues
1112
+
1113
+ **Route Not Matching**
1114
+ - Check route priority order (higher priority = evaluated first)
1115
+ - Verify glob patterns: `*@example.com` matches domain, `admin@*` matches user
1116
+ - Test CIDR notation: `192.168.0.0/16` includes all 192.168.x.x addresses
1117
+ - Confirm authentication state matches your expectations
1118
+
1119
+ **Common Route Patterns**
1120
+ ```typescript
1121
+ // Debug route to log all traffic
1122
+ {
1123
+ name: 'debug-all',
1124
+ priority: 1000,
1125
+ match: { recipients: '*' },
1126
+ action: { type: 'process', process: { scan: false } }
1127
+ }
1128
+
1129
+ // Catch-all reject (should be lowest priority)
1130
+ {
1131
+ name: 'default-reject',
1132
+ priority: 0,
1133
+ match: { recipients: '*' },
1134
+ action: { type: 'reject', reject: { code: 550, message: 'No route' } }
1135
+ }
1136
+ ```
1137
+
1138
+ #### DNS Issues
1139
+ ```bash
1140
+ # Test DNS server
1141
+ dig @your-server.com your-domain.com
1142
+
1143
+ # Check DNS propagation
1144
+ dig your-domain.com @8.8.8.8
1145
+ ```
1146
+
1147
+ ### Logging and Monitoring
1148
+
1149
+ ```typescript
1150
+ import { SmartLog } from '@push.rocks/smartlog';
1151
+
1152
+ // Configure logging
1153
+ const logger = new SmartLog({
1154
+ level: 'info',
1155
+ transport: 'console'
1156
+ });
1157
+
1158
+ // Monitor email events
1159
+ router.emailServer.on('emailReceived', (email) => {
1160
+ logger.log('info', `Email received: ${email.from} -> ${email.to}`);
1161
+ });
1162
+
1163
+ router.emailServer.on('emailSent', (result) => {
1164
+ logger.log('info', `Email sent: ${result.messageId} (${result.status})`);
1165
+ });
1166
+
1167
+ // Monitor proxy events
1168
+ router.smartProxy.on('connectionEstablished', (connection) => {
1169
+ logger.log('info', `Connection: ${connection.clientIp} -> ${connection.target}`);
1170
+ });
1171
+ ```
1172
+
1173
+ ### Performance Tuning
1174
+
1175
+ ```typescript
1176
+ const performanceConfig = {
1177
+ // Connection limits
1178
+ maxConnections: 1000,
1179
+ connectionTimeout: 30000,
1180
+
1181
+ // Email queue settings
1182
+ emailQueue: {
1183
+ concurrency: 10,
1184
+ maxRetries: 3,
1185
+ retryDelay: 300000
1186
+ },
1187
+
1188
+ // Cache settings
1189
+ cache: {
1190
+ ipReputation: { ttl: 3600000 }, // 1 hour
1191
+ dns: { ttl: 300000 }, // 5 minutes
1192
+ certificates: { ttl: 86400000 } // 24 hours
1193
+ }
1194
+ };
1195
+ ```
1196
+
1197
+ ## License
1198
+
1199
+ MIT License - see LICENSE file for details.
1200
+
1201
+ ## Testing
1202
+
1203
+ ### Comprehensive Test Suite
1204
+
1205
+ DcRouter includes a comprehensive test suite covering all aspects of the system:
1206
+
1207
+ #### SMTP Protocol Tests
1208
+ - **Commands**: EHLO, HELO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT, VRFY, EXPN, HELP
1209
+ - **Extensions**: SIZE, PIPELINING, STARTTLS
1210
+ - **Connection Management**: TLS/plain connections, timeouts, limits, rejection handling
1211
+ - **Error Handling**: Syntax errors, invalid sequences, temporary/permanent failures
1212
+ - **Email Processing**: Basic sending, multiple recipients, large emails, invalid addresses
1213
+ - **Security**: Authentication, rate limiting
1214
+ - **Performance**: Throughput testing
1215
+ - **Edge Cases**: Very large emails, special characters
1216
+
1217
+ #### Storage and Configuration Tests
1218
+ - **Storage Manager**: All backend types (filesystem, custom, memory)
1219
+ - **Integration**: Component storage usage and persistence
1220
+ - **DNS Validation**: All DNS modes (forward, internal, external)
1221
+ - **DNS Mode Switching**: Dynamic configuration changes
1222
+ - **Data Migration**: Moving data between storage backends
1223
+
1224
+ #### Running Tests
1225
+
1226
+ ```bash
1227
+ # Run all tests
1228
+ pnpm test
1229
+
1230
+ # Run specific test categories
1231
+ tsx test/suite/commands/test.ehlo-command.ts
1232
+ tsx test/suite/connection/test.tls-connection.ts
1233
+ tsx test/suite/email-processing/test.basic-email.ts
1234
+
1235
+ # Run with verbose output
1236
+ tstest test/suite/security/test.authentication.ts --verbose
1237
+ ```
1238
+
1239
+ ### Test Infrastructure
1240
+
1241
+ The test suite uses a self-contained pattern where each test:
1242
+ 1. Starts its own SMTP server instance
1243
+ 2. Runs comprehensive test scenarios
1244
+ 3. Cleans up all resources
1245
+ 4. Provides detailed logging for debugging
1246
+
1247
+ This ensures tests are isolated, reliable, and can run in parallel.
1248
+
1249
+ ## Support
1250
+
1251
+ - Documentation: [https://docs.serve.zone/dcrouter](https://docs.serve.zone/dcrouter)
1252
+ - Issues: [https://github.com/serve-zone/dcrouter/issues](https://github.com/serve-zone/dcrouter/issues)
1253
+ - Community: [https://community.serve.zone](https://community.serve.zone)