• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3// Utilities for internet-related tests
4
5const addresses = {
6  // A generic host that has registered common DNS records,
7  // supports both IPv4 and IPv6, and provides basic HTTP/HTTPS services
8  INET_HOST: 'nodejs.org',
9  // A host that provides IPv4 services
10  INET4_HOST: 'nodejs.org',
11  // A host that provides IPv6 services
12  INET6_HOST: 'nodejs.org',
13  // An accessible IPv4 IP,
14  // defaults to the Google Public DNS IPv4 address
15  INET4_IP: '8.8.8.8',
16  // An accessible IPv6 IP,
17  // defaults to the Google Public DNS IPv6 address
18  INET6_IP: '2001:4860:4860::8888',
19  // An invalid host that cannot be resolved
20  // See https://tools.ietf.org/html/rfc2606#section-2
21  INVALID_HOST: 'something.invalid',
22  // A host with MX records registered
23  MX_HOST: 'nodejs.org',
24  // On some systems, .invalid returns a server failure/try again rather than
25  // record not found. Use this to guarantee record not found.
26  NOT_FOUND: 'come.on.fhqwhgads.test',
27  // A host with SRV records registered
28  SRV_HOST: '_jabber._tcp.google.com',
29  // A host with PTR records registered
30  PTR_HOST: '8.8.8.8.in-addr.arpa',
31  // A host with NAPTR records registered
32  NAPTR_HOST: 'sip2sip.info',
33  // A host with SOA records registered
34  SOA_HOST: 'nodejs.org',
35  // A host with CAA record registred
36  CAA_HOST: 'google.com',
37  // A host with CNAME records registered
38  CNAME_HOST: 'blog.nodejs.org',
39  // A host with NS records registered
40  NS_HOST: 'nodejs.org',
41  // A host with TXT records registered
42  TXT_HOST: 'nodejs.org',
43  // An accessible IPv4 DNS server
44  DNS4_SERVER: '8.8.8.8',
45  // An accessible IPv4 DNS server
46  DNS6_SERVER: '2001:4860:4860::8888'
47};
48
49for (const key of Object.keys(addresses)) {
50  const envName = `NODE_TEST_${key}`;
51  if (process.env[envName]) {
52    addresses[key] = process.env[envName];
53  }
54}
55
56module.exports = {
57  addresses
58};
59