1Mail::SPF::Util(3) User Contributed Perl Documentation Mail::SPF::Util(3)
2
3
4
6 Mail::SPF::Util - Mail::SPF utility class
7
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
33 Mail::SPF::Util is Mail::SPF's utility class.
34
35 Class methods
36 The following class methods are provided:
37
38 hostname: returns string
39 Returns the fully qualified domain name (FQDN) of the local host.
40
41 ipv4_address_to_ipv6($ipv4_address): returns NetAddr::IP; throws
42 Mail::SPF::EInvalidOptionValue
43 Converts the specified NetAddr::IP IPv4 address into an IPv4-mapped
44 IPv6 address. Throws a Mail::SPF::EInvalidOptionValue exception if
45 the specified IP address is not an IPv4 address.
46
47 ipv6_address_to_ipv4($ipv6_address): returns NetAddr::IP; throws
48 Mail::SPF::EInvalidOptionValue
49 Converts the specified NetAddr::IP IPv4-mapped IPv6 address into a
50 proper IPv4 address. Throws a Mail::SPF::EInvalidOptionValue
51 exception if the specified IP address is not an IPv4-mapped IPv6
52 address.
53
54 ipv6_address_is_ipv4_mapped($ipv6_address): returns boolean
55 Returns true if the specified NetAddr::IP IPv6 address is an
56 IPv4-mapped address, false otherwise.
57
58 ip_address_to_string($ip_address): returns string; throws
59 Mail::SPF::EInvalidOptionValue
60 Returns the given NetAddr::IP IPv4 or IPv6 address compactly
61 formatted as a string. For IPv4 addresses, this is equivalent to
62 calling NetAddr::IP's "addr" method. For IPv6 addresses, this is
63 equivalent to calling NetAddr::IP's "short" method. Throws a
64 Mail::SPF::EInvalidOptionValue exception if the specified object is
65 not a NetAddr::IP IPv4 or IPv6 address object.
66
67 ip_address_reverse($ip_address): returns string; throws
68 Mail::SPF::EInvalidOptionValue
69 Returns the "in-addr.arpa."/"ip6.arpa." reverse notation of the
70 given NetAddr::IP IPv4 or IPv6 address. Throws a
71 Mail::SPF::EInvalidOptionValue exception if the specified object is
72 not a NetAddr::IP IPv4 or IPv6 address object.
73
74 valid_domain_for_ip_address($server, $request, $ip_address, $domain,
75 $find_best_match = false, $accept_any_domain = false): returns string
76 or undef
77 Finds a valid domain name for the given NetAddr::IP IP address that
78 matches the given domain or a sub-domain thereof. A domain name is
79 valid for the given IP address if the IP address reverse-maps to
80 that domain name in DNS, and the domain name in turn forward-maps
81 to the IP address. Uses the given Mail::SPF::Server and
82 Mail::SPF::Request objects to perform DNS look-ups. Returns the
83 validated domain name.
84
85 If $find_best_match is true, the one domain name is selected that
86 best matches the given domain name, preferring direct matches over
87 sub-domain matches. Defaults to false.
88
89 If $accept_any_domain is true, any domain names are considered
90 acceptable, even if they differ completely from the given domain
91 name (which is then effectively unused unless a best match is
92 requested). Defaults to false.
93
95 Mail::SPF
96
97 For availability, support, and license information, see the README file
98 included with Mail::SPF.
99
101 Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org>
102
103
104
105perl v5.12.2 2010-12-06 Mail::SPF::Util(3)