handle dns.PackMessage error

this will fix #2599
This commit is contained in:
DuckSoft
2020-06-25 16:22:56 +08:00
committed by Shelikhoo
parent dd106b7cda
commit 780318c5c8
+5 -1
View File
@@ -246,7 +246,11 @@ func (s *DoHNameServer) sendQuery(ctx context.Context, domain string, option IPO
dnsCtx, cancel := context.WithDeadline(dnsCtx, deadline)
defer cancel()
b, _ := dns.PackMessage(r.msg)
b, err := dns.PackMessage(r.msg)
if err != nil {
newError("failed to pack dns query").Base(err).AtError().WriteToLog()
return
}
resp, err := s.dohHTTPSContext(dnsCtx, b.Bytes())
if err != nil {
newError("failed to retrieve response").Base(err).AtError().WriteToLog()