| 1 | package Firefox::Marionette::DNSscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/; |
| 2 | |
| 3 | use strictscip-perl cpan Firefox-Marionette 1.70 strict/; |
| 4 | use warningsscip-perl cpan Firefox-Marionette 1.70 warnings/; |
| 5 | use Exporterscip-perl cpan Firefox-Marionette 1.70 Exporter/(); |
| 6 | *import = \&Exporter::importscip-perl cpan Firefox-Marionette 1.70 Exporter/import().; |
| 7 | our @EXPORT_OKscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/`@EXPORT_OK`. = qw( |
| 8 | RESOLVE_TYPE_DEFAULT |
| 9 | RESOLVE_TYPE_TXT |
| 10 | RESOLVE_TYPE_HTTPSSVC |
| 11 | RESOLVE_BYPASS_CACHE |
| 12 | RESOLVE_CANONICAL_NAME |
| 13 | RESOLVE_PRIORITY_MEDIUM |
| 14 | RESOLVE_PRIORITY_LOW |
| 15 | RESOLVE_SPECULATE |
| 16 | RESOLVE_DISABLE_IPV6 |
| 17 | RESOLVE_OFFLINE |
| 18 | RESOLVE_DISABLE_IPV4 |
| 19 | RESOLVE_ALLOW_NAME_COLLISION |
| 20 | RESOLVE_DISABLE_TRR |
| 21 | RESOLVE_REFRESH_CACHE |
| 22 | RESOLVE_TRR_MODE_MASK |
| 23 | RESOLVE_TRR_DISABLED_MODE |
| 24 | RESOLVE_IGNORE_SOCKS_DNS |
| 25 | RESOLVE_IP_HINT |
| 26 | RESOLVE_WANT_RECORD_ON_ERROR |
| 27 | RESOLVE_DISABLE_NATIVE_HTTPS_QUERY |
| 28 | RESOLVE_CREATE_MOCK_HTTPS_RR |
| 29 | ALL_DNSFLAGS_BITS |
| 30 | ); |
| 31 | |
| 32 | our %EXPORT_TAGSscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/`%EXPORT_TAGS`. = ( 'all' => \@EXPORT_OKscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/`@EXPORT_OK`., ); |
| 33 | |
| 34 | our $VERSIONscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/$VERSION. = '1.70'; |
| 35 | |
| 36 | sub RESOLVE_TYPE_DEFAULTscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_TYPE_DEFAULT(). { return 0 } |
| 37 | sub RESOLVE_TYPE_TXTscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_TYPE_TXT(). { return 16 } |
| 38 | sub RESOLVE_TYPE_HTTPSSVCscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_TYPE_HTTPSSVC(). { return 65 } |
| 39 | sub RESOLVE_DEFAULT_FLAGSscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_DEFAULT_FLAGS(). { return 0 } |
| 40 | sub RESOLVE_BYPASS_CACHEscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_BYPASS_CACHE(). { return 1 } |
| 41 | sub RESOLVE_CANONICAL_NAMEscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_CANONICAL_NAME(). { return 2 } |
| 42 | sub RESOLVE_PRIORITY_MEDIUMscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_PRIORITY_MEDIUM(). { return 4 } |
| 43 | sub RESOLVE_PRIORITY_LOWscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_PRIORITY_LOW(). { return 8 } |
| 44 | sub RESOLVE_SPECULATEscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_SPECULATE(). { return 16 } |
| 45 | sub RESOLVE_DISABLE_IPV6scip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_DISABLE_IPV6(). { return 32 } |
| 46 | sub RESOLVE_OFFLINEscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_OFFLINE(). { return 64 } |
| 47 | sub RESOLVE_DISABLE_IPV4scip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_DISABLE_IPV4(). { return 128 } |
| 48 | sub RESOLVE_ALLOW_NAME_COLLISIONscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_ALLOW_NAME_COLLISION(). { return 256 } |
| 49 | sub RESOLVE_DISABLE_TRRscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_DISABLE_TRR(). { return 512 } |
| 50 | sub RESOLVE_REFRESH_CACHEscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_REFRESH_CACHE(). { return 1024 } |
| 51 | sub RESOLVE_TRR_MODE_MASKscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_TRR_MODE_MASK(). { return 6144 } |
| 52 | sub RESOLVE_TRR_DISABLED_MODEscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_TRR_DISABLED_MODE(). { return 2048 } |
| 53 | sub RESOLVE_IGNORE_SOCKS_DNSscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_IGNORE_SOCKS_DNS(). { return 8192 } |
| 54 | sub RESOLVE_IP_HINTscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_IP_HINT(). { return 16_384 } |
| 55 | sub RESOLVE_WANT_RECORD_ON_ERRORscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_WANT_RECORD_ON_ERROR(). { return 65_536 } |
| 56 | sub RESOLVE_DISABLE_NATIVE_HTTPS_QUERYscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_DISABLE_NATIVE_HTTPS_QUERY(). { return 131_072 } |
| 57 | sub RESOLVE_CREATE_MOCK_HTTPS_RRscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/RESOLVE_CREATE_MOCK_HTTPS_RR(). { return 262_144 } |
| 58 | sub ALL_DNSFLAGS_BITSscip-perl cpan Firefox-Marionette 1.70 Firefox/Marionette/DNS/ALL_DNSFLAGS_BITS(). { return 524_287 } |
| 59 | |
| 60 | 1; # Magic true value required at end of module |
| 61 | __END__ |
| 62 | =head1 NAME |
| 63 | |
| 64 | Firefox::Marionette::DNS - Constants for calls to the resolve method |
| 65 | |
| 66 | =head1 VERSION |
| 67 | |
| 68 | Version 1.70 |
| 69 | |
| 70 | =head1 SYNOPSIS |
| 71 | |
| 72 | use Firefox::Marionette(); |
| 73 | use Firefox::Marionette::DNS qw(:all); |
| 74 | use v5.10; |
| 75 | |
| 76 | my $firefox = Firefox::Marionette->new(); |
| 77 | |
| 78 | foreach my $address ($firefox->resolve('metacpan.org', type => RESOLVE_TYPE_DEFAULT(), flags => RESOLVE_BYPASS_CACHE())) { |
| 79 | ... |
| 80 | } |
| 81 | |
| 82 | =head1 DESCRIPTION |
| 83 | |
| 84 | This module handles the implementation of the Firefox Marionette DNS constants |
| 85 | |
| 86 | =head1 CONSTANTS |
| 87 | |
| 88 | =head2 RESOLVE_TYPE_DEFAULT |
| 89 | |
| 90 | returns the value of RESOLVE_TYPE_DEFAULT, which is 0, this is the standard L<A|https://en.wikipedia.org/wiki/List_of_DNS_record_types#A>/L<AAAA|https://en.wikipedia.org/wiki/List_of_DNS_record_types#AAAA> lookup. |
| 91 | |
| 92 | =head2 RESOLVE_TYPE_TXT |
| 93 | |
| 94 | returns the value of RESOLVE_TYPE_TXT, which is 1 << 4 = 16, this is a L<TXT|https://en.wikipedia.org/wiki/TXT_record> lookup. |
| 95 | |
| 96 | =head2 RESOLVE_TYPE_HTTPSSVC = 65, |
| 97 | |
| 98 | returns the value of RESOLVE_TYPE_HTTPSSVC, which is 65, this is L<Service Binding and Parameter Specification via DNS|https://datatracker.ietf.org/doc/rfc9460/>. |
| 99 | |
| 100 | =head2 RESOLVE_DEFAULT_FLAGS |
| 101 | |
| 102 | returns the value of RESOLVE_DEFAULT_FLAGS, which is 0, this is the default. |
| 103 | |
| 104 | =head2 RESOLVE_BYPASS_CACHE |
| 105 | |
| 106 | returns the value of RESOLVE_BYPASS_CACHE, which is 1 << 0 = 1, this suppresses the internal DNS lookup cache. |
| 107 | |
| 108 | =head2 RESOLVE_CANONICAL_NAME |
| 109 | |
| 110 | returns the value of RESOLVE_CANONICAL_NAME, which is 1 << 1 = 2, this queries the canonical name of the specified host. |
| 111 | |
| 112 | =head2 RESOLVE_PRIORITY_MEDIUM |
| 113 | |
| 114 | returns the value of RESOLVE_PRIORITY_MEDIUM, which is 1 << 2 = 4, this gives the query lower priority. |
| 115 | |
| 116 | =head2 RESOLVE_PRIORITY_LOW |
| 117 | |
| 118 | returns the value of RESOLVE_PRIORITY_LOW, which is 1 << 3 = 8, this gives the query lower priority still. |
| 119 | |
| 120 | =head2 RESOLVE_SPECULATE |
| 121 | |
| 122 | returns the value of RESOLVE_SPECULATE, which is 1 << 4 = 16, indicates request is speculative. Speculative requests return errors if prefetching is disabled by configuration. |
| 123 | |
| 124 | =head2 RESOLVE_DISABLE_IPV6 |
| 125 | |
| 126 | returns the value of RESOLVE_DISABLE_IPV6, which is 1 << 5 = 32, this only returns IPv4 addresses. |
| 127 | |
| 128 | =head2 RESOLVE_OFFLINE |
| 129 | |
| 130 | return 64, only literals and cached entries will be returned. |
| 131 | |
| 132 | =head2 RESOLVE_DISABLE_IPV4 |
| 133 | |
| 134 | returns 128, only IPv6 addresses will be returned from resolve/asyncResolve. |
| 135 | |
| 136 | =head2 RESOLVE_ALLOW_NAME_COLLISION |
| 137 | |
| 138 | returns the value of RESOLVE_ALLOW_NAME_COLLISION, which is 1 << 8 = 256, this allows name collision results (127.0.53.53) which are normally filtered. |
| 139 | |
| 140 | =head2 RESOLVE_DISABLE_TRR |
| 141 | |
| 142 | returns the value of RESOLVE_DISABLE_TRR, which is 1 << 9 = 512, this stops using TRR for resolving the host name. |
| 143 | |
| 144 | =head2 RESOLVE_REFRESH_CACHE |
| 145 | |
| 146 | returns the value of RESOLVE_REFRESH_CACHE, which is 1 << 10 = 1024, when set (together with L<RESOLVE_BYPASS_CACHE|/RESOLVE_BYPASS_CACHE>), invalidate the DNS existing cache entry first (if existing) then make a new resolve. |
| 147 | |
| 148 | =head2 RESOLVE_TRR_MODE_MASK |
| 149 | |
| 150 | returns the value of RESOLVE_TRR_MODE_MASK, which is ((1 << 11) | (1 << 12)) = 6144, these two bits encode the TRR mode of the request |
| 151 | |
| 152 | =head2 RESOLVE_TRR_DISABLED_MODE |
| 153 | |
| 154 | returns the value of RESOLVE_TRR_DISABLED_MODE, which is 1 << 11 = 2048. |
| 155 | |
| 156 | =head2 RESOLVE_IGNORE_SOCKS_DNS |
| 157 | |
| 158 | returns the value of RESOLVE_IGNORE_SOCKS_DNS, which is 1 << 13 = 8192, this will orce resolution even when SOCKS proxy with DNS forwarding is configured. Only to be used for the proxy host resolution. |
| 159 | |
| 160 | =head2 RESOLVE_IP_HINT |
| 161 | |
| 162 | returns the value of RESOLVE_IP_HINT, which is 1 << 14 = 16384, this will only return cached IP hint addresses from L<resolve|Firefox::Marionette#resolve>. |
| 163 | |
| 164 | =head2 RESOLVE_WANT_RECORD_ON_ERROR |
| 165 | |
| 166 | returns the value of RESOLVE_WANT_RECORD_ON_ERROR, which is 1 << 16 = 65536, this will pass a DNS record to even when there was a resolution error. |
| 167 | |
| 168 | =head2 RESOLVE_DISABLE_NATIVE_HTTPS_QUERY |
| 169 | |
| 170 | returns the value of RESOLVE_DISABLE_NATIVE_HTTPS_QUERY, which is 1 << 17 = 131072, this disables the native HTTPS queries. |
| 171 | |
| 172 | =head2 RESOLVE_CREATE_MOCK_HTTPS_RR |
| 173 | |
| 174 | returns the value of RESOLVE_CREATE_MOCK_HTTPS_RR, which is 1 << 18 = 262144, this creates a mock HTTPS RR and use it. This is only for testing purposes |
| 175 | |
| 176 | =head2 ALL_DNSFLAGS_BITS |
| 177 | |
| 178 | returns the value of ALL_DNSFLAGS_BITS, which is ((1 << 19) - 1) = 524287, this is all flags turned on. |
| 179 | |
| 180 | =head1 SUBROUTINES/METHODS |
| 181 | |
| 182 | None. |
| 183 | |
| 184 | =head1 DIAGNOSTICS |
| 185 | |
| 186 | None. |
| 187 | |
| 188 | =head1 CONFIGURATION AND ENVIRONMENT |
| 189 | |
| 190 | Firefox::Marionette::DNS requires no configuration files or environment variables. |
| 191 | |
| 192 | =head1 DEPENDENCIES |
| 193 | |
| 194 | None. |
| 195 | |
| 196 | =head1 INCOMPATIBILITIES |
| 197 | |
| 198 | None reported. |
| 199 | |
| 200 | =head1 BUGS AND LIMITATIONS |
| 201 | |
| 202 | To report a bug, or view the current list of bugs, please visit L<https://github.com/david-dick/firefox-marionette/issues> |
| 203 | |
| 204 | =head1 AUTHOR |
| 205 | |
| 206 | David Dick C<< <[email protected]> >> |
| 207 | |
| 208 | =head1 LICENSE AND COPYRIGHT |
| 209 | |
| 210 | Copyright (c) 2024, David Dick C<< <[email protected]> >>. All rights reserved. |
| 211 | |
| 212 | This module is free software; you can redistribute it and/or |
| 213 | modify it under the same terms as Perl itself. See L<perlartistic/perlartistic>. |
| 214 | |
| 215 | =head1 DISCLAIMER OF WARRANTY |
| 216 | |
| 217 | BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
| 218 | FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
| 219 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
| 220 | PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
| 221 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 222 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
| 223 | ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
| 224 | YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
| 225 | NECESSARY SERVICING, REPAIR, OR CORRECTION. |
| 226 | |
| 227 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
| 228 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
| 229 | REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE |
| 230 | LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
| 231 | OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
| 232 | THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
| 233 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
| 234 | FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
| 235 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
| 236 | SUCH DAMAGES. |