bugfix: 当预设IP配置为空数组或空对象时,返回空的IP列表的问题。

pull/325/head
王良 5 months ago
parent 2b10b2cea4
commit 447a1f86b6

@ -24,14 +24,17 @@ module.exports = class DNSOverHTTPS extends BaseDNS {
async _lookup (hostname) {
// 获取当前域名的预设IP列表
let hostnamePreSetIpList = matchUtil.matchHostname(this.preSetIpList, hostname, 'matched preSetIpList')
if (hostnamePreSetIpList) {
if (hostnamePreSetIpList && (hostnamePreSetIpList.length > 0 || hostnamePreSetIpList.length === undefined)) {
if (hostnamePreSetIpList.length > 0) {
hostnamePreSetIpList = hostnamePreSetIpList.slice()
} else {
hostnamePreSetIpList = mapToList(hostnamePreSetIpList)
}
hostnamePreSetIpList.isPreSet = true
return hostnamePreSetIpList
if (hostnamePreSetIpList.length > 0) {
hostnamePreSetIpList.isPreSet = true
return hostnamePreSetIpList
}
}
// 未预设当前域名的IP列表则从dns服务器获取

Loading…
Cancel
Save