예제 #1
0
파일: Executor.php 프로젝트: ThrusterIO/dns
 private function prepareRequest(Query $query)
 {
     $request = new Message();
     $request->header->set('id', $this->generateId());
     $request->header->set('rd', 1);
     $request->questions[] = $query;
     $request->prepare();
     return $request;
 }
예제 #2
0
 private function buildResponse(Query $query, array $cachedRecords) : Message
 {
     $response = new Message();
     $response->header->set('id', $this->generateId());
     $response->header->set('qr', 1);
     $response->header->set('opcode', Message::OPCODE_QUERY);
     $response->header->set('rd', 1);
     $response->header->set('rcode', Message::RCODE_OK);
     $response->questions[] = new Record($query->getName(), $query->getType(), $query->getClass());
     foreach ($cachedRecords as $record) {
         $response->answers[] = $record;
     }
     $response->prepare();
     return $response;
 }