| 1 | package Zonemaster::Constants v1.0.0; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use parent 'Exporter'; | ||
| 7 | use Net::IP::XS; | ||
| 8 | use Readonly; | ||
| 9 | |||
| 10 | our @EXPORT_OK = qw[ | ||
| 11 | $ALGO_STATUS_DEPRECATED | ||
| 12 | $ALGO_STATUS_PRIVATE | ||
| 13 | $ALGO_STATUS_RESERVED | ||
| 14 | $ALGO_STATUS_UNASSIGNED | ||
| 15 | $ALGO_STATUS_VALID | ||
| 16 | $DURATION_12_HOURS_IN_SECONDS | ||
| 17 | $DURATION_180_DAYS_IN_SECONDS | ||
| 18 | $FQDN_MAX_LENGTH | ||
| 19 | $LABEL_MAX_LENGTH | ||
| 20 | $IP_VERSION_4 | ||
| 21 | $IP_VERSION_6 | ||
| 22 | $MAX_SERIAL_VARIATION | ||
| 23 | $MINIMUM_NUMBER_OF_NAMESERVERS | ||
| 24 | $SOA_DEFAULT_TTL_MAXIMUM_VALUE | ||
| 25 | $SOA_DEFAULT_TTL_MINIMUM_VALUE | ||
| 26 | $SOA_EXPIRE_MINIMUM_VALUE | ||
| 27 | $SOA_REFRESH_MINIMUM_VALUE | ||
| 28 | $SOA_RETRY_MINIMUM_VALUE | ||
| 29 | $UDP_PAYLOAD_LIMIT | ||
| 30 | @IPV4_SPECIAL_ADDRESSES | ||
| 31 | @IPV6_SPECIAL_ADDRESSES | ||
| 32 | ]; | ||
| 33 | |||
| 34 | our %EXPORT_TAGS = ( | ||
| 35 | all => \@EXPORT_OK, | ||
| 36 | algo => [ | ||
| 37 | qw($ALGO_STATUS_DEPRECATED $ALGO_STATUS_PRIVATE $ALGO_STATUS_RESERVED $ALGO_STATUS_UNASSIGNED $ALGO_STATUS_VALID) | ||
| 38 | ], | ||
| 39 | name => [qw($FQDN_MAX_LENGTH $LABEL_MAX_LENGTH)], | ||
| 40 | ip => [qw($IP_VERSION_4 $IP_VERSION_6)], | ||
| 41 | soa => [ | ||
| 42 | qw($SOA_DEFAULT_TTL_MAXIMUM_VALUE $SOA_DEFAULT_TTL_MINIMUM_VALUE $SOA_EXPIRE_MINIMUM_VALUE $SOA_REFRESH_MINIMUM_VALUE $SOA_RETRY_MINIMUM_VALUE $DURATION_12_HOURS_IN_SECONDS $DURATION_180_DAYS_IN_SECONDS $MAX_SERIAL_VARIATION) | ||
| 43 | ], | ||
| 44 | misc => [qw($UDP_PAYLOAD_LIMIT $MINIMUM_NUMBER_OF_NAMESERVERS)], | ||
| 45 | addresses => [qw(@IPV4_SPECIAL_ADDRESSES @IPV6_SPECIAL_ADDRESSES)], | ||
| 46 | ); | ||
| 47 | |||
| 48 | Readonly our $ALGO_STATUS_DEPRECATED => 1; | ||
| 49 | Readonly our $ALGO_STATUS_PRIVATE => 4; | ||
| 50 | Readonly our $ALGO_STATUS_RESERVED => 2; | ||
| 51 | Readonly our $ALGO_STATUS_UNASSIGNED => 3; | ||
| 52 | Readonly our $ALGO_STATUS_VALID => 5; | ||
| 53 | |||
| 54 | Readonly our $DURATION_12_HOURS_IN_SECONDS => 12 * 60 * 60; | ||
| 55 | Readonly our $DURATION_180_DAYS_IN_SECONDS => 180 * 24 * 60 * 60; | ||
| 56 | |||
| 57 | # Maximum length of ASCII version of a domain name, with trailing dot. | ||
| 58 | Readonly our $FQDN_MAX_LENGTH => 254; | ||
| 59 | Readonly our $LABEL_MAX_LENGTH => 63; | ||
| 60 | |||
| 61 | Readonly our $IP_VERSION_4 => 4; | ||
| 62 | Readonly our $IP_VERSION_6 => 6; | ||
| 63 | |||
| 64 | Readonly our $MAX_SERIAL_VARIATION => 0; | ||
| 65 | |||
| 66 | Readonly our $MINIMUM_NUMBER_OF_NAMESERVERS => 2; | ||
| 67 | |||
| 68 | Readonly our $SOA_DEFAULT_TTL_MAXIMUM_VALUE => 86_400; # 1 day | ||
| 69 | Readonly our $SOA_DEFAULT_TTL_MINIMUM_VALUE => 300; # 5 minutes | ||
| 70 | Readonly our $SOA_EXPIRE_MINIMUM_VALUE => 604_800; # 1 week | ||
| 71 | Readonly our $SOA_REFRESH_MINIMUM_VALUE => 14_400; # 4 hours | ||
| 72 | Readonly our $SOA_RETRY_MINIMUM_VALUE => 3_600; # 1 hour | ||
| 73 | |||
| 74 | Readonly our $UDP_PAYLOAD_LIMIT => 512; | ||
| 75 | |||
| 76 | Readonly::Array our @IPV4_SPECIAL_ADDRESSES => ( | ||
| 77 | { ip => Net::IP::XS->new( q{0.0.0.0/8} ), name => q{This host on this network}, reference => q{RFC 1122} }, | ||
| 78 | { ip => Net::IP::XS->new( q{10.0.0.0/8} ), name => q{Private-Use}, reference => q{RFC 1918} }, | ||
| 79 | { ip => Net::IP::XS->new( q{192.168.0.0/16} ), name => q{Private-Use}, reference => q{RFC 1918} }, | ||
| 80 | { ip => Net::IP::XS->new( q{172.16.0.0/12} ), name => q{Private-Use}, reference => q{RFC 1918} }, | ||
| 81 | { ip => Net::IP::XS->new( q{100.64.0.0/10} ), name => q{Shared Address Space}, reference => q{RFC 6598} }, | ||
| 82 | { ip => Net::IP::XS->new( q{127.0.0.0/8} ), name => q{Loopback}, reference => q{RFC 1122} }, | ||
| 83 | { ip => Net::IP::XS->new( q{169.254.0.0/16} ), name => q{Link Local}, reference => q{RFC 3927} }, | ||
| 84 | { ip => Net::IP::XS->new( q{192.0.0.0/24} ), name => q{IETF Protocol Assignments}, reference => q{RFC 6890} }, | ||
| 85 | { ip => Net::IP::XS->new( q{192.0.0.0/29} ), name => q{DS Lite}, reference => q{RFC 6333} }, | ||
| 86 | { ip => Net::IP::XS->new( q{192.0.0.170/32} ), name => q{NAT64/DNS64 Discovery}, reference => q{RFC 7050} }, | ||
| 87 | { ip => Net::IP::XS->new( q{192.0.0.171/32} ), name => q{NAT64/DNS64 Discovery}, reference => q{RFC 7050} }, | ||
| 88 | { ip => Net::IP::XS->new( q{192.0.2.0/24} ), name => q{Documentation}, reference => q{RFC 5737} }, | ||
| 89 | { ip => Net::IP::XS->new( q{198.51.100.0/24} ), name => q{Documentation}, reference => q{RFC 5737} }, | ||
| 90 | { ip => Net::IP::XS->new( q{203.0.113.0/24} ), name => q{Documentation}, reference => q{RFC 5737} }, | ||
| 91 | { ip => Net::IP::XS->new( q{192.88.99.0/24} ), name => q{6to4 Relay Anycast}, reference => q{RFC 3068} }, | ||
| 92 | { ip => Net::IP::XS->new( q{198.18.0.0/15} ), name => q{Benchmarking}, reference => q{RFC 2544} }, | ||
| 93 | { ip => Net::IP::XS->new( q{240.0.0.0/4} ), name => q{Reserved}, reference => q{RFC 1112} }, | ||
| 94 | { ip => Net::IP::XS->new( q{255.255.255.255/32} ), name => q{Limited Broadcast}, reference => q{RFC 919} }, | ||
| 95 | { ip => Net::IP::XS->new( q{224.0.0.0/4} ), name => q{IPv4 multicast addresses}, reference => q{RFC 5771} }, | ||
| 96 | ); | ||
| 97 | |||
| 98 | Readonly::Array our @IPV6_SPECIAL_ADDRESSES => ( | ||
| 99 | { ip => Net::IP::XS->new( q{::1/128} ), name => q{Loopback Address}, reference => q{RFC 4291} }, | ||
| 100 | { ip => Net::IP::XS->new( q{::/128} ), name => q{Unspecified Address}, reference => q{RFC 4291} }, | ||
| 101 | { ip => Net::IP::XS->new( q{::ffff:0:0/96} ), name => q{IPv4-mapped Address}, reference => q{RFC 4291} }, | ||
| 102 | { ip => Net::IP::XS->new( q{64:ff9b::/96} ), name => q{IPv4-IPv6 Translation}, reference => q{RFC 6052} }, | ||
| 103 | { ip => Net::IP::XS->new( q{100::/64} ), name => q{Discard-Only Address Block}, reference => q{RFC 6666} }, | ||
| 104 | { ip => Net::IP::XS->new( q{2001::/23} ), name => q{IETF Protocol Assignments}, reference => q{RFC 2928} }, | ||
| 105 | { ip => Net::IP::XS->new( q{2001::/32} ), name => q{TEREDO}, reference => q{RFC 4380} }, | ||
| 106 | { ip => Net::IP::XS->new( q{2001:2::/48} ), name => q{Benchmarking}, reference => q{RFC 5180} }, | ||
| 107 | { ip => Net::IP::XS->new( q{2001:db8::/32} ), name => q{Documentation}, reference => q{RFC 3849} }, | ||
| 108 | { ip => Net::IP::XS->new( q{2001:10::/28} ), name => q{Deprecated (ORCHID)}, reference => q{RFC 4843} }, | ||
| 109 | { ip => Net::IP::XS->new( q{2002::/16} ), name => q{6to4}, reference => q{RFC 3056} }, | ||
| 110 | { ip => Net::IP::XS->new( q{fc00::/7} ), name => q{Unique-Local}, reference => q{RFC 4193} }, | ||
| 111 | { ip => Net::IP::XS->new( q{fe80::/10} ), name => q{Linked-Scoped Unicast}, reference => q{RFC 4291} }, | ||
| 112 | { ip => Net::IP::XS->new( q{::/96} ), name => q{Deprecated (IPv4-compatible Address)}, reference => q{RFC 4291} }, | ||
| 113 | { ip => Net::IP::XS->new( q{5f00::/8} ), name => q{unallocated (ex 6bone)}, reference => q{RFC 3701} }, | ||
| 114 | { ip => Net::IP::XS->new( q{3ffe::/16} ), name => q{unallocated (ex 6bone)}, reference => q{RFC 3701} }, | ||
| 115 | { ip => Net::IP::XS->new( q{ff00::/8} ), name => q{IPv6 multicast addresses}, reference => q{RFC 4291} }, | ||
| 116 | ); | ||
| 117 | |||
| 118 | 1; | ||
| 119 | |||
| 120 | =head1 NAME | ||
| 121 | |||
| 122 | Zonemaster::Constants - module holding constants used in test modules | ||
| 123 | |||
| 124 | =head1 SYNOPSIS | ||
| 125 | |||
| 126 | use Zonemaster::Constants ':all'; | ||
| 127 | |||
| 128 | =head1 EXPORTED GROUPS | ||
| 129 | |||
| 130 | =over | ||
| 131 | |||
| 132 | =item all | ||
| 133 | |||
| 134 | All exportable names. | ||
| 135 | |||
| 136 | =item algo | ||
| 137 | |||
| 138 | DNSSEC algorithms. | ||
| 139 | |||
| 140 | =item asn | ||
| 141 | |||
| 142 | Constants used by the ASN test module. | ||
| 143 | |||
| 144 | =item name | ||
| 145 | |||
| 146 | Label and name lengths. | ||
| 147 | |||
| 148 | =item ip | ||
| 149 | |||
| 150 | IP version constants. | ||
| 151 | |||
| 152 | =item soa | ||
| 153 | |||
| 154 | SOA value limits. | ||
| 155 | |||
| 156 | =item misc | ||
| 157 | |||
| 158 | UDP payload limit and minimum number of nameservers per zone. | ||
| 159 | |||
| 160 | =item addresses | ||
| 161 | |||
| 162 | Address classes for IPv4 and IPv6. | ||
| 163 | |||
| 164 | =back | ||
| 165 | |||
| 166 | =head1 EXPORTED NAMES | ||
| 167 | |||
| 168 | =over | ||
| 169 | |||
| 170 | =item * | ||
| 171 | |||
| 172 | C<$ALGO_STATUS_DEPRECATED> | ||
| 173 | |||
| 174 | =item * | ||
| 175 | |||
| 176 | C<$ALGO_STATUS_PRIVATE> | ||
| 177 | |||
| 178 | =item * | ||
| 179 | |||
| 180 | C<$ALGO_STATUS_RESERVED> | ||
| 181 | |||
| 182 | =item * | ||
| 183 | |||
| 184 | C<$ALGO_STATUS_UNASSIGNED> | ||
| 185 | |||
| 186 | =item * | ||
| 187 | |||
| 188 | C<$ALGO_STATUS_VALID> | ||
| 189 | |||
| 190 | =item * | ||
| 191 | |||
| 192 | C<$ASN_CHECKING_ROUTE_VIEWS_SERVICE_NAME> | ||
| 193 | |||
| 194 | =item * | ||
| 195 | |||
| 196 | C<$ASN_CHECKING_SERVICE_USED> | ||
| 197 | |||
| 198 | =item * | ||
| 199 | |||
| 200 | C<$ASN_CHECKING_ZONEMASTER_SERVICE_NAME> | ||
| 201 | |||
| 202 | =item * | ||
| 203 | |||
| 204 | C<$ASN_IPV4_CHECKING_SERVICE_ROUTE_VIEWS_DOMAIN> | ||
| 205 | |||
| 206 | =item * | ||
| 207 | |||
| 208 | C<$ASN_IPV4_CHECKING_SERVICE_ZONEMASTER_DOMAIN> | ||
| 209 | |||
| 210 | =item * | ||
| 211 | |||
| 212 | C<$ASN_IPV6_CHECKING_SERVICE_ROUTE_VIEWS_DOMAIN> | ||
| 213 | |||
| 214 | =item * | ||
| 215 | |||
| 216 | C<$ASN_IPV6_CHECKING_SERVICE_ZONEMASTER_DOMAIN> | ||
| 217 | |||
| 218 | =item * | ||
| 219 | |||
| 220 | C<$ASN_UNASSIGNED_UNANNOUNCED_ADDRESS_SPACE_VALUE> | ||
| 221 | |||
| 222 | =item * | ||
| 223 | |||
| 224 | C<$DURATION_12_HOURS_IN_SECONDS> | ||
| 225 | |||
| 226 | =item * | ||
| 227 | |||
| 228 | C<$DURATION_180_DAYS_IN_SECONDS> | ||
| 229 | |||
| 230 | =item * | ||
| 231 | |||
| 232 | C<$FQDN_MAX_LENGTH> | ||
| 233 | |||
| 234 | =item * | ||
| 235 | |||
| 236 | C<$LABEL_MAX_LENGTH> | ||
| 237 | |||
| 238 | =item * | ||
| 239 | |||
| 240 | C<$IP_VERSION_4> | ||
| 241 | |||
| 242 | =item * | ||
| 243 | |||
| 244 | C<$IP_VERSION_6> | ||
| 245 | |||
| 246 | =item * | ||
| 247 | |||
| 248 | C<$MAX_SERIAL_VARIATION> | ||
| 249 | |||
| 250 | =item * | ||
| 251 | |||
| 252 | C<$MINIMUM_NUMBER_OF_NAMESERVERS> | ||
| 253 | |||
| 254 | =item * | ||
| 255 | |||
| 256 | C<$SOA_DEFAULT_TTL_MAXIMUM_VALUE> | ||
| 257 | |||
| 258 | =item * | ||
| 259 | |||
| 260 | C<$SOA_DEFAULT_TTL_MINIMUM_VALUE> | ||
| 261 | |||
| 262 | =item * | ||
| 263 | |||
| 264 | C<$SOA_EXPIRE_MINIMUM_VALUE> | ||
| 265 | |||
| 266 | =item * | ||
| 267 | |||
| 268 | C<$SOA_REFRESH_MINIMUM_VALUE> | ||
| 269 | |||
| 270 | =item * | ||
| 271 | |||
| 272 | C<$SOA_RETRY_MINIMUM_VALUE> | ||
| 273 | |||
| 274 | =item * | ||
| 275 | |||
| 276 | C<$UDP_PAYLOAD_LIMIT> | ||
| 277 | |||
| 278 | =item * | ||
| 279 | |||
| 280 | C<@IPV4_SPECIAL_ADDRESSES> | ||
| 281 | |||
| 282 | =item * | ||
| 283 | |||
| 284 | C<@IPV6_SPECIAL_ADDRESSES> | ||
| 285 | |||
| 286 | =back |