rewrite
[ghsmtp.git] / SRS0-test.cpp
blob525692e125a1ca4a0c2ca02d85367025973093ac
1 #include "SRS0.hpp"
3 #include "osutil.hpp"
5 #include <iostream>
7 #include <fmt/format.h>
8 #include <fmt/ostream.h>
10 #include <gflags/gflags.h>
12 #include <glog/logging.h>
14 using namespace std::string_literals;
16 int main(int argc, char* argv[])
18 google::ParseCommandLineFlags(&argc, &argv, true);
20 fs::path config_path = osutil::get_config_dir();
22 SRS0 srs(config_path);
24 auto const rep_enc =
25 srs.enc_reply(SRS0::from_to{"reply@example.com", "local-A"});
27 std::cout << rep_enc << '\n';
29 auto const rep_dec = srs.dec_reply(rep_enc);
30 CHECK(rep_dec);
32 std::cout << rep_dec->mail_from << '\n';
33 std::cout << rep_dec->rcpt_to_local_part << '\n';
35 auto const bnc_enc =
36 srs.enc_bounce(SRS0::from_to{"noreply@example.com", "local-B"});
38 std::cout << bnc_enc << '\n';
40 auto const bnc_dec = srs.dec_bounce(bnc_enc, 10);
41 CHECK(bnc_dec);
43 std::cout << bnc_dec->mail_from << '\n';