Javascript DNS
(→Methods) |
|||
Line 7: | Line 7: | ||
Parameters:<br/> | Parameters:<br/> | ||
− | '''type''' Type of DNS Record to query<br/> | + | '''type''' Type of DNS Record to query (string). Values: SRV,NAPTR,A,AAAA,TXT.<br/> |
'''name''' Domain Name to query<br/> | '''name''' Domain Name to query<br/> | ||
'''async''' Optional non-blocking flag<br/> | '''async''' Optional non-blocking flag<br/> | ||
Line 29: | Line 29: | ||
** ttl | ** ttl | ||
If ''async'' is boolean true the execution context is unlocked during the DNS operation. | If ''async'' is boolean true the execution context is unlocked during the DNS operation. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Latest revision as of 07:52, 3 September 2024
DNS resolver global object.
[edit] Methods
- query(type,name,async)
Make a DNS query
Parameters:
type Type of DNS Record to query (string). Values: SRV,NAPTR,A,AAAA,TXT.
name Domain Name to query
async Optional non-blocking flag
Return:
Array of records of uniform type.
- For A, AAAA, TXT records are strings
- For NAPTR records are objects with fields:
- flags
- service
- regexp
- replacement
- name
- order
- priority
- ttl
- For SRV records are objects with fields:
- port
- name
- order
- priority
- ttl
If async is boolean true the execution context is unlocked during the DNS operation.
- resolve(name)
Resolves the name using the system routines. This returns at most one address and takes into account the hosts file.
- local(address)
Returns the local IP address that is used by default as route to remote address. Remote address can be specified by DNS name in which case it is resolved first.
- pack(address,separator)
Returns a hexadecimal string representing the packed representation of the IP address. Address can be specified by DNS name in which case it is resolved first.
Returns undefined on error.
Parameters:
address IP address to pack
separator Optional hexadecimal octets separator
- unpack(hexstr)
Returns the canonical text form of the packed IP adress provided.
Parameters:
hexstr Hexadecimal representation of the packed IP address, must be 4, 8 or 16 octets long. An 8 octets address is interpreted as a /64 IPv6 prefix.
Returns undefined on error.