11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst dnsPromises = require('dns').promises; 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_cidnsPromises.lookupService('127.0.0.1', 22).then(common.mustCall((result) => { 91cb0ef41Sopenharmony_ci assert(['ssh', '22'].includes(result.service)); 101cb0ef41Sopenharmony_ci assert.strictEqual(typeof result.hostname, 'string'); 111cb0ef41Sopenharmony_ci assert.notStrictEqual(result.hostname.length, 0); 121cb0ef41Sopenharmony_ci})); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ci// Use an IP from the RFC 5737 test range to cause an error. 151cb0ef41Sopenharmony_ci// Refs: https://tools.ietf.org/html/rfc5737 161cb0ef41Sopenharmony_ciassert.rejects( 171cb0ef41Sopenharmony_ci () => dnsPromises.lookupService('192.0.2.1', 22), 181cb0ef41Sopenharmony_ci { code: /^(?:ENOTFOUND|EAI_AGAIN)$/ } 191cb0ef41Sopenharmony_ci); 20