42 lines
914 B
PHP
42 lines
914 B
PHP
<?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['id']=$id;
|
||
$send['query']=$query;
|
||
$return=json_encode($send);
|
||
return $return;
|
||
}
|
||
|
||
public function json(Request $request)
|
||
{
|
||
return json(['code' => 0, 'msg' => 'ok']);
|
||
}
|
||
|
||
} |