aboutsummaryrefslogtreecommitdiff
path: root/lib/dns/testdata
AgeCommit message (Collapse)Author
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2025-01-17lib/dns: detect invalid header earlierShulhan
Previously, we unpack the header and then question without detecting whether the header itself is valid or not, for example the op-code, the response code. This cause the unpacking question return an error like label length overflow at index xxx One of the case is when someone sent random or HTTP request to DoT port.
2025-01-15lib/dns: fix unpacking resource data on HTTPS recordShulhan
Instead of passing the whole packet, pass the packet for unpacking target name only and rdata for unpacking the SVCB HTTPS record.
2024-04-12lib/dns: fix packing and unpacking OPT recordShulhan
The RDATA in OPT records can contains zero or _more_ options. Previously, we only handle unpacking and packing one option, now we handle multiple options.
2024-04-03lib/dns: fix unpacking ipv4hint on SVCB recordShulhan
Somehow the test passed on my main machine, but failed on my laptop. Weird.
2024-03-26lib/dns: implements RFC 9460 for SVCB RR and HTTPS RRShulhan
2023-08-06lib/dns: use Zone as single source of truth when parsingShulhan
Previously, the zoneParser store its own origin and TTL, which make it duplicates and confuse with the zone field that stored and returned by parser. To make things simple, use the zone field value as single source of truth for origin (using zone.Origin) and TTL (using zone.SOA.Minimum).
2023-08-06lib/dns: make sure that the zone Origin always end with periodShulhan
One of the property that we seems forget that the Origin actually must be absolute domain, end with period. If user does not know this, they may call NewZone or define $ORIGIN in zone file with relative domain.
2023-08-06lib/dns: add method AddAuthority to MessageShulhan
The AddAuthority add the rr to list of Authority. Calling this method mark the message as answer, instead of query. If the rr is SOA, it will replace the existing record if exist and set the flag authoritative answer (IsAA) in header to true. If the rr is NS, it will be added only if its not exist. It will return an error if the rr type is not SOA or NS or the size of records in Authority is full, maximum four records.
2023-08-05lib/dns: update the SOA Serial when record added or removed from ZoneShulhan
Any call to Zone Add or Remove methods will update the Zone.SOA.Serial to current epoch.
2023-08-05lib/dns: always initialize the Zone SOA record to default valuesShulhan
Previously, if we parse, create, or remove the SOA record from zone, we assume the SOA records are valid and not touch their values. In this changes, we set the SOA fields to default values if its not set, to make the SOA record consistent and valid, in perspective of client. This changes also export the default OS values for documentation and add new method NewRDataSOA to simplify creating new SOA record.
2023-05-18lib/dns: fix zone parsing on SOA record with single lineShulhan
Due to refactoring in c376eccd25, parsing SOA record with single line return an error: "parseSOA: line 2: incomplete SOA statement '0'".
2023-04-04lib/bytes: changes the DumpPrettyTable output formatShulhan
The change is to accommodate large bytes data, more than 0xFFFF. The hex address in the first column is increased to 8 digits, the characters compacted without space in between.
2023-03-26lib/dns: fix packing, parsing, and saving MINFO resource dataShulhan
Even thought the MINFO record not formally obsolete, according to Wikipedia [1], we still need to support this for backward compatibility. When packing the resource data length does not include total length. When parsing, the RMailBox and EmailBox should be added the origin suffix if its not end with dot. When saving, the origin should be trimmed from RMailBox and EmailBox. [1] https://en.wikipedia.org/wiki/List_of_DNS_record_types#Obsolete_record_types
2023-03-26lib/dns: fix packing and unpacking resource record HINFOShulhan
The rdata for HINFO contains two character-strings: CPU and OS. Previously, we pack the rdata section sequentially, without adding length on each of them: <RDLEN><CPU><OS>. The correct pack format should <RDLEN><LENGTH><CPU><LENGTH><OS>.
2023-03-25lib/dns: fix parsing SRV record from zone fileShulhan
Previous parseSRV start by parsing the _Service from tok, but the actual value of parameter tok is the Priority. This changes fix this and as testing we use the example from RFC 2782.
2023-03-25lib/dns: allow parsing TXT rdata without quote in zone fileShulhan
Previously, the zone only parsing TXT record with double quote since most of the example that we found during implementation all use double quote. This changes allow non-double quoted text in zone file with consequence that any spaces will terminated the rdata immediately. Fixes #6
2023-03-23lib/dns: handle zone file with CRLF line endingShulhan
While at it, fix parsing multiline SOA record where closing parentheses end on next lines. Fixes #6
2023-03-23lib/dns: add function ParseZoneShulhan
The ParseZone parse the content of zone from raw bytes. Now that we have ParseZone, all tests that use zoneParser now can be replaced using combination of test.Data and ParseZone.
2019-05-17dns: add function to lookup PTR record by IP addressShulhan
The function LookupPTR accept any IP address (either IPv4 or IPv6) and return a single domain name on success or an error on failed. If IP address does not have PTR record it will return empty string without error.
2019-04-12dns: refactor server to use cachesShulhan
Previously, we use a handler for server, like server in HTTP library, to serve query from client based on request. The idea was to make server more generic which allow custom cache or request handling. This is make sense if DNS response is dynamic, but in real world it is not. DNS record actually static, either loaded from file (hosts or zone file) or from response by recursive server. This commit remove the server Handler and make all request to be handled automatically based on whether the query exist on cache or not.
2019-02-07dns: add function to get list of system name serversShulhan
2018-09-25lib/dns: implement client and server for DNS over HTTPSShulhan
The implementation is based on latest draft [1]. [1] https://tools.ietf.org/html/draft-ietf-doh-dns-over-https-14
2018-09-03lib/dns: implement parsing master files (RFC1035 section 5)Shulhan
Master files are text files that contain RRs in text form. Since the contents of a zone can be expressed in the form of a list of RRs a master file is most often used to define a zone, though it can be used to list a cache's contents.
2018-08-29lib/dns: HostsLoad: simplify parsing with lib/readerShulhan
2018-08-26lib/dns: fix loading hosts fileShulhan
2018-08-21lib/dns: add function to parse hosts formatted file into DNS messagesShulhan