mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
Fix: dns msg to ip
This commit is contained in:
parent
6f1bc3d65b
commit
fcb1a7813a
|
@ -174,20 +174,12 @@ func (r *Resolver) msgToIP(msg *D.Msg) ([]net.IP, error) {
|
|||
var ips []net.IP
|
||||
|
||||
for _, answer := range msg.Answer {
|
||||
if r.ipv6 {
|
||||
ans, ok := answer.(*D.AAAA)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
switch ans := answer.(type) {
|
||||
case *D.AAAA:
|
||||
ips = append(ips, ans.AAAA)
|
||||
continue
|
||||
case *D.A:
|
||||
ips = append(ips, ans.A)
|
||||
}
|
||||
|
||||
ans, ok := answer.(*D.A)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
ips = append(ips, ans.A)
|
||||
}
|
||||
|
||||
if len(ips) == 0 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user