Commit
+711 -711 +/-11 browse
1 | diff --git a/Cargo.toml b/Cargo.toml |
2 | index cb9d044..ad4d22e 100644 |
3 | --- a/Cargo.toml |
4 | +++ b/Cargo.toml |
5 | @@ -3,5 +3,5 @@ resolver = "2" |
6 | |
7 | members = [ |
8 | "maitred", |
9 | - "cmd/maitred-debug" |
10 | + "maitred-debug" |
11 | ] |
12 | diff --git a/cmd/maitred-debug/.gitignore b/cmd/maitred-debug/.gitignore |
13 | deleted file mode 100644 |
14 | index ea8c4bf..0000000 |
15 | --- a/cmd/maitred-debug/.gitignore |
16 | +++ /dev/null |
17 | @@ -1 +0,0 @@ |
18 | - /target |
19 | diff --git a/cmd/maitred-debug/Cargo.lock b/cmd/maitred-debug/Cargo.lock |
20 | deleted file mode 100644 |
21 | index 661ff90..0000000 |
22 | --- a/cmd/maitred-debug/Cargo.lock |
23 | +++ /dev/null |
24 | @@ -1,531 +0,0 @@ |
25 | - # This file is automatically @generated by Cargo. |
26 | - # It is not intended for manual editing. |
27 | - version = 3 |
28 | - |
29 | - [[package]] |
30 | - name = "addr2line" |
31 | - version = "0.22.0" |
32 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
33 | - checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" |
34 | - dependencies = [ |
35 | - "gimli", |
36 | - ] |
37 | - |
38 | - [[package]] |
39 | - name = "adler" |
40 | - version = "1.0.2" |
41 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
42 | - checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" |
43 | - |
44 | - [[package]] |
45 | - name = "ahash" |
46 | - version = "0.8.11" |
47 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
48 | - checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" |
49 | - dependencies = [ |
50 | - "cfg-if", |
51 | - "once_cell", |
52 | - "version_check", |
53 | - "zerocopy", |
54 | - ] |
55 | - |
56 | - [[package]] |
57 | - name = "allocator-api2" |
58 | - version = "0.2.18" |
59 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
60 | - checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" |
61 | - |
62 | - [[package]] |
63 | - name = "autocfg" |
64 | - version = "1.3.0" |
65 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
66 | - checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" |
67 | - |
68 | - [[package]] |
69 | - name = "backtrace" |
70 | - version = "0.3.73" |
71 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
72 | - checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" |
73 | - dependencies = [ |
74 | - "addr2line", |
75 | - "cc", |
76 | - "cfg-if", |
77 | - "libc", |
78 | - "miniz_oxide", |
79 | - "object", |
80 | - "rustc-demangle", |
81 | - ] |
82 | - |
83 | - [[package]] |
84 | - name = "bitflags" |
85 | - version = "2.6.0" |
86 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
87 | - checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" |
88 | - |
89 | - [[package]] |
90 | - name = "bytes" |
91 | - version = "1.6.1" |
92 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
93 | - checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" |
94 | - |
95 | - [[package]] |
96 | - name = "cc" |
97 | - version = "1.1.6" |
98 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
99 | - checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" |
100 | - |
101 | - [[package]] |
102 | - name = "cfg-if" |
103 | - version = "1.0.0" |
104 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
105 | - checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" |
106 | - |
107 | - [[package]] |
108 | - name = "futures-core" |
109 | - version = "0.3.30" |
110 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
111 | - checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" |
112 | - |
113 | - [[package]] |
114 | - name = "futures-io" |
115 | - version = "0.3.30" |
116 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
117 | - checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" |
118 | - |
119 | - [[package]] |
120 | - name = "futures-macro" |
121 | - version = "0.3.30" |
122 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
123 | - checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" |
124 | - dependencies = [ |
125 | - "proc-macro2", |
126 | - "quote", |
127 | - "syn", |
128 | - ] |
129 | - |
130 | - [[package]] |
131 | - name = "futures-sink" |
132 | - version = "0.3.30" |
133 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
134 | - checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" |
135 | - |
136 | - [[package]] |
137 | - name = "futures-task" |
138 | - version = "0.3.30" |
139 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
140 | - checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" |
141 | - |
142 | - [[package]] |
143 | - name = "futures-util" |
144 | - version = "0.3.30" |
145 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
146 | - checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" |
147 | - dependencies = [ |
148 | - "futures-core", |
149 | - "futures-macro", |
150 | - "futures-task", |
151 | - "pin-project-lite", |
152 | - "pin-utils", |
153 | - "slab", |
154 | - ] |
155 | - |
156 | - [[package]] |
157 | - name = "gimli" |
158 | - version = "0.29.0" |
159 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
160 | - checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" |
161 | - |
162 | - [[package]] |
163 | - name = "hashbrown" |
164 | - version = "0.14.5" |
165 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
166 | - checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" |
167 | - dependencies = [ |
168 | - "ahash", |
169 | - "allocator-api2", |
170 | - ] |
171 | - |
172 | - [[package]] |
173 | - name = "hermit-abi" |
174 | - version = "0.3.9" |
175 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
176 | - checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" |
177 | - |
178 | - [[package]] |
179 | - name = "libc" |
180 | - version = "0.2.155" |
181 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
182 | - checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" |
183 | - |
184 | - [[package]] |
185 | - name = "lock_api" |
186 | - version = "0.4.12" |
187 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
188 | - checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" |
189 | - dependencies = [ |
190 | - "autocfg", |
191 | - "scopeguard", |
192 | - ] |
193 | - |
194 | - [[package]] |
195 | - name = "maitred" |
196 | - version = "0.1.0" |
197 | - dependencies = [ |
198 | - "smtp-proto", |
199 | - ] |
200 | - |
201 | - [[package]] |
202 | - name = "maitred-debug" |
203 | - version = "0.1.0" |
204 | - dependencies = [ |
205 | - "maitred", |
206 | - "tokio", |
207 | - "tokio-util", |
208 | - ] |
209 | - |
210 | - [[package]] |
211 | - name = "memchr" |
212 | - version = "2.7.4" |
213 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
214 | - checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" |
215 | - |
216 | - [[package]] |
217 | - name = "miniz_oxide" |
218 | - version = "0.7.4" |
219 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
220 | - checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" |
221 | - dependencies = [ |
222 | - "adler", |
223 | - ] |
224 | - |
225 | - [[package]] |
226 | - name = "mio" |
227 | - version = "1.0.1" |
228 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
229 | - checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" |
230 | - dependencies = [ |
231 | - "hermit-abi", |
232 | - "libc", |
233 | - "wasi", |
234 | - "windows-sys", |
235 | - ] |
236 | - |
237 | - [[package]] |
238 | - name = "object" |
239 | - version = "0.36.2" |
240 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
241 | - checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" |
242 | - dependencies = [ |
243 | - "memchr", |
244 | - ] |
245 | - |
246 | - [[package]] |
247 | - name = "once_cell" |
248 | - version = "1.19.0" |
249 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
250 | - checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" |
251 | - |
252 | - [[package]] |
253 | - name = "parking_lot" |
254 | - version = "0.12.3" |
255 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
256 | - checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" |
257 | - dependencies = [ |
258 | - "lock_api", |
259 | - "parking_lot_core", |
260 | - ] |
261 | - |
262 | - [[package]] |
263 | - name = "parking_lot_core" |
264 | - version = "0.9.10" |
265 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
266 | - checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" |
267 | - dependencies = [ |
268 | - "cfg-if", |
269 | - "libc", |
270 | - "redox_syscall", |
271 | - "smallvec", |
272 | - "windows-targets", |
273 | - ] |
274 | - |
275 | - [[package]] |
276 | - name = "pin-project-lite" |
277 | - version = "0.2.14" |
278 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
279 | - checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" |
280 | - |
281 | - [[package]] |
282 | - name = "pin-utils" |
283 | - version = "0.1.0" |
284 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
285 | - checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" |
286 | - |
287 | - [[package]] |
288 | - name = "proc-macro2" |
289 | - version = "1.0.86" |
290 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
291 | - checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" |
292 | - dependencies = [ |
293 | - "unicode-ident", |
294 | - ] |
295 | - |
296 | - [[package]] |
297 | - name = "quote" |
298 | - version = "1.0.36" |
299 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
300 | - checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" |
301 | - dependencies = [ |
302 | - "proc-macro2", |
303 | - ] |
304 | - |
305 | - [[package]] |
306 | - name = "redox_syscall" |
307 | - version = "0.5.3" |
308 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
309 | - checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" |
310 | - dependencies = [ |
311 | - "bitflags", |
312 | - ] |
313 | - |
314 | - [[package]] |
315 | - name = "rustc-demangle" |
316 | - version = "0.1.24" |
317 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
318 | - checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" |
319 | - |
320 | - [[package]] |
321 | - name = "scopeguard" |
322 | - version = "1.2.0" |
323 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
324 | - checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" |
325 | - |
326 | - [[package]] |
327 | - name = "serde" |
328 | - version = "1.0.204" |
329 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
330 | - checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" |
331 | - dependencies = [ |
332 | - "serde_derive", |
333 | - ] |
334 | - |
335 | - [[package]] |
336 | - name = "serde_derive" |
337 | - version = "1.0.204" |
338 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
339 | - checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" |
340 | - dependencies = [ |
341 | - "proc-macro2", |
342 | - "quote", |
343 | - "syn", |
344 | - ] |
345 | - |
346 | - [[package]] |
347 | - name = "signal-hook-registry" |
348 | - version = "1.4.2" |
349 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
350 | - checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" |
351 | - dependencies = [ |
352 | - "libc", |
353 | - ] |
354 | - |
355 | - [[package]] |
356 | - name = "slab" |
357 | - version = "0.4.9" |
358 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
359 | - checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" |
360 | - dependencies = [ |
361 | - "autocfg", |
362 | - ] |
363 | - |
364 | - [[package]] |
365 | - name = "smallvec" |
366 | - version = "1.13.2" |
367 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
368 | - checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" |
369 | - |
370 | - [[package]] |
371 | - name = "smtp-proto" |
372 | - version = "0.1.5" |
373 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
374 | - checksum = "51b8ad3dd187f0d4debab02ad65405a9919d6a4f7bce25bd64a258781063a53a" |
375 | - dependencies = [ |
376 | - "serde", |
377 | - ] |
378 | - |
379 | - [[package]] |
380 | - name = "socket2" |
381 | - version = "0.5.7" |
382 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
383 | - checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" |
384 | - dependencies = [ |
385 | - "libc", |
386 | - "windows-sys", |
387 | - ] |
388 | - |
389 | - [[package]] |
390 | - name = "syn" |
391 | - version = "2.0.72" |
392 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
393 | - checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" |
394 | - dependencies = [ |
395 | - "proc-macro2", |
396 | - "quote", |
397 | - "unicode-ident", |
398 | - ] |
399 | - |
400 | - [[package]] |
401 | - name = "tokio" |
402 | - version = "1.39.2" |
403 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
404 | - checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" |
405 | - dependencies = [ |
406 | - "backtrace", |
407 | - "bytes", |
408 | - "libc", |
409 | - "mio", |
410 | - "parking_lot", |
411 | - "pin-project-lite", |
412 | - "signal-hook-registry", |
413 | - "socket2", |
414 | - "tokio-macros", |
415 | - "windows-sys", |
416 | - ] |
417 | - |
418 | - [[package]] |
419 | - name = "tokio-macros" |
420 | - version = "2.4.0" |
421 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
422 | - checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" |
423 | - dependencies = [ |
424 | - "proc-macro2", |
425 | - "quote", |
426 | - "syn", |
427 | - ] |
428 | - |
429 | - [[package]] |
430 | - name = "tokio-util" |
431 | - version = "0.7.11" |
432 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
433 | - checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" |
434 | - dependencies = [ |
435 | - "bytes", |
436 | - "futures-core", |
437 | - "futures-io", |
438 | - "futures-sink", |
439 | - "futures-util", |
440 | - "hashbrown", |
441 | - "pin-project-lite", |
442 | - "slab", |
443 | - "tokio", |
444 | - ] |
445 | - |
446 | - [[package]] |
447 | - name = "unicode-ident" |
448 | - version = "1.0.12" |
449 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
450 | - checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" |
451 | - |
452 | - [[package]] |
453 | - name = "version_check" |
454 | - version = "0.9.5" |
455 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
456 | - checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" |
457 | - |
458 | - [[package]] |
459 | - name = "wasi" |
460 | - version = "0.11.0+wasi-snapshot-preview1" |
461 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
462 | - checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" |
463 | - |
464 | - [[package]] |
465 | - name = "windows-sys" |
466 | - version = "0.52.0" |
467 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
468 | - checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" |
469 | - dependencies = [ |
470 | - "windows-targets", |
471 | - ] |
472 | - |
473 | - [[package]] |
474 | - name = "windows-targets" |
475 | - version = "0.52.6" |
476 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
477 | - checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" |
478 | - dependencies = [ |
479 | - "windows_aarch64_gnullvm", |
480 | - "windows_aarch64_msvc", |
481 | - "windows_i686_gnu", |
482 | - "windows_i686_gnullvm", |
483 | - "windows_i686_msvc", |
484 | - "windows_x86_64_gnu", |
485 | - "windows_x86_64_gnullvm", |
486 | - "windows_x86_64_msvc", |
487 | - ] |
488 | - |
489 | - [[package]] |
490 | - name = "windows_aarch64_gnullvm" |
491 | - version = "0.52.6" |
492 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
493 | - checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" |
494 | - |
495 | - [[package]] |
496 | - name = "windows_aarch64_msvc" |
497 | - version = "0.52.6" |
498 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
499 | - checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" |
500 | - |
501 | - [[package]] |
502 | - name = "windows_i686_gnu" |
503 | - version = "0.52.6" |
504 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
505 | - checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" |
506 | - |
507 | - [[package]] |
508 | - name = "windows_i686_gnullvm" |
509 | - version = "0.52.6" |
510 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
511 | - checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" |
512 | - |
513 | - [[package]] |
514 | - name = "windows_i686_msvc" |
515 | - version = "0.52.6" |
516 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
517 | - checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" |
518 | - |
519 | - [[package]] |
520 | - name = "windows_x86_64_gnu" |
521 | - version = "0.52.6" |
522 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
523 | - checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" |
524 | - |
525 | - [[package]] |
526 | - name = "windows_x86_64_gnullvm" |
527 | - version = "0.52.6" |
528 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
529 | - checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" |
530 | - |
531 | - [[package]] |
532 | - name = "windows_x86_64_msvc" |
533 | - version = "0.52.6" |
534 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
535 | - checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" |
536 | - |
537 | - [[package]] |
538 | - name = "zerocopy" |
539 | - version = "0.7.35" |
540 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
541 | - checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" |
542 | - dependencies = [ |
543 | - "zerocopy-derive", |
544 | - ] |
545 | - |
546 | - [[package]] |
547 | - name = "zerocopy-derive" |
548 | - version = "0.7.35" |
549 | - source = "registry+https://github.com/rust-lang/crates.io-index" |
550 | - checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" |
551 | - dependencies = [ |
552 | - "proc-macro2", |
553 | - "quote", |
554 | - "syn", |
555 | - ] |
556 | diff --git a/cmd/maitred-debug/Cargo.toml b/cmd/maitred-debug/Cargo.toml |
557 | deleted file mode 100644 |
558 | index 779b87e..0000000 |
559 | --- a/cmd/maitred-debug/Cargo.toml |
560 | +++ /dev/null |
561 | @@ -1,20 +0,0 @@ |
562 | - [package] |
563 | - name = "maitred-debug" |
564 | - version = "0.1.0" |
565 | - edition = "2021" |
566 | - |
567 | - [dependencies] |
568 | - async-trait = "0.1.83" |
569 | - clap = { version = "4.5.16", features = ["derive"] } |
570 | - futures = "0.3.30" |
571 | - maildir = "0.6.4" |
572 | - maitred = {path = "../../maitred", features = ["full"]} |
573 | - serde = "1.0.209" |
574 | - tokio = { version = "1.39.2", features = ["full"] } |
575 | - toml = "0.8.19" |
576 | - tracing = { version = "0.1.40", features = ["log"] } |
577 | - tracing-subscriber = "0.3.18" |
578 | - |
579 | - [[bin]] |
580 | - name = "maitred-debug" |
581 | - path = "src/main.rs" |
582 | diff --git a/cmd/maitred-debug/src/config.rs b/cmd/maitred-debug/src/config.rs |
583 | deleted file mode 100644 |
584 | index aac99a0..0000000 |
585 | --- a/cmd/maitred-debug/src/config.rs |
586 | +++ /dev/null |
587 | @@ -1,34 +0,0 @@ |
588 | - use std::path::PathBuf; |
589 | - |
590 | - #[derive(Clone, serde::Deserialize)] |
591 | - pub(crate) struct Account { |
592 | - pub address: String, |
593 | - } |
594 | - |
595 | - #[derive(Clone, serde::Deserialize)] |
596 | - pub(crate) struct Spf { |
597 | - pub enabled: bool |
598 | - } |
599 | - |
600 | - |
601 | - #[derive(Clone, serde::Deserialize)] |
602 | - pub(crate) struct Dkim { |
603 | - pub enabled: bool |
604 | - } |
605 | - |
606 | - #[derive(Clone, serde::Deserialize)] |
607 | - pub(crate) struct Tls { |
608 | - pub certificate: PathBuf, |
609 | - pub key: PathBuf |
610 | - } |
611 | - |
612 | - #[derive(serde::Deserialize)] |
613 | - pub(crate) struct Config { |
614 | - pub address: String, |
615 | - pub maildir: String, |
616 | - pub spf: Spf, |
617 | - pub dkim: Dkim, |
618 | - pub accounts: Vec<Account>, |
619 | - pub tls: Option<Tls>, |
620 | - pub proxy_protocol: Option<bool>, |
621 | - } |
622 | diff --git a/cmd/maitred-debug/src/main.rs b/cmd/maitred-debug/src/main.rs |
623 | deleted file mode 100644 |
624 | index b5f8044..0000000 |
625 | --- a/cmd/maitred-debug/src/main.rs |
626 | +++ /dev/null |
627 | @@ -1,124 +0,0 @@ |
628 | - use std::collections::BTreeMap; |
629 | - use std::fs::read_to_string; |
630 | - use std::path::{Path, PathBuf}; |
631 | - |
632 | - use clap::Parser; |
633 | - use maildir::Maildir; |
634 | - use toml::from_str; |
635 | - use tracing::Level; |
636 | - |
637 | - mod config; |
638 | - |
639 | - use maitred::delivery::{Delivery, DeliveryError, DeliveryFunc}; |
640 | - use maitred::mail_parser::Message; |
641 | - use maitred::milter::MilterFunc; |
642 | - use maitred::server::Server; |
643 | - use maitred::session::Envelope; |
644 | - |
645 | - const LONG_ABOUT: &str = r#" |
646 | - Maitred SMTP Demo Server |
647 | - |
648 | - NOTE: This tool only exists for illustrative purposes and should not be |
649 | - considered stable or suitable for a production environment. |
650 | - "#; |
651 | - |
652 | - /// Maitred SMTP Demo Server |
653 | - #[derive(Parser, Debug)] |
654 | - #[clap(author, version, about, long_about = LONG_ABOUT)] |
655 | - struct Args { |
656 | - /// Addresses from which to accept e-mail for |
657 | - #[clap(long, default_value = "maitred.toml")] |
658 | - config: String, |
659 | - } |
660 | - |
661 | - /// FSDelivery stores incoming e-mail on the file system in the Maildir format |
662 | - /// for each address it's configured to handle. |
663 | - pub struct FSDelivery { |
664 | - maildirs: BTreeMap<String, Maildir>, |
665 | - } |
666 | - |
667 | - impl FSDelivery { |
668 | - /// Initialize a new Maildir on the file system. |
669 | - pub fn new(path: &Path, addresses: &[String]) -> Result<Self, std::io::Error> { |
670 | - let maildirs: Result<Vec<(String, Maildir)>, std::io::Error> = addresses |
671 | - .iter() |
672 | - .map(|address| { |
673 | - let mbox_dir = path.join(address); |
674 | - let maildir: Maildir = mbox_dir.into(); |
675 | - maildir.create_dirs()?; |
676 | - Ok((address.to_string(), maildir)) |
677 | - }) |
678 | - .collect(); |
679 | - let maildirs = maildirs?; |
680 | - Ok(FSDelivery { |
681 | - maildirs: maildirs.into_iter().collect(), |
682 | - }) |
683 | - } |
684 | - } |
685 | - |
686 | - #[async_trait::async_trait] |
687 | - impl Delivery for FSDelivery { |
688 | - async fn deliver(&self, message: &Envelope) -> Result<(), DeliveryError> { |
689 | - println!( |
690 | - "New SMTP Message:\n{}", |
691 | - String::from_utf8_lossy(message.body.raw_message()) |
692 | - ); |
693 | - for rcpt in message.rcpt_to.iter() { |
694 | - if let Some(maildir) = self.maildirs.get(&rcpt.email()) { |
695 | - maildir |
696 | - .store_new(message.body.raw_message()) |
697 | - .map_err(|e| match e { |
698 | - maildir::MaildirError::Io(io_err) => DeliveryError::Io(io_err), |
699 | - maildir::MaildirError::Utf8(_) => unreachable!(), |
700 | - maildir::MaildirError::Time(e) => DeliveryError::Server(e.to_string()), |
701 | - })?; |
702 | - } else { |
703 | - tracing::warn!("Ignoring unknown e-mail account: {}", rcpt); |
704 | - } |
705 | - } |
706 | - Ok(()) |
707 | - } |
708 | - } |
709 | - |
710 | - #[tokio::main] |
711 | - async fn main() -> Result<(), Box<dyn std::error::Error>> { |
712 | - let args = Args::parse(); |
713 | - let config_str = read_to_string(Path::new(&args.config))?; |
714 | - let config: config::Config = from_str(&config_str)?; |
715 | - // Create a subscriber that logs events to the console |
716 | - tracing_subscriber::fmt() |
717 | - .compact() |
718 | - .with_line_number(true) |
719 | - .with_max_level(Level::DEBUG) |
720 | - .init(); |
721 | - let accounts = config.accounts.clone(); |
722 | - let addresses: Vec<String> = accounts |
723 | - .iter() |
724 | - .map(|account| account.address.clone()) |
725 | - .collect(); |
726 | - // initialize maildirs before starting |
727 | - let delivery = FSDelivery::new(Path::new(&config.maildir), &addresses)?; |
728 | - let mut mail_server = Server::default() |
729 | - .address(&config.address) |
730 | - .with_milter(MilterFunc(|message: &Message<'static>| { |
731 | - let message = message.clone(); |
732 | - async move { Ok(message.to_owned()) } |
733 | - })) |
734 | - .with_delivery(delivery) |
735 | - .dkim_verification(config.dkim.enabled) |
736 | - .spf_verification(config.spf.enabled); |
737 | - |
738 | - if let Some(tls_config) = config.tls { |
739 | - tracing::info!("TLS enabled"); |
740 | - mail_server = mail_server.with_certificates(&tls_config.key, &tls_config.certificate); |
741 | - // session_opts = session_opts.starttls_enabled(true); |
742 | - } |
743 | - |
744 | - if config.proxy_protocol.is_some_and(|enabled| enabled) { |
745 | - mail_server = mail_server.proxy_protocol(true); |
746 | - }; |
747 | - |
748 | - // mail_server = mail_server.with_session_opts(session_opts); |
749 | - mail_server.listen().await?; |
750 | - Ok(()) |
751 | - } |
752 | diff --git a/maitred-debug/.gitignore b/maitred-debug/.gitignore |
753 | new file mode 100644 |
754 | index 0000000..ea8c4bf |
755 | --- /dev/null |
756 | +++ b/maitred-debug/.gitignore |
757 | @@ -0,0 +1 @@ |
758 | + /target |
759 | diff --git a/maitred-debug/Cargo.lock b/maitred-debug/Cargo.lock |
760 | new file mode 100644 |
761 | index 0000000..661ff90 |
762 | --- /dev/null |
763 | +++ b/maitred-debug/Cargo.lock |
764 | @@ -0,0 +1,531 @@ |
765 | + # This file is automatically @generated by Cargo. |
766 | + # It is not intended for manual editing. |
767 | + version = 3 |
768 | + |
769 | + [[package]] |
770 | + name = "addr2line" |
771 | + version = "0.22.0" |
772 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
773 | + checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" |
774 | + dependencies = [ |
775 | + "gimli", |
776 | + ] |
777 | + |
778 | + [[package]] |
779 | + name = "adler" |
780 | + version = "1.0.2" |
781 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
782 | + checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" |
783 | + |
784 | + [[package]] |
785 | + name = "ahash" |
786 | + version = "0.8.11" |
787 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
788 | + checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" |
789 | + dependencies = [ |
790 | + "cfg-if", |
791 | + "once_cell", |
792 | + "version_check", |
793 | + "zerocopy", |
794 | + ] |
795 | + |
796 | + [[package]] |
797 | + name = "allocator-api2" |
798 | + version = "0.2.18" |
799 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
800 | + checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" |
801 | + |
802 | + [[package]] |
803 | + name = "autocfg" |
804 | + version = "1.3.0" |
805 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
806 | + checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" |
807 | + |
808 | + [[package]] |
809 | + name = "backtrace" |
810 | + version = "0.3.73" |
811 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
812 | + checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" |
813 | + dependencies = [ |
814 | + "addr2line", |
815 | + "cc", |
816 | + "cfg-if", |
817 | + "libc", |
818 | + "miniz_oxide", |
819 | + "object", |
820 | + "rustc-demangle", |
821 | + ] |
822 | + |
823 | + [[package]] |
824 | + name = "bitflags" |
825 | + version = "2.6.0" |
826 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
827 | + checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" |
828 | + |
829 | + [[package]] |
830 | + name = "bytes" |
831 | + version = "1.6.1" |
832 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
833 | + checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" |
834 | + |
835 | + [[package]] |
836 | + name = "cc" |
837 | + version = "1.1.6" |
838 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
839 | + checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" |
840 | + |
841 | + [[package]] |
842 | + name = "cfg-if" |
843 | + version = "1.0.0" |
844 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
845 | + checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" |
846 | + |
847 | + [[package]] |
848 | + name = "futures-core" |
849 | + version = "0.3.30" |
850 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
851 | + checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" |
852 | + |
853 | + [[package]] |
854 | + name = "futures-io" |
855 | + version = "0.3.30" |
856 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
857 | + checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" |
858 | + |
859 | + [[package]] |
860 | + name = "futures-macro" |
861 | + version = "0.3.30" |
862 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
863 | + checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" |
864 | + dependencies = [ |
865 | + "proc-macro2", |
866 | + "quote", |
867 | + "syn", |
868 | + ] |
869 | + |
870 | + [[package]] |
871 | + name = "futures-sink" |
872 | + version = "0.3.30" |
873 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
874 | + checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" |
875 | + |
876 | + [[package]] |
877 | + name = "futures-task" |
878 | + version = "0.3.30" |
879 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
880 | + checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" |
881 | + |
882 | + [[package]] |
883 | + name = "futures-util" |
884 | + version = "0.3.30" |
885 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
886 | + checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" |
887 | + dependencies = [ |
888 | + "futures-core", |
889 | + "futures-macro", |
890 | + "futures-task", |
891 | + "pin-project-lite", |
892 | + "pin-utils", |
893 | + "slab", |
894 | + ] |
895 | + |
896 | + [[package]] |
897 | + name = "gimli" |
898 | + version = "0.29.0" |
899 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
900 | + checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" |
901 | + |
902 | + [[package]] |
903 | + name = "hashbrown" |
904 | + version = "0.14.5" |
905 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
906 | + checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" |
907 | + dependencies = [ |
908 | + "ahash", |
909 | + "allocator-api2", |
910 | + ] |
911 | + |
912 | + [[package]] |
913 | + name = "hermit-abi" |
914 | + version = "0.3.9" |
915 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
916 | + checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" |
917 | + |
918 | + [[package]] |
919 | + name = "libc" |
920 | + version = "0.2.155" |
921 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
922 | + checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" |
923 | + |
924 | + [[package]] |
925 | + name = "lock_api" |
926 | + version = "0.4.12" |
927 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
928 | + checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" |
929 | + dependencies = [ |
930 | + "autocfg", |
931 | + "scopeguard", |
932 | + ] |
933 | + |
934 | + [[package]] |
935 | + name = "maitred" |
936 | + version = "0.1.0" |
937 | + dependencies = [ |
938 | + "smtp-proto", |
939 | + ] |
940 | + |
941 | + [[package]] |
942 | + name = "maitred-debug" |
943 | + version = "0.1.0" |
944 | + dependencies = [ |
945 | + "maitred", |
946 | + "tokio", |
947 | + "tokio-util", |
948 | + ] |
949 | + |
950 | + [[package]] |
951 | + name = "memchr" |
952 | + version = "2.7.4" |
953 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
954 | + checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" |
955 | + |
956 | + [[package]] |
957 | + name = "miniz_oxide" |
958 | + version = "0.7.4" |
959 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
960 | + checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" |
961 | + dependencies = [ |
962 | + "adler", |
963 | + ] |
964 | + |
965 | + [[package]] |
966 | + name = "mio" |
967 | + version = "1.0.1" |
968 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
969 | + checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" |
970 | + dependencies = [ |
971 | + "hermit-abi", |
972 | + "libc", |
973 | + "wasi", |
974 | + "windows-sys", |
975 | + ] |
976 | + |
977 | + [[package]] |
978 | + name = "object" |
979 | + version = "0.36.2" |
980 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
981 | + checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" |
982 | + dependencies = [ |
983 | + "memchr", |
984 | + ] |
985 | + |
986 | + [[package]] |
987 | + name = "once_cell" |
988 | + version = "1.19.0" |
989 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
990 | + checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" |
991 | + |
992 | + [[package]] |
993 | + name = "parking_lot" |
994 | + version = "0.12.3" |
995 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
996 | + checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" |
997 | + dependencies = [ |
998 | + "lock_api", |
999 | + "parking_lot_core", |
1000 | + ] |
1001 | + |
1002 | + [[package]] |
1003 | + name = "parking_lot_core" |
1004 | + version = "0.9.10" |
1005 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1006 | + checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" |
1007 | + dependencies = [ |
1008 | + "cfg-if", |
1009 | + "libc", |
1010 | + "redox_syscall", |
1011 | + "smallvec", |
1012 | + "windows-targets", |
1013 | + ] |
1014 | + |
1015 | + [[package]] |
1016 | + name = "pin-project-lite" |
1017 | + version = "0.2.14" |
1018 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1019 | + checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" |
1020 | + |
1021 | + [[package]] |
1022 | + name = "pin-utils" |
1023 | + version = "0.1.0" |
1024 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1025 | + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" |
1026 | + |
1027 | + [[package]] |
1028 | + name = "proc-macro2" |
1029 | + version = "1.0.86" |
1030 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1031 | + checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" |
1032 | + dependencies = [ |
1033 | + "unicode-ident", |
1034 | + ] |
1035 | + |
1036 | + [[package]] |
1037 | + name = "quote" |
1038 | + version = "1.0.36" |
1039 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1040 | + checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" |
1041 | + dependencies = [ |
1042 | + "proc-macro2", |
1043 | + ] |
1044 | + |
1045 | + [[package]] |
1046 | + name = "redox_syscall" |
1047 | + version = "0.5.3" |
1048 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1049 | + checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" |
1050 | + dependencies = [ |
1051 | + "bitflags", |
1052 | + ] |
1053 | + |
1054 | + [[package]] |
1055 | + name = "rustc-demangle" |
1056 | + version = "0.1.24" |
1057 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1058 | + checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" |
1059 | + |
1060 | + [[package]] |
1061 | + name = "scopeguard" |
1062 | + version = "1.2.0" |
1063 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1064 | + checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" |
1065 | + |
1066 | + [[package]] |
1067 | + name = "serde" |
1068 | + version = "1.0.204" |
1069 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1070 | + checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" |
1071 | + dependencies = [ |
1072 | + "serde_derive", |
1073 | + ] |
1074 | + |
1075 | + [[package]] |
1076 | + name = "serde_derive" |
1077 | + version = "1.0.204" |
1078 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1079 | + checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" |
1080 | + dependencies = [ |
1081 | + "proc-macro2", |
1082 | + "quote", |
1083 | + "syn", |
1084 | + ] |
1085 | + |
1086 | + [[package]] |
1087 | + name = "signal-hook-registry" |
1088 | + version = "1.4.2" |
1089 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1090 | + checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" |
1091 | + dependencies = [ |
1092 | + "libc", |
1093 | + ] |
1094 | + |
1095 | + [[package]] |
1096 | + name = "slab" |
1097 | + version = "0.4.9" |
1098 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1099 | + checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" |
1100 | + dependencies = [ |
1101 | + "autocfg", |
1102 | + ] |
1103 | + |
1104 | + [[package]] |
1105 | + name = "smallvec" |
1106 | + version = "1.13.2" |
1107 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1108 | + checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" |
1109 | + |
1110 | + [[package]] |
1111 | + name = "smtp-proto" |
1112 | + version = "0.1.5" |
1113 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1114 | + checksum = "51b8ad3dd187f0d4debab02ad65405a9919d6a4f7bce25bd64a258781063a53a" |
1115 | + dependencies = [ |
1116 | + "serde", |
1117 | + ] |
1118 | + |
1119 | + [[package]] |
1120 | + name = "socket2" |
1121 | + version = "0.5.7" |
1122 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1123 | + checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" |
1124 | + dependencies = [ |
1125 | + "libc", |
1126 | + "windows-sys", |
1127 | + ] |
1128 | + |
1129 | + [[package]] |
1130 | + name = "syn" |
1131 | + version = "2.0.72" |
1132 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1133 | + checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" |
1134 | + dependencies = [ |
1135 | + "proc-macro2", |
1136 | + "quote", |
1137 | + "unicode-ident", |
1138 | + ] |
1139 | + |
1140 | + [[package]] |
1141 | + name = "tokio" |
1142 | + version = "1.39.2" |
1143 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1144 | + checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" |
1145 | + dependencies = [ |
1146 | + "backtrace", |
1147 | + "bytes", |
1148 | + "libc", |
1149 | + "mio", |
1150 | + "parking_lot", |
1151 | + "pin-project-lite", |
1152 | + "signal-hook-registry", |
1153 | + "socket2", |
1154 | + "tokio-macros", |
1155 | + "windows-sys", |
1156 | + ] |
1157 | + |
1158 | + [[package]] |
1159 | + name = "tokio-macros" |
1160 | + version = "2.4.0" |
1161 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1162 | + checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" |
1163 | + dependencies = [ |
1164 | + "proc-macro2", |
1165 | + "quote", |
1166 | + "syn", |
1167 | + ] |
1168 | + |
1169 | + [[package]] |
1170 | + name = "tokio-util" |
1171 | + version = "0.7.11" |
1172 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1173 | + checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" |
1174 | + dependencies = [ |
1175 | + "bytes", |
1176 | + "futures-core", |
1177 | + "futures-io", |
1178 | + "futures-sink", |
1179 | + "futures-util", |
1180 | + "hashbrown", |
1181 | + "pin-project-lite", |
1182 | + "slab", |
1183 | + "tokio", |
1184 | + ] |
1185 | + |
1186 | + [[package]] |
1187 | + name = "unicode-ident" |
1188 | + version = "1.0.12" |
1189 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1190 | + checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" |
1191 | + |
1192 | + [[package]] |
1193 | + name = "version_check" |
1194 | + version = "0.9.5" |
1195 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1196 | + checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" |
1197 | + |
1198 | + [[package]] |
1199 | + name = "wasi" |
1200 | + version = "0.11.0+wasi-snapshot-preview1" |
1201 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1202 | + checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" |
1203 | + |
1204 | + [[package]] |
1205 | + name = "windows-sys" |
1206 | + version = "0.52.0" |
1207 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1208 | + checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" |
1209 | + dependencies = [ |
1210 | + "windows-targets", |
1211 | + ] |
1212 | + |
1213 | + [[package]] |
1214 | + name = "windows-targets" |
1215 | + version = "0.52.6" |
1216 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1217 | + checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" |
1218 | + dependencies = [ |
1219 | + "windows_aarch64_gnullvm", |
1220 | + "windows_aarch64_msvc", |
1221 | + "windows_i686_gnu", |
1222 | + "windows_i686_gnullvm", |
1223 | + "windows_i686_msvc", |
1224 | + "windows_x86_64_gnu", |
1225 | + "windows_x86_64_gnullvm", |
1226 | + "windows_x86_64_msvc", |
1227 | + ] |
1228 | + |
1229 | + [[package]] |
1230 | + name = "windows_aarch64_gnullvm" |
1231 | + version = "0.52.6" |
1232 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1233 | + checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" |
1234 | + |
1235 | + [[package]] |
1236 | + name = "windows_aarch64_msvc" |
1237 | + version = "0.52.6" |
1238 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1239 | + checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" |
1240 | + |
1241 | + [[package]] |
1242 | + name = "windows_i686_gnu" |
1243 | + version = "0.52.6" |
1244 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1245 | + checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" |
1246 | + |
1247 | + [[package]] |
1248 | + name = "windows_i686_gnullvm" |
1249 | + version = "0.52.6" |
1250 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1251 | + checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" |
1252 | + |
1253 | + [[package]] |
1254 | + name = "windows_i686_msvc" |
1255 | + version = "0.52.6" |
1256 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1257 | + checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" |
1258 | + |
1259 | + [[package]] |
1260 | + name = "windows_x86_64_gnu" |
1261 | + version = "0.52.6" |
1262 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1263 | + checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" |
1264 | + |
1265 | + [[package]] |
1266 | + name = "windows_x86_64_gnullvm" |
1267 | + version = "0.52.6" |
1268 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1269 | + checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" |
1270 | + |
1271 | + [[package]] |
1272 | + name = "windows_x86_64_msvc" |
1273 | + version = "0.52.6" |
1274 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1275 | + checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" |
1276 | + |
1277 | + [[package]] |
1278 | + name = "zerocopy" |
1279 | + version = "0.7.35" |
1280 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1281 | + checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" |
1282 | + dependencies = [ |
1283 | + "zerocopy-derive", |
1284 | + ] |
1285 | + |
1286 | + [[package]] |
1287 | + name = "zerocopy-derive" |
1288 | + version = "0.7.35" |
1289 | + source = "registry+https://github.com/rust-lang/crates.io-index" |
1290 | + checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" |
1291 | + dependencies = [ |
1292 | + "proc-macro2", |
1293 | + "quote", |
1294 | + "syn", |
1295 | + ] |
1296 | diff --git a/maitred-debug/Cargo.toml b/maitred-debug/Cargo.toml |
1297 | new file mode 100644 |
1298 | index 0000000..df24e24 |
1299 | --- /dev/null |
1300 | +++ b/maitred-debug/Cargo.toml |
1301 | @@ -0,0 +1,20 @@ |
1302 | + [package] |
1303 | + name = "maitred-debug" |
1304 | + version = "0.1.0" |
1305 | + edition = "2021" |
1306 | + |
1307 | + [dependencies] |
1308 | + async-trait = "0.1.83" |
1309 | + clap = { version = "4.5.16", features = ["derive"] } |
1310 | + futures = "0.3.30" |
1311 | + maildir = "0.6.4" |
1312 | + maitred = {path = "../maitred", features = ["full"]} |
1313 | + serde = "1.0.209" |
1314 | + tokio = { version = "1.39.2", features = ["full"] } |
1315 | + toml = "0.8.19" |
1316 | + tracing = { version = "0.1.40", features = ["log"] } |
1317 | + tracing-subscriber = "0.3.18" |
1318 | + |
1319 | + [[bin]] |
1320 | + name = "maitred-debug" |
1321 | + path = "src/main.rs" |
1322 | diff --git a/maitred-debug/src/config.rs b/maitred-debug/src/config.rs |
1323 | new file mode 100644 |
1324 | index 0000000..aac99a0 |
1325 | --- /dev/null |
1326 | +++ b/maitred-debug/src/config.rs |
1327 | @@ -0,0 +1,34 @@ |
1328 | + use std::path::PathBuf; |
1329 | + |
1330 | + #[derive(Clone, serde::Deserialize)] |
1331 | + pub(crate) struct Account { |
1332 | + pub address: String, |
1333 | + } |
1334 | + |
1335 | + #[derive(Clone, serde::Deserialize)] |
1336 | + pub(crate) struct Spf { |
1337 | + pub enabled: bool |
1338 | + } |
1339 | + |
1340 | + |
1341 | + #[derive(Clone, serde::Deserialize)] |
1342 | + pub(crate) struct Dkim { |
1343 | + pub enabled: bool |
1344 | + } |
1345 | + |
1346 | + #[derive(Clone, serde::Deserialize)] |
1347 | + pub(crate) struct Tls { |
1348 | + pub certificate: PathBuf, |
1349 | + pub key: PathBuf |
1350 | + } |
1351 | + |
1352 | + #[derive(serde::Deserialize)] |
1353 | + pub(crate) struct Config { |
1354 | + pub address: String, |
1355 | + pub maildir: String, |
1356 | + pub spf: Spf, |
1357 | + pub dkim: Dkim, |
1358 | + pub accounts: Vec<Account>, |
1359 | + pub tls: Option<Tls>, |
1360 | + pub proxy_protocol: Option<bool>, |
1361 | + } |
1362 | diff --git a/maitred-debug/src/main.rs b/maitred-debug/src/main.rs |
1363 | new file mode 100644 |
1364 | index 0000000..d5cba30 |
1365 | --- /dev/null |
1366 | +++ b/maitred-debug/src/main.rs |
1367 | @@ -0,0 +1,124 @@ |
1368 | + use std::collections::BTreeMap; |
1369 | + use std::fs::read_to_string; |
1370 | + use std::path::Path; |
1371 | + |
1372 | + use clap::Parser; |
1373 | + use maildir::Maildir; |
1374 | + use toml::from_str; |
1375 | + use tracing::Level; |
1376 | + |
1377 | + mod config; |
1378 | + |
1379 | + use maitred::delivery::{Delivery, DeliveryError}; |
1380 | + use maitred::mail_parser::Message; |
1381 | + use maitred::milter::MilterFunc; |
1382 | + use maitred::server::Server; |
1383 | + use maitred::session::Envelope; |
1384 | + |
1385 | + const LONG_ABOUT: &str = r#" |
1386 | + Maitred SMTP Demo Server |
1387 | + |
1388 | + NOTE: This tool only exists for illustrative purposes and should not be |
1389 | + considered stable or suitable for a production environment. |
1390 | + "#; |
1391 | + |
1392 | + /// Maitred SMTP Demo Server |
1393 | + #[derive(Parser, Debug)] |
1394 | + #[clap(author, version, about, long_about = LONG_ABOUT)] |
1395 | + struct Args { |
1396 | + /// Addresses from which to accept e-mail for |
1397 | + #[clap(long, default_value = "maitred.toml")] |
1398 | + config: String, |
1399 | + } |
1400 | + |
1401 | + /// FSDelivery stores incoming e-mail on the file system in the Maildir format |
1402 | + /// for each address it's configured to handle. |
1403 | + pub struct FSDelivery { |
1404 | + maildirs: BTreeMap<String, Maildir>, |
1405 | + } |
1406 | + |
1407 | + impl FSDelivery { |
1408 | + /// Initialize a new Maildir on the file system. |
1409 | + pub fn new(path: &Path, addresses: &[String]) -> Result<Self, std::io::Error> { |
1410 | + let maildirs: Result<Vec<(String, Maildir)>, std::io::Error> = addresses |
1411 | + .iter() |
1412 | + .map(|address| { |
1413 | + let mbox_dir = path.join(address); |
1414 | + let maildir: Maildir = mbox_dir.into(); |
1415 | + maildir.create_dirs()?; |
1416 | + Ok((address.to_string(), maildir)) |
1417 | + }) |
1418 | + .collect(); |
1419 | + let maildirs = maildirs?; |
1420 | + Ok(FSDelivery { |
1421 | + maildirs: maildirs.into_iter().collect(), |
1422 | + }) |
1423 | + } |
1424 | + } |
1425 | + |
1426 | + #[async_trait::async_trait] |
1427 | + impl Delivery for FSDelivery { |
1428 | + async fn deliver(&self, message: &Envelope) -> Result<(), DeliveryError> { |
1429 | + println!( |
1430 | + "New SMTP Message:\n{}", |
1431 | + String::from_utf8_lossy(message.body.raw_message()) |
1432 | + ); |
1433 | + for rcpt in message.rcpt_to.iter() { |
1434 | + if let Some(maildir) = self.maildirs.get(&rcpt.email()) { |
1435 | + maildir |
1436 | + .store_new(message.body.raw_message()) |
1437 | + .map_err(|e| match e { |
1438 | + maildir::MaildirError::Io(io_err) => DeliveryError::Io(io_err), |
1439 | + maildir::MaildirError::Utf8(_) => unreachable!(), |
1440 | + maildir::MaildirError::Time(e) => DeliveryError::Server(e.to_string()), |
1441 | + })?; |
1442 | + } else { |
1443 | + tracing::warn!("Ignoring unknown e-mail account: {}", rcpt); |
1444 | + } |
1445 | + } |
1446 | + Ok(()) |
1447 | + } |
1448 | + } |
1449 | + |
1450 | + #[tokio::main] |
1451 | + async fn main() -> Result<(), Box<dyn std::error::Error>> { |
1452 | + let args = Args::parse(); |
1453 | + let config_str = read_to_string(Path::new(&args.config))?; |
1454 | + let config: config::Config = from_str(&config_str)?; |
1455 | + // Create a subscriber that logs events to the console |
1456 | + tracing_subscriber::fmt() |
1457 | + .compact() |
1458 | + .with_line_number(true) |
1459 | + .with_max_level(Level::DEBUG) |
1460 | + .init(); |
1461 | + let accounts = config.accounts.clone(); |
1462 | + let addresses: Vec<String> = accounts |
1463 | + .iter() |
1464 | + .map(|account| account.address.clone()) |
1465 | + .collect(); |
1466 | + // initialize maildirs before starting |
1467 | + let delivery = FSDelivery::new(Path::new(&config.maildir), &addresses)?; |
1468 | + let mut mail_server = Server::default() |
1469 | + .address(&config.address) |
1470 | + .with_milter(MilterFunc(|message: &Message<'static>| { |
1471 | + let message = message.clone(); |
1472 | + async move { Ok(message.to_owned()) } |
1473 | + })) |
1474 | + .with_delivery(delivery) |
1475 | + .dkim_verification(config.dkim.enabled) |
1476 | + .spf_verification(config.spf.enabled); |
1477 | + |
1478 | + if let Some(tls_config) = config.tls { |
1479 | + tracing::info!("TLS enabled"); |
1480 | + mail_server = mail_server.with_certificates(&tls_config.key, &tls_config.certificate); |
1481 | + // session_opts = session_opts.starttls_enabled(true); |
1482 | + } |
1483 | + |
1484 | + if config.proxy_protocol.is_some_and(|enabled| enabled) { |
1485 | + mail_server = mail_server.proxy_protocol(true); |
1486 | + }; |
1487 | + |
1488 | + // mail_server = mail_server.with_session_opts(session_opts); |
1489 | + mail_server.listen().await?; |
1490 | + Ok(()) |
1491 | + } |