1mod fixtures;
25mod server;
26mod spec_registry;
27
28pub use fixtures::*;
29pub use server::*;
30pub use spec_registry::*;
31
32use serde::{Deserialize, Serialize};
33use std::path::PathBuf;
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct SmtpConfig {
38 pub port: u16,
40 pub host: String,
42 pub hostname: String,
44 pub fixtures_dir: Option<PathBuf>,
46 pub timeout_secs: u64,
48 pub max_connections: usize,
50 pub enable_mailbox: bool,
52 pub max_mailbox_messages: usize,
54 pub enable_starttls: bool,
56 pub tls_cert_path: Option<PathBuf>,
58 pub tls_key_path: Option<PathBuf>,
60}
61
62impl Default for SmtpConfig {
63 fn default() -> Self {
64 Self {
65 port: 1025,
66 host: "0.0.0.0".to_string(),
67 hostname: "mockforge-smtp".to_string(),
68 fixtures_dir: Some(PathBuf::from("./fixtures/smtp")),
69 timeout_secs: 300,
70 max_connections: 10,
71 enable_mailbox: true,
72 max_mailbox_messages: 1000,
73 enable_starttls: false,
74 tls_cert_path: None,
75 tls_key_path: None,
76 }
77 }
78}
79
80#[cfg(test)]
81mod tests {
82 use super::*;
83 use mockforge_core::protocol_abstraction::Protocol;
84
85 #[test]
86 fn test_default_config() {
87 let config = SmtpConfig::default();
88 assert_eq!(config.port, 1025);
89 assert_eq!(config.host, "0.0.0.0");
90 assert_eq!(config.hostname, "mockforge-smtp");
91 }
92
93 #[test]
94 fn test_protocol_display() {
95 assert_eq!(Protocol::Smtp.to_string(), "SMTP");
96 }
97}