See AdguardTeam/AdGuardHome#5557. Client.DialStamp uses Client.fetchCert, which has bad error handling. certErr is overwritten on every iteration of the loop over r.Answer and is never set at all if there are no answers or if none of the answers are TXT. That results in Client.fetchCert returning nil, nil, which leads to a panic in Client.DialStamp.
Client.fetchCert has a cyclomatic complexity of 14 and a cognitive complexity of 23 and needs refactoring.
See AdguardTeam/AdGuardHome#5557.
Client.DialStamp
usesClient.fetchCert
, which has bad error handling.certErr
is overwritten on every iteration of the loop overr.Answer
and is never set at all if there are no answers or if none of the answers are TXT. That results inClient.fetchCert
returningnil, nil
, which leads to a panic inClient.DialStamp
.Client.fetchCert
has a cyclomatic complexity of 14 and a cognitive complexity of 23 and needs refactoring.