Module jls.net.dns

Provides DNS related functions.

Functions

dns.getAddressInfo (node[, callback]) Lookups address info for a specified hostname.
dns.getNameInfo (addr[, callback]) Lookups host name for a specified IP address.
dns.decodeMessage (data[, offset]) Decodes a multicast DNS message.
dns.encodeMessage (message) Encodes a multicast DNS message.


Functions

dns.getAddressInfo (node[, callback])
Lookups address info for a specified hostname. The result consists in a table with an "addr" field containing the IP address.

Parameters:

  • node string the hostname.
  • callback function an optional callback function to use in place of promise. (optional)

Returns:

    jls.lang.Promise a promise that resolves to the address informations.
dns.getNameInfo (addr[, callback])
Lookups host name for a specified IP address.

Parameters:

  • addr string the IP Address.
  • callback function an optional callback function to use in place of promise. (optional)

Returns:

    jls.lang.Promise a promise that resolves to the host name.
dns.decodeMessage (data[, offset])
Decodes a multicast DNS message.

Parameters:

  • data string the message as a string.
  • offset number the offset of the message in the data string, default to 1. (optional)

Returns:

    table the decoded message as a table, see the encode function.
dns.encodeMessage (message)
Encodes a multicast DNS message.

A question contains the fields: name, type, class, unicastResponse.

A resource record (RR) contains the fields: name, type, class, cacheFlush, ttl, data, value.

Parameters:

  • message the message as a table.
    • flags table the flags as a table or an integer. (optional)
    • id number the message id. (optional)
    • questions table the questions. (optional)
    • answers table the RR answers. (optional)
    • authorities table the RR authorities. (optional)
    • additionals table the RR additionals. (optional)

Returns:

    string the encoded message as a string.
generated by LDoc 1.4.6