Module dns
Resource record type: A.
Functions
| query (qname[, opts]) | Resolve a DNS name. |
| type_name (n) | Convert RR type number to its mnemonic. |
Fields
| TYPE_CNAME | Resource record type: CNAME. |
| TYPE_SOA | Resource record type: SOA. |
| TYPE_PTR | Resource record type: PTR. |
| TYPE_MX | Resource record type: MX. |
| TYPE_TXT | Resource record type: TXT. |
| TYPE_AAAA | Resource record type: AAAA. |
| TYPE_SRV | Resource record type: SRV. |
| TYPE_SPF | Resource record type: SPF. |
| CLASS_IN | DNS class: IN (Internet). |
| SECTION_AN | DNS answer section: Answer. |
| SECTION_NS | DNS answer section: Authority. |
| SECTION_AR | DNS answer section: Additional. |
Functions
- query (qname[, opts])
-
Resolve a DNS name.
The return value is an array of answer records. Record table fields depend on the record type. Common fields:
name, type,class,ttl,section
Type-specific fields include:
A/AAAA:addressCNAME:cnameMX:preference,exchangeSRV:priority,weight,port,targetNS:nsdnameTXT:txt(string or array of strings)SPF:spf(string or array of strings)PTR:ptrdnameSOA:mname,rname,serial,refresh,retry,expire,minimum
Parameters:
- qname string Domain name or IP address.
- opts
table
Options:
- type (int) RR type (default ???).
no_recurse(boolean) Disable recursion desired (RD) flag.nameservers(table) Nameserver list. Each entry can be:"ip"string{ ip, port }tablemark(number) SO_MARK for the UDP socket.device(string) SO_BINDTODEVICE for the UDP socket.
Returns:
-
table
answers
Or
- nil On failure.
- string Error message.
- type_name (n)
-
Convert RR type number to its mnemonic.
Parameters:
- n integer RR type number.
Returns:
Fields
- TYPE_CNAME
- Resource record type: CNAME.
- TYPE_SOA
- Resource record type: SOA.
- TYPE_PTR
- Resource record type: PTR.
- TYPE_MX
- Resource record type: MX.
- TYPE_TXT
- Resource record type: TXT.
- TYPE_AAAA
- Resource record type: AAAA.
- TYPE_SRV
- Resource record type: SRV.
- TYPE_SPF
- Resource record type: SPF.
- CLASS_IN
- DNS class: IN (Internet).
- SECTION_AN
- DNS answer section: Answer.
- SECTION_NS
- DNS answer section: Authority.
- SECTION_AR
- DNS answer section: Additional.