HighSpeaker/.history/app/controller/DnsController_20221217223504.php

56 lines
1.3 KiB
PHP
Raw Normal View History

2022-12-18 18:14:03 +08:00
<?php
namespace app\controller;
class DnsController
{
public function PTR($type,$name,$rip,$id,$query)
{
#输出信息
#echo "\n Type:$type \n Domain: $name\n Client IP: $rip \n";
#此处请根据业务需要,通过判断$name和$rip返回正确的数据
$send['detail']='dns.laysense.com';
$send['ttl']=30;
#以下无需更改
$send['type']='PTR';
$send['id']=$id;
$send['query']=$query;
$return=json_encode($send);
return $return;
}
#后续以此类推function名为DNS查询类型
public function A($type,$name,$rip,$id,$query)
{
$send['detail'][1]='119.29.29.29';
$send['detail'][2]='8.8.8.8';
$send['ttl']=30;
$send['type']='A';
$send['id']=$id;
$send['query']=$query;
$return=json_encode($send);
return $return;
}
public function AAAA($type,$name,$rip,$id,$query)
{
$send['type']='A';
$send['detail'][1]='119.29.29.29';
$send['detail'][2]='8.8.8.8';
$send['ttl']=30;
$send['type']='AAAA';
$send['id']=$id;
$send['query']=$query;
$return=json_encode($send);
return $return;
}
}