godnslog icon indicating copy to clipboard operation
godnslog copied to clipboard

API 返回结果数量和排序问题

Open Phuker opened this issue 3 years ago • 0 comments

API 固定最多输出 DefaultQueryApiMaxItem 20 条结果,且结果为正序排列(老的在前,新的在后),导致数据总量超过 20 条时,除非老数据被自动清除,否则永远也看不到最新记录。

复现方法

生成测试数据:

for (( i=1; i<=100; i=i+1 )); do dig "test${i}.qwerty123456.example.com"; sleep 0.1; done

调用 API 搜索 test,响应无法看到最新数据:

{"message":"OK","code":0,"timestemp":1643031077,"result":[{"domain":"test1.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:33Z"},{"domain":"test2.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:34Z"},{"domain":"test3.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:34Z"},{"domain":"test4.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:34Z"},{"domain":"test5.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:34Z"},{"domain":"test6.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:34Z"},{"domain":"test7.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:34Z"},{"domain":"test8.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:34Z"},{"domain":"test9.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:34Z"},{"domain":"test10.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:35Z"},{"domain":"test11.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:35Z"},{"domain":"test12.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:35Z"},{"domain":"test13.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:35Z"},{"domain":"test14.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:35Z"},{"domain":"test15.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:35Z"},{"domain":"test16.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:35Z"},{"domain":"test17.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:35Z"},{"domain":"test18.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:36Z"},{"domain":"test19.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:36Z"},{"domain":"test20.qwerty123456.example.com","addr":"10.0.0.2","ctime":"2022-01-24T12:52:36Z"}]}

这个 API 目前只能用于针对性地判断特定记录是否存在,无法批量导出数据。

建议:API 响应结果倒序排列;另外建议增加返回结果数量参数,固定 20 条太少了,大批量扫描时容易错过部分记录

注:我使用的是 0.7.0 版本

Phuker avatar Jan 24 '22 13:01 Phuker