yswery/PHP-DNS-SERVER

Question regarding DNS question

Closed this issue · 3 comments

@yswery please take a look at:

https://github.com/yswery/PHP-DNS-SERVER/blob/master/src/JsonResolver.php:61

    /**
     * @param array $question
     * @return array
     */
    public function getAnswer(array $question)
    {
        $q_name = $question[0]['qname'];
        $q_type = $question[0]['qtype'];
        $q_class = $question[0]['qclass'];
        $domain = trim($q_name, '.');
        $type = RecordTypeEnum::get_name($q_type);

I don't understand why are we sending array of questions to the resolver->getAnswer() instead of just one question? We are always catching the first array element and resolving that as a question. Is it perhaps possible that user can ask for multiple queries and get the answers within a single request?

Had to Google this one. Apparently, even though RFC1035 does support multiple questions, it doesn't get implemented. https://stackoverflow.com/questions/4082081/requesting-a-and-aaaa-records-in-single-dns-query/4083071#4083071

Having said that, it does depend on the resolver that you want to strap-in. If you want to answer multiple queries, do DNS clients support that functionality? When I do an NSLOOKUP for a domain, Windows by default will send two queries in two packets, the first is for an A record and the second is for an AAAA record., so I don't think there are many clients (if any) that have implemented RFC1035 word-for-word

This has been addressed in branch version-1