芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/joolsmen.com/chat/vendor/react/dns/src/Model/Message.php
id = self::generateId(); $request->rd = true; $request->questions[] = $query; return $request; } /** * Creates a new response message for the given query with the given answer records * * @param Query $query * @param Record[] $answers * @return self */ public static function createResponseWithAnswersForQuery(Query $query, array $answers) { $response = new Message(); $response->id = self::generateId(); $response->qr = true; $response->rd = true; $response->questions[] = $query; foreach ($answers as $record) { $response->answers[] = $record; } return $response; } /** * generates a random 16 bit message ID * * This uses a CSPRNG so that an outside attacker that is sending spoofed * DNS response messages can not guess the message ID to avoid possible * cache poisoning attacks. * * The `random_int()` function is only available on PHP 7+ or when * https://github.com/paragonie/random_compat is installed. As such, using * the latest supported PHP version is highly recommended. This currently * falls back to a less secure random number generator on older PHP versions * in the hope that this system is properly protected against outside * attackers, for example by using one of the common local DNS proxy stubs. * * @return int * @see self::getId() * @codeCoverageIgnore */ private static function generateId() { if (function_exists('random_int')) { return random_int(0, 0xffff); } return mt_rand(0, 0xffff); } /** * The 16 bit message ID * * The response message ID has to match the request message ID. This allows * the receiver to verify this is the correct response message. An outside * attacker may try to inject fake responses by "guessing" the message ID, * so this should use a proper CSPRNG to avoid possible cache poisoning. * * @var int 16 bit message ID * @see self::generateId() */ public $id = 0; /** * @var bool Query/Response flag, query=false or response=true */ public $qr = false; /** * @var int specifies the kind of query (4 bit), see self::OPCODE_* constants * @see self::OPCODE_QUERY */ public $opcode = self::OPCODE_QUERY; /** * * @var bool Authoritative Answer */ public $aa = false; /** * @var bool TrunCation */ public $tc = false; /** * @var bool Recursion Desired */ public $rd = false; /** * @var bool Recursion Available */ public $ra = false; /** * @var int response code (4 bit), see self::RCODE_* constants * @see self::RCODE_OK */ public $rcode = Message::RCODE_OK; /** * An array of Query objects * * ```php * $questions = array( * new Query( * 'reactphp.org', * Message::TYPE_A, * Message::CLASS_IN * ) * ); * ``` * * @var Query[] */ public $questions = array(); /** * @var Record[] */ public $answers = array(); /** * @var Record[] */ public $authority = array(); /** * @var Record[] */ public $additional = array(); }