bugfix: 当预设IP配置为空数组或空对象时,返回空的IP列表的问题。
parent
2b10b2cea4
commit
447a1f86b6
|
@ -24,15 +24,18 @@ module.exports = class DNSOverHTTPS extends BaseDNS {
|
||||||
async _lookup (hostname) {
|
async _lookup (hostname) {
|
||||||
// 获取当前域名的预设IP列表
|
// 获取当前域名的预设IP列表
|
||||||
let hostnamePreSetIpList = matchUtil.matchHostname(this.preSetIpList, hostname, 'matched preSetIpList')
|
let hostnamePreSetIpList = matchUtil.matchHostname(this.preSetIpList, hostname, 'matched preSetIpList')
|
||||||
if (hostnamePreSetIpList) {
|
if (hostnamePreSetIpList && (hostnamePreSetIpList.length > 0 || hostnamePreSetIpList.length === undefined)) {
|
||||||
if (hostnamePreSetIpList.length > 0) {
|
if (hostnamePreSetIpList.length > 0) {
|
||||||
hostnamePreSetIpList = hostnamePreSetIpList.slice()
|
hostnamePreSetIpList = hostnamePreSetIpList.slice()
|
||||||
} else {
|
} else {
|
||||||
hostnamePreSetIpList = mapToList(hostnamePreSetIpList)
|
hostnamePreSetIpList = mapToList(hostnamePreSetIpList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hostnamePreSetIpList.length > 0) {
|
||||||
hostnamePreSetIpList.isPreSet = true
|
hostnamePreSetIpList.isPreSet = true
|
||||||
return hostnamePreSetIpList
|
return hostnamePreSetIpList
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 未预设当前域名的IP列表,则从dns服务器获取
|
// 未预设当前域名的IP列表,则从dns服务器获取
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue