1Mail::SpamAssassin::DnsURseesrolCvoenrt(r3i)buted Perl DMoaciulm:e:nStpaatmiAosnsassin::DnsResolver(3)
2
3
4
6 Mail::SpamAssassin::DnsResolver - DNS resolution engine
7
9 This is a DNS resolution engine for SpamAssassin, implemented in order
10 to reduce file descriptor usage by Net::DNS and avoid a response
11 collision bug in that module.
12
14 $res->load_resolver()
15 Load the "Net::DNS::Resolver" object. Returns 0 if Net::DNS cannot
16 be used, 1 if it is available.
17
18 $resolver = $res->get_resolver()
19 Return the "Net::DNS::Resolver" object.
20
21 $res->configured_nameservers()
22 Get a list of nameservers as configured by dns_server directives or
23 as provided by Net::DNS, typically from /etc/resolv.conf
24
25 $res->available_nameservers()
26 Get or set a list of currently available nameservers, which is
27 typically a known-to-be-good subset of configured nameservers
28
29 $res->connect_sock()
30 Re-connect to the first nameserver listed in "/etc/resolv.conf" or
31 similar platform-dependent source, as provided by "Net::DNS".
32
33 $res->get_sock()
34 Return the "IO::Socket::INET" object used to communicate with the
35 nameserver.
36
37 $packet = new_dns_packet ($domain, $type, $class)
38 A wrapper for "Net::DNS::Packet::new()" which traps a die thrown by
39 it.
40
41 To use this, change calls to "Net::DNS::Resolver::bgsend" from:
42
43 $res->bgsend($domain, $type);
44
45 to:
46
47 $res->bgsend(Mail::SpamAssassin::DnsResolver::new_dns_packet($domain, $type, $class));
48
49 $id = $res->bgsend($domain, $type, $class, $cb)
50 Quite similar to "Net::DNS::Resolver::bgsend", except that when a
51 reply packet eventually arrives, and "poll_responses" is called,
52 the callback sub reference $cb will be called.
53
54 Note that $type and $class may be "undef", in which case they will
55 default to "A" and "IN", respectively.
56
57 The callback sub will be called with three arguments -- the packet
58 that was delivered, and an id string that fingerprints the query
59 packet and the expected reply. The third argument is a timestamp
60 (Unix time, floating point), captured at the time the packet was
61 collected. It is expected that a closure callback be used, like so:
62
63 my $id = $self->{resolver}->bgsend($domain, $type, undef, sub {
64 my ($reply, $reply_id, $timestamp) = @_;
65 $self->got_a_reply ($reply, $reply_id);
66 });
67
68 The callback can ignore the reply as an invalid packet sent to the
69 listening port if the reply id does not match the return value from
70 bgsend.
71
72 $id = $res->bgread()
73 Similar to "Net::DNS::Resolver::bgread". Reads a DNS packet from a
74 supplied socket, decodes it, and returns a Net::DNS::Packet object
75 if successful. Dies on error.
76
77 $nfound = $res->poll_responses()
78 See if there are any "bgsend" reply packets ready, and return the
79 number of such packets delivered to their callbacks.
80
81 $res->bgabort()
82 Call this to release pending requests from memory, when aborting
83 backgrounded requests, or when the scan is complete.
84 "Mail::SpamAssassin::PerMsgStatus::check" calls this before
85 returning.
86
87 $packet = $res->send($name, $type, $class)
88 Emulates "Net::DNS::Resolver::send()".
89
90 This subroutine is a simple synchronous leftover from SpamAssassin
91 version 3.3 and does not participate in packet query caching and
92 callback grouping as implemented by
93 AsyncLoop::bgsend_and_start_lookup(). As such it should be avoided
94 for mainstream usage. Currently used through Mail::SPF::Server by
95 the SPF plugin.
96
97 $res->errorstring()
98 Little more than a stub for callers expecting this from
99 "Net::DNS::Resolver".
100
101 If called immediately after a call to $res->send this will return
102 "query timed out" if the $res->send DNS query timed out. Otherwise
103 "unknown error or no error" will be returned.
104
105 No other errors are reported.
106
107 $res->finish_socket()
108 Reset socket when done with it.
109
110 $res->finish()
111 Clean up for destruction.
112
113
114
115perl v5.26.3 2018-09-14Mail::SpamAssassin::DnsResolver(3)