1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-16 09:26:21 -05:00

Fix: FakeDNS prints error with empty config (#955)

This commit is contained in:
Loyalsoldier 2021-05-01 21:44:12 +08:00 committed by GitHub
parent b68411f460
commit 0d4479a72a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,8 +43,11 @@ func (*Holder) Type() interface{} {
} }
func (fkdns *Holder) Start() error { func (fkdns *Holder) Start() error {
if fkdns.config != nil && fkdns.config.IpPool != "" && fkdns.config.LruSize != 0 {
return fkdns.initializeFromConfig() return fkdns.initializeFromConfig()
} }
return nil
}
func (fkdns *Holder) Close() error { func (fkdns *Holder) Close() error {
fkdns.domainToIP = nil fkdns.domainToIP = nil
@ -184,11 +187,12 @@ func (h *HolderMulti) Type() interface{} {
func (h *HolderMulti) Start() error { func (h *HolderMulti) Start() error {
for _, v := range h.holders { for _, v := range h.holders {
err := v.Start() if v.config != nil && v.config.IpPool != "" && v.config.LruSize != 0 {
if err != nil { if err := v.Start(); err != nil {
return newError("Cannot start all fake dns pools").Base(err) return newError("Cannot start all fake dns pools").Base(err)
} }
} }
}
return nil return nil
} }