Rewrite the project
The previous project architecture was far too complicated and hard to maintain. The new one is much more simple. Although procedural macros are cools, they are a no-go on Rust-OpenSMTPD. Reports and filter are implemented (except data-line) but untested.
This commit is contained in:
parent
fc072743ad
commit
a6d4dd21c1
48 changed files with 1723 additions and 1493 deletions
20
src/data_structures/address.rs
Normal file
20
src/data_structures/address.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use std::net::SocketAddr;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Address {
|
||||
Ip(SocketAddr),
|
||||
UnixSocket(PathBuf),
|
||||
}
|
||||
|
||||
impl ToString for Address {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Address::Ip(a) => a.to_string(),
|
||||
Address::UnixSocket(a) => match a.clone().into_os_string().into_string() {
|
||||
Ok(s) => s,
|
||||
Err(_) => String::new(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue