1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
use serde::Deserialize;
// Raw DS to deserialize XML report
#[derive(Debug, Deserialize)]
pub struct Feedback {
pub version: String,
pub report_metadata: ReportMetadata,
pub policy_published: PolicyPublished,
pub record: Record,
}
#[derive(Debug, Deserialize)]
pub struct ReportMetadata {
pub org_name: String,
pub email: String,
pub report_id: String,
pub date_range: DateRange,
}
#[derive(Debug, Deserialize)]
pub struct DateRange {
pub begin: String,
pub end: String,
}
#[derive(Debug, Deserialize)]
pub struct PolicyPublished {
pub domain: String,
pub adkim: String,
pub aspf: String,
pub p: String,
pub sp: String,
pub pct: String,
pub fo: String,
}
#[derive(Debug, Deserialize)]
pub struct Record {
pub row: Row,
pub identifiers: Identifiers,
pub auth_results: AuthResults,
}
#[derive(Debug, Deserialize)]
pub struct Row {
pub source_ip: String,
pub count: String,
pub policy_evaluated: PolicyEvaluated,
}
#[derive(Debug, Deserialize)]
pub struct PolicyEvaluated {
pub disposition: String,
pub dkim: String,
pub spf: String,
}
#[derive(Debug, Deserialize)]
pub struct Identifiers {
pub envelope_to: String,
pub envelope_from: String,
pub header_from: String,
}
#[derive(Debug, Deserialize)]
pub struct AuthResults {
pub dkim: DKIM,
pub spf: SPF,
}
#[derive(Debug, Deserialize)]
pub struct DKIM {
pub domain: String,
pub selector: String,
pub result: String,
}
#[derive(Debug, Deserialize)]
pub struct SPF {
pub domain: String,
pub scope: String,
pub result: String,
}
// Rust interface DS for HTML generation
pub enum DMARCPolicy {
None,
Quarantine,
Reject,
}
pub enum DMARCAlignment {
Relaxed,
Strict,
}
pub enum DMARCFailureOption {
AlignedPassFailure,
OtherAlignedPassFailure,
SignatureAlignmentFailure,
SPFFailure,
}
pub struct DMARCRecord {
pub domain: String,
pub adkim: DMARCAlignment,
pub aspf: DMARCAlignment,
pub policy: DMARCPolicy,
pub subdomain_policy: DMARCPolicy,
pub percentage: u64,
pub failure_opt: DMARCFailureOption,
}
pub struct DMARCReport {
pub id: String,
pub org: String,
pub record: DMARCRecord,
pub dkim_pass: bool,
pub spf_pass: bool,
}
|