1 /** 2 * @fileOverview Library for DNS operations such as looking up IP addresses and hostnames. 3 * These are similar to the PHP functions gethostbyname() and gethostbyaddr(). 4 */ 5 6 /** 7 * Converts a hostname string (such as "appjet.com") to an IP address, 8 * returned as a string (such as "74.86.117.106"). This function is the inverse 9 * of gethostbyaddr(). 10 * 11 * @param {string} hostname The DNS name to resolve (example: "www.appjet.com"). 12 * @return {string} the IP address corresponding to the given hostname, or undefined. 13 * 14 */ 15 function gethostbyname(hostname) { 16 return appjet._native.dns_gethostbyname(hostname); 17 } 18 19 /** 20 * Converts an IP address string (such as "74.86.117.106") to a hostname 21 * (such as "appjet.com"). This function is the inverse of gethostbyname(). 22 * 23 * @param {string} ipaddr The IP address to resolve (example: "74.86.117.106"). 24 * @return {string} the hostname corresponding to the given ip address, or undefined. 25 * 26 */ 27 function gethostbyaddr(ipaddr) { 28 return appjet._native.dns_gethostbyaddr(ipaddr); 29 } 30 31