include local-part in message
[ghsmtp.git] / IP6.hpp
blobc7a5b218d5e274e020a3ce19ff99d217f709808b
1 #ifndef IP6_DOT_HPP
2 #define IP6_DOT_HPP
4 #include <string>
5 #include <string_view>
7 #include <glog/logging.h>
9 namespace IP6 {
10 using namespace std::literals::string_view_literals;
12 auto is_private(std::string_view addr) -> bool;
13 auto is_address(std::string_view addr) -> bool;
14 auto is_address_literal(std::string_view addr) -> bool;
15 auto to_address_literal(std::string_view addr) -> std::string;
16 auto reverse(std::string_view addr) -> std::string;
18 auto constexpr lit_pfx{"[IPv6:"sv};
19 auto constexpr lit_pfx_sz{lit_pfx.size()};
21 auto constexpr lit_sfx{"]"sv};
22 auto constexpr lit_sfx_sz{lit_sfx.size()};
24 auto constexpr lit_extra_sz{lit_pfx_sz + lit_sfx_sz};
26 auto constexpr loopback_literal{"[IPv6:::1]"};
28 constexpr auto as_address(std::string_view address_literal) -> std::string_view
30 // CHECK(is_address_literal(address_literal));
31 return address_literal.substr(lit_pfx_sz,
32 address_literal.length() - lit_extra_sz);
35 } // namespace IP6
37 #endif // IP4_DOT_HPP