1Mail::SPF::Util(3)    User Contributed Perl Documentation   Mail::SPF::Util(3)
2
3
4

NAME

6       Mail::SPF::Util - Mail::SPF utility class
7

SYNOPSIS

9           use Mail::SPF::Util;
10
11           $hostname = Mail::SPF::Util->hostname;
12
13           $ipv6_address_v4mapped =
14               Mail::SPF::Util->ipv4_address_to_ipv6($ipv4_address);
15
16           $ipv4_address =
17               Mail::SPF::Util->ipv6_address_to_ipv4($ipv6_address_v4mapped);
18
19           $is_v4mapped =
20               Mail::SPF::Util->ipv6_address_is_ipv4_mapped($ipv6_address);
21
22           $ip_address_string  = Mail::SPF::Util->ip_address_to_string($ip_address);
23           $reverse_name       = Mail::SPF::Util->ip_address_reverse($ip_address);
24
25           $validated_domain = Mail::SPF::Util->valid_domain_for_ip_address(
26               $spf_server, $request,
27               $ip_address, $domain,
28               $find_best_match,       # defaults to false
29               $accept_any_domain      # defaults to false
30           );
31
32           $sanitized_string = Mail::SPF::Util->sanitize_string($string);
33

DESCRIPTION

35       Mail::SPF::Util is Mail::SPF's utility class.
36
37   Class methods
38       The following class methods are provided:
39
40       hostname: returns string
41           Returns the fully qualified domain name (FQDN) of the local host.
42
43       ipv4_address_to_ipv6($ipv4_address): returns NetAddr::IP; throws
44       Mail::SPF::EInvalidOptionValue
45           Converts the specified NetAddr::IP IPv4 address into an IPv4-mapped
46           IPv6 address.  Throws a Mail::SPF::EInvalidOptionValue exception if
47           the specified IP address is not an IPv4 address.
48
49       ipv6_address_to_ipv4($ipv6_address): returns NetAddr::IP; throws
50       Mail::SPF::EInvalidOptionValue
51           Converts the specified NetAddr::IP IPv4-mapped IPv6 address into a
52           proper IPv4 address.  Throws a Mail::SPF::EInvalidOptionValue
53           exception if the specified IP address is not an IPv4-mapped IPv6
54           address.
55
56       ipv6_address_is_ipv4_mapped($ipv6_address): returns boolean
57           Returns true if the specified NetAddr::IP IPv6 address is an
58           IPv4-mapped address, false otherwise.
59
60       ip_address_to_string($ip_address): returns string; throws
61       Mail::SPF::EInvalidOptionValue
62           Returns the given NetAddr::IP IPv4 or IPv6 address compactly
63           formatted as a string.  For IPv4 addresses, this is equivalent to
64           calling NetAddr::IP's "addr" method.  For IPv6 addresses, this is
65           equivalent to calling NetAddr::IP's "short" method.  Throws a
66           Mail::SPF::EInvalidOptionValue exception if the specified object is
67           not a NetAddr::IP IPv4 or IPv6 address object.
68
69       ip_address_reverse($ip_address): returns string; throws
70       Mail::SPF::EInvalidOptionValue
71           Returns the "in-addr.arpa."/"ip6.arpa." reverse notation of the
72           given NetAddr::IP IPv4 or IPv6 address.  Throws a
73           Mail::SPF::EInvalidOptionValue exception if the specified object is
74           not a NetAddr::IP IPv4 or IPv6 address object.
75
76       valid_domain_for_ip_address($server, $request, $ip_address, $domain,
77       $find_best_match = false, $accept_any_domain = false): returns string
78       or undef
79           Finds a valid domain name for the given NetAddr::IP IP address that
80           matches the given domain or a sub-domain thereof.  A domain name is
81           valid for the given IP address if the IP address reverse-maps to
82           that domain name in DNS, and the domain name in turn forward-maps
83           to the IP address.  Uses the given Mail::SPF::Server and
84           Mail::SPF::Request objects to perform DNS look-ups.  Returns the
85           validated domain name.
86
87           If $find_best_match is true, the one domain name is selected that
88           best matches the given domain name, preferring direct matches over
89           sub-domain matches.  Defaults to false.
90
91           If $accept_any_domain is true, any domain names are considered
92           acceptable, even if they differ completely from the given domain
93           name (which is then effectively unused unless a best match is
94           requested).  Defaults to false.
95
96       sanitize_string($string): returns string or undef
97           Replaces all non-printable or non-ascii characters in a string with
98           their hex-escaped representation (e.g., "\x00").
99

SEE ALSO

101       Mail::SPF
102
103       For availability, support, and license information, see the README file
104       included with Mail::SPF.
105

AUTHORS

107       Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org>
108
109
110
111perl v5.30.1                      2020-01-30                Mail::SPF::Util(3)
Impressum