更新Swagger API

This commit is contained in:
Alex Yang
2025-12-26 09:27:39 +08:00
parent d388fefdcc
commit 43f0133886
2 changed files with 79 additions and 84 deletions

View File

@@ -19,6 +19,8 @@
- 修复查询日志详情接口返回的日志中解析记录中缺少IP地址、类型、DNSSEC验证状态等信息的问题 - 修复查询日志详情接口返回的日志中解析记录中缺少IP地址、类型、DNSSEC验证状态等信息的问题
- web界面系统设置加载后不获取数据和保存配置不生效的问题 - web界面系统设置加载后不获取数据和保存配置不生效的问题
- 修复了DNS查询超时设置过短导致的"Server failed"错误。 - 修复了DNS查询超时设置过短导致的"Server failed"错误。
### 更新
- 更新Swagger API文档。
### 下一版本改进 ### 下一版本改进
- 增加了对DNSSEC的支持配置项默认关闭 - 增加了对DNSSEC的支持配置项默认关闭

View File

@@ -4,7 +4,7 @@
"info": { "info": {
"title": "DNS Server API", "title": "DNS Server API",
"description": "DNS服务器完整API文档包括统计信息、Shield管理、主机管理等功能。", "description": "DNS服务器完整API文档包括统计信息、Shield管理、主机管理等功能。",
"version": "1.1.0", "version": "1.2.5",
"contact": { "contact": {
"name": "DNS Server 支持", "name": "DNS Server 支持",
"email": "support@dnsserver.com" "email": "support@dnsserver.com"
@@ -713,6 +713,7 @@
"get": { "get": {
"summary": "获取Shield配置和统计信息", "summary": "获取Shield配置和统计信息",
"description": "获取Shield的配置信息和规则统计包括更新间隔、屏蔽方法、黑名单数量等。", "description": "获取Shield的配置信息和规则统计包括更新间隔、屏蔽方法、黑名单数量等。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"responses": { "responses": {
"200": { "200": {
@@ -764,6 +765,7 @@
"post": { "post": {
"summary": "添加屏蔽规则", "summary": "添加屏蔽规则",
"description": "添加新的屏蔽规则到Shield。", "description": "添加新的屏蔽规则到Shield。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"requestBody": { "requestBody": {
"required": true, "required": true,
@@ -829,6 +831,7 @@
"delete": { "delete": {
"summary": "删除屏蔽规则", "summary": "删除屏蔽规则",
"description": "从Shield中删除指定的屏蔽规则。", "description": "从Shield中删除指定的屏蔽规则。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"requestBody": { "requestBody": {
"required": true, "required": true,
@@ -894,6 +897,7 @@
"put": { "put": {
"summary": "重新加载规则", "summary": "重新加载规则",
"description": "重新加载和应用Shield规则。", "description": "重新加载和应用Shield规则。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"responses": { "responses": {
"200": { "200": {
@@ -934,7 +938,8 @@
"/shield/blacklists": { "/shield/blacklists": {
"get": { "get": {
"summary": "获取黑名单列表", "summary": "获取黑名单列表",
"description": "获取所有远程黑名单列表及详细信息。", "description": "获取Shield的黑名单列表,包括内置黑名单和自定义黑名单。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"responses": { "responses": {
"200": { "200": {
@@ -986,7 +991,8 @@
}, },
"post": { "post": {
"summary": "添加黑名单", "summary": "添加黑名单",
"description": "添加新的远程黑名单URL。", "description": "添加新的黑名单URL到Shield。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"requestBody": { "requestBody": {
"required": true, "required": true,
@@ -1057,6 +1063,7 @@
"put": { "put": {
"summary": "更新黑名单列表(包括启用/禁用状态)", "summary": "更新黑名单列表(包括启用/禁用状态)",
"description": "更新黑名单列表(包括启用/禁用状态)。", "description": "更新黑名单列表(包括启用/禁用状态)。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"requestBody": { "requestBody": {
"required": true, "required": true,
@@ -1139,7 +1146,8 @@
"/shield/localrules": { "/shield/localrules": {
"get": { "get": {
"summary": "获取自定义规则", "summary": "获取自定义规则",
"description": "获取Shield的自定义规则列表。" "description": "获取Shield的自定义规则列表。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"responses": { "responses": {
"200": { "200": {
@@ -1168,6 +1176,7 @@
"post": { "post": {
"summary": "添加自定义规则", "summary": "添加自定义规则",
"description": "添加新的自定义规则。", "description": "添加新的自定义规则。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"requestBody": { "requestBody": {
"required": true, "required": true,
@@ -1206,7 +1215,8 @@
}, },
"delete": { "delete": {
"summary": "删除自定义规则", "summary": "删除自定义规则",
"description": "删除指定ID的自定义规则。", "description": "删除指定的自定义规则。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"parameters": [ "parameters": [
{ {
@@ -1239,8 +1249,9 @@
}, },
"/shield/remoterules": { "/shield/remoterules": {
"get": { "get": {
"summary": "获取远程规则", "summary": "获取远程规则状态",
"description": "获取Shield的远程规则列表。", "description": "获取远程规则的更新状态和版本信息。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"responses": { "responses": {
"200": { "200": {
@@ -1269,8 +1280,9 @@
}, },
"/shield/hosts": { "/shield/hosts": {
"get": { "get": {
"summary": "获取hosts列表", "summary": "获取hosts内容",
"description": "获取所有hosts记录。", "description": "获取当前的hosts文件内容。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"responses": { "responses": {
"200": { "200": {
@@ -1298,6 +1310,7 @@
"post": { "post": {
"summary": "添加hosts记录", "summary": "添加hosts记录",
"description": "添加新的hosts记录。", "description": "添加新的hosts记录。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"requestBody": { "requestBody": {
"required": true, "required": true,
@@ -1366,6 +1379,7 @@
"delete": { "delete": {
"summary": "删除hosts记录", "summary": "删除hosts记录",
"description": "删除指定域名的hosts记录。", "description": "删除指定域名的hosts记录。",
"deprecated": false,
"tags": ["shield"], "tags": ["shield"],
"parameters": [ "parameters": [
{ {
@@ -1424,90 +1438,69 @@
} }
} }
}, },
"/query": { "/dns/query": {
"get": { "post": {
"summary": "检查域名是否被屏蔽", "summary": "查询DNS记录",
"description": "查指定域名是否被Shield屏蔽并返回详细的屏蔽信息包括屏蔽规则、规则类型、来源等。", "description": "查指定域名的DNS记录可以指定记录类型。",
"tags": ["shield"], "tags": ["dns"],
"parameters": [ "requestBody": {
{ "required": true,
"name": "domain", "content": {
"in": "query", "application/json": {
"required": true, "schema": {
"schema": { "type": "object",
"type": "string" "properties": {
}, "domain": {
"description": "要检查的域名" "type": "string",
"description": "要查询的域名"
},
"recordType": {
"type": "string",
"description": "DNS记录类型如A、AAAA、MX、NS等"
}
},
"required": ["domain"]
},
"example": {
"domain": "example.com",
"recordType": "A"
}
}
} }
], },
"responses": { "responses": {
"200": { "200": {
"description": "成功获取域名屏蔽信息", "description": "成功获取DNS记录",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object", "type": "array",
"properties": { "items": {
"domain": { "type": "object",
"type": "string", "properties": {
"description": "检查的域名" "Type": {
}, "type": "string",
"blocked": { "description": "DNS记录类型"
"type": "boolean", },
"description": "是否被屏蔽" "Value": {
}, "type": "string",
"blockRule": { "description": "DNS记录值"
"type": "string", },
"description": "屏蔽规则" "TTL": {
}, "type": "integer",
"blockRuleType": { "description": "生存时间"
"type": "string", },
"description": "屏蔽规则类型" "Preference": {
}, "type": "integer",
"blocksource": { "description": "MX记录优先级"
"type": "string", }
"description": "屏蔽规则来源"
},
"excluded": {
"type": "boolean",
"description": "是否被排除"
},
"excludeRule": {
"type": "string",
"description": "排除规则"
},
"excludeRuleType": {
"type": "string",
"description": "排除规则类型"
},
"hasHosts": {
"type": "boolean",
"description": "是否有hosts记录"
},
"hostsIP": {
"type": "string",
"description": "hosts记录中的IP"
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "查询时间戳"
} }
} }
}, },
"example": { "example": [
"domain": "example.com", {"Type": "A", "Value": "93.184.216.34", "TTL": 172800},
"blocked": true, {"Type": "A", "Value": "93.184.216.35", "TTL": 172800}
"blockRule": "example.com", ]
"blockRuleType": "exact_domain",
"blocksource": "自定义规则",
"excluded": false,
"excludeRule": "",
"excludeRuleType": "",
"hasHosts": false,
"hostsIP": "",
"timestamp": "2023-07-15T14:30:45Z"
}
} }
} }
}, },