1 | =head1 NAME |
1 | =head1 NAME |
2 | |
2 | |
3 | EV::ADNS - |
3 | EV::ADNS - lightweight asynchronous dns queries using EV and libadns |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
|
|
7 | use EV; |
7 | use EV::ADNS; |
8 | use EV::ADNS; |
8 | |
9 | |
9 | EV::ADNS::submit "example.com", EV::ADNS::r_a, 0, sub { |
10 | EV::ADNS::submit "example.com", EV::ADNS::r_a, 0, sub { |
10 | my ($status, $expires, @a) = @_; |
11 | my ($status, $expires, @a) = @_; |
11 | warn $a[0]; # "127.13.166.3" etc. |
12 | warn $a[0]; # "127.13.166.3" etc. |
12 | }; |
13 | }; |
|
|
14 | |
|
|
15 | EV::loop; |
13 | |
16 | |
14 | =head1 DESCRIPTION |
17 | =head1 DESCRIPTION |
15 | |
18 | |
16 | This is a simple interface to libadns (asynchronous dns) that |
19 | This is a simple interface to libadns (asynchronous dns) that |
17 | integrates well and automatically into the EV event loop. The |
20 | integrates well and automatically into the EV event loop. The |
… | |
… | |
60 | |
63 | |
61 | =item EV::ADNS::rr_a |
64 | =item EV::ADNS::rr_a |
62 | |
65 | |
63 | An IPv4 address in dotted quad (string) form. |
66 | An IPv4 address in dotted quad (string) form. |
64 | |
67 | |
65 | =item adns_r_ns_raw, adns_r_cname, adns_r_ptr, adns_r_ptr_raw |
68 | =item EV::ADNS::r_ns_raw, EV::ADNS::r_cname, EV::ADNS::r_ptr, EV::ADNS::r_ptr_raw |
66 | |
69 | |
67 | The resource record as a simple string. |
70 | The resource record as a simple string. |
68 | |
71 | |
69 | =item adns_r_txt |
72 | =item EV::ADNS::r_txt |
70 | |
73 | |
71 | An arrayref of strings. |
74 | An arrayref of strings. |
72 | |
75 | |
73 | =item adns_r_ns |
76 | =item EV::ADNS::r_ns |
74 | |
77 | |
75 | A "host address", a hostname with any number of addresses (hint records). |
78 | A "host address", a hostname with any number of addresses (hint records). |
76 | |
79 | |
77 | Currently only the hostname will be stored, so this is alway an arrayref |
80 | Currently only the hostname will be stored, so this is alway an arrayref |
78 | with a single element of the hostname. Future versions might add |
81 | with a single element of the hostname. Future versions might add |
79 | additional address entries. |
82 | additional address entries. |
80 | |
83 | |
81 | =item adns_r_hinfo |
84 | =item EV::ADNS::r_hinfo |
82 | |
85 | |
83 | An arrayref consisting of the two strings. |
86 | An arrayref consisting of the two strings. |
84 | |
87 | |
85 | =item adns_r_rp, adns_r_rp_raw |
88 | =item EV::ADNS::r_rp, EV::ADNS::r_rp_raw |
86 | |
89 | |
87 | An arrayref with two strings. |
90 | An arrayref with two strings. |
88 | |
91 | |
89 | =item adns_r_mx |
92 | =item EV::ADNS::r_mx |
90 | |
93 | |
91 | An arrayref consisting of the priority and a "host address" (see |
94 | An arrayref consisting of the priority and a "host address" (see |
92 | C<adns_r_ns>). Example: |
95 | C<EV::ADNS::r_ns>). Example: |
93 | |
96 | |
94 | [10,"mail10.example.com"] |
97 | [10, "mail10.example.com"] |
95 | |
98 | |
96 | =item adns_r_mx_raw: |
99 | =item EV::ADNS::r_mx_raw |
97 | |
100 | |
98 | An arrayref consisting of the priority and the hostname, e.g. C<[10, |
101 | An arrayref consisting of the priority and the hostname, e.g. C<[10, |
99 | "mail.example.com"]>. |
102 | "mail.example.com"]>. |
100 | |
103 | |
101 | =item adns_r_soa, adns_r_soa_raw |
104 | =item EV::ADNS::r_soa, EV::ADNS::r_soa_raw |
102 | |
105 | |
103 | An arrayref consisting of the primary nameserver, admin name, serial, |
106 | An arrayref consisting of the primary nameserver, admin name, serial, |
104 | refresh, retry expire and minimum times, e.g.: |
107 | refresh, retry expire and minimum times, e.g.: |
105 | |
108 | |
106 | ["ns.example.net","hostmaster@example.net",2000001102,86400,21600,2592000,172800] |
109 | ["ns.example.net", "hostmaster@example.net", 2000001102, 86400, 21600, 2592000, 172800] |
107 | |
110 | |
108 | The "raw" form doesn't mangle the e-mail address. |
111 | The "raw" form doesn't mangle the e-mail address. |
109 | |
112 | |
110 | =item adns_r_srv_raw |
113 | =item EV::ADNS::r_srv_raw |
111 | |
114 | |
112 | An arrayref consisting of the priority, weight, port and hostname, e.g.: |
115 | An arrayref consisting of the priority, weight, port and hostname, e.g.: |
113 | |
116 | |
114 | [10,10,5060,"sip1.example.net"] |
117 | [10, 10, 5060, "sip1.example.net"] |
115 | |
118 | |
116 | =item adns_r_srv |
119 | =item EV::ADNS::r_srv |
117 | |
120 | |
118 | The same as C<adns_r_srv_raw>, but the hostname is replaced by a "host |
121 | The same as C<EV::ADNS::r_srv_raw>, but the hostname is replaced by a "host |
119 | address" (see C<adns_r_ns>). |
122 | address" (see C<EV::ADNS::r_ns>). |
120 | |
123 | |
121 | =item adns_r_unknown |
124 | =item EV::ADNS::r_unknown |
122 | |
125 | |
123 | A single octet string with the raw contents. |
126 | A single octet string with the raw contents. |
124 | |
127 | |
125 | =item anything else |
128 | =item anything else |
126 | |
129 | |
… | |
… | |
140 | |
143 | |
141 | use Carp (); |
144 | use Carp (); |
142 | use EV (); |
145 | use EV (); |
143 | |
146 | |
144 | BEGIN { |
147 | BEGIN { |
145 | $VERSION = '0.1'; |
148 | $VERSION = '0.2'; |
146 | |
149 | |
147 | require XSLoader; |
150 | require XSLoader; |
148 | XSLoader::load (EV::ADNS, $VERSION); |
151 | XSLoader::load (EV::ADNS, $VERSION); |
149 | } |
152 | } |
150 | |
153 | |