Code Monkey home page Code Monkey logo

dnsmgr's People

Contributors

netcccyun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dnsmgr's Issues

TCP探测端口大于128时异常

image
image
image

[2024-04-22T10:41:10+08:00][error] [10501]SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'tcpport' at row 1[/var/www/html/vendor/topthink/think-orm/src/db/PDOConnection.php:797]

二级解析

现在是给用户整个域名的解析权限,建议能单独给用户分配二级域名的解析权限,qwq,感谢大佬

HTTP/HTTPS检测没有绑定待探测IP发起请求

image
image
如图所示,如果检测URL地址是一个域名,则会直接解析这个域名去探测,不符合一般HTTP探测逻辑,正确探测逻辑应该是,绑定待探测IP去请求检测URL地址才对。

可以参考curl中的--resolve,比如入参url是https://test.example.com/test,解析记录是1.1.1.1,应该向1.1.1.1发起请求,请求host和sni是test.example.com
curl https://test.example.com/test --resolve test.example.com:443:1.1.1.1

提一点使用建议

可以多增加一点平台支持;页面可以美化一下(比如直接在设置里可以修改背景等,不用去修改源码)

一点小小的建议

首先,感谢彩虹大佬的最新作品,你做了我一直以来想做而又未作的事。

另外我有一些小小的建议,如下:

  1. 域名添加的时候建议可以批量添加,不然域名比较多的情况下,每次一个一个添加,效率会比较低
  2. 已经添加的域名,在下拉选择域名的时候不再显示出来,避免域名较多的时候重复选择到一个域名,提示已经添加过了。

是否可以支持优选IP

目前很多建站用户使用CloudFlare CloudFront Gcore等cdn
默认分配的IP国内访问不佳,希望站长能支持获取优选IP并自动化更新到解析中。

支持cf优选的平台有
https://stock.hostmonit.com/CloudFlareYes
接口是
https://api.hostmonit.com/get_optimization_ip
需要post提交{"key": KEY, "type": TYPE}
项目地址github.com/ddgth/cf2dns

https://monitor.gacjie.cn/
接口是https://monitor.gacjie.cn/api/client/get_ip_address
需要post/get提交{"key": config["key"], "type":iptype, "cdn_server": config["cdn_server"]}
项目地址github.com/gacjie/cf2dns

探测页面500异常

#0 [8192]ErrorException in Dmonitor.php line 19
strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated

class Dmonitor extends BaseController
{
    public function overview()
    {
        if(!checkPermission(2)) return $this->alert('error', '无权限');
        $switch_count = Db::name('dmlog')->where('date', '>=', date("Y-m-d H:i:s",strtotime("-1 days")))->count();
        $fail_count = Db::name('dmlog')->where('date', '>=', date("Y-m-d H:i:s",strtotime("-1 days")))->where('action', 1)->count();

        $run_state = config_get('run_time', null, true) ? (time()-strtotime(config_get('run_time')) > 10 ? 0 : 1) : 0;
        View::assign('info', [
            'run_count' => config_get('run_count', null, true) ?? 0,
            'run_time' => config_get('run_time', null, true) ?? '无',
            'run_state' => $run_state,
            'run_error' => config_get('run_error', null, true),
            'switch_count' => $switch_count,
            'fail_count' => $fail_count,
            'swoole' => extension_loaded('swoole') ? '<font color="green">已安装</font>' : '<font color="red">未安装</font>',
        ]);
Call Stack (折叠)
in Dmonitor.php line 19
at Error->appError()
at strtotime() in Dmonitor.php line 19
at Dmonitor->overview()
at ReflectionMethod->invokeArgs() in Container.php line 344
at Container->invokeReflectMethod() in Controller.php line 110
at Controller->think\route\dispatch\{closure}() in Pipeline.php line 59
at Pipeline->think\{closure}() in Pipeline.php line 66
at Pipeline->then() in Controller.php line 84
at Controller->exec() in Dispatch.php line 80
at Dispatch->run() in Route.php line 793
at Route->think\{closure}() in Pipeline.php line 59
at Pipeline->think\{closure}() in ViewOutput.php line 23
at ViewOutput->handle()
at call_user_func() in Middleware.php line 142
at Middleware->think\{closure}() in Pipeline.php line 85
at Pipeline->think\{closure}() in CheckLogin.php line 17
at CheckLogin->handle()
at call_user_func() in Middleware.php line 142
at Middleware->think\{closure}() in Pipeline.php line 85
at Pipeline->think\{closure}() in Pipeline.php line 66
at Pipeline->then() in Route.php line 792
at Route->dispatch() in Http.php line 216
at Http->dispatchToRoute() in Http.php line 206
at Http->think\{closure}() in Pipeline.php line 59
at Pipeline->think\{closure}() in AuthUser.php line 50
at AuthUser->handle()
at call_user_func() in Middleware.php line 142
at Middleware->think\{closure}() in Pipeline.php line 85
at Pipeline->think\{closure}() in LoadConfig.php line 43
at LoadConfig->handle()
at call_user_func() in Middleware.php line 142
at Middleware->think\{closure}() in Pipeline.php line 85
at Pipeline->think\{closure}() in Pipeline.php line 66
at Pipeline->then() in Http.php line 205
at Http->runWithRequest() in Http.php line 170
at Http->run() in index.php line 24

可以在使用strtotime()之前先检查config_get('run_time')函数是否返回一个非空值。改动比较小,就不发pr了

        $run_time = config_get('run_time', null, true);
        $run_state = $run_time ? (time()-strtotime($run_time) > 10 ? 0 : 1) : 0;

希望实现容灾切换兜底策略

image

目前在识别到IP不可用后有三个可能的操作,其中暂停解析主要是用于当某个IP不可用时剔除IP,其他IP继续服务的场景,但极端情况(可能是配置错误或探测端自身网络问题等)下可能会出现所有IP都被剔除,导致域名无法解析。因此希望增加兜底策略,以下是一些建议的兜底策略:

基础实现:

  1. 在识别到本记录是最后一个启用的解析记录,且该记录探测出现异常时,本次不执行暂停解析操作
  2. 在识别到本记录是最后一个启用的解析记录,且该记录探测出现异常时,强制启用所有暂停的同名解析记录
  3. 在识别到本记录是最后一个启用的解析记录,且该记录探测出现异常时,切换备用解析

进阶实现:
可以考虑采用引入异常比例阈值,比如有5个同名解析记录,异常比例设置为40%,如果异常解析记录大于40%(也就是3个故障)时,第3个开始不再暂停解析,或者大于40%时整体切换到备用解析。不过这个要实现可能需要重构一下探测任务的逻辑了,现在探测任务是以单个解析记录为单位做的,如果要实现比例可能要把探测任务的实现粒度改为域名粒度,单个探测任务同时对该域名下的所有A记录、AAAA记录、CNAME记录做探测。

以上是我的一些建议,仅供参考。

切换备用解析异常

切换备用解析记录 :异常原因Connection refused

恢复主解析记录就没问题,手动解析记录也没问题,就是自动切换备用无法正常解析

大佬求解答,特别感谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.