diff --git a/conn.go b/conn.go index 674044e..b8ea76a 100644 --- a/conn.go +++ b/conn.go @@ -1159,6 +1159,7 @@ func (c *Conn) start(started chan<- struct{}, inboundBufferSize int, config *Con } } +//nolint:gocognit func addrFromAnswerHeader(answer dnsmessage.Resource) (*netip.Addr, error) { switch answer.Header.Type { case dnsmessage.TypeA: @@ -1167,18 +1168,18 @@ func addrFromAnswerHeader(answer dnsmessage.Resource) (*netip.Addr, error) { if ok { addr = addr.Unmap() // do not want 4-in-6 return &addr, nil - } else { - return nil, fmt.Errorf("failed to create netip.Addr from TypeA resource") } + + return nil, fmt.Errorf("failed to create netip.Addr from TypeA resource") } case dnsmessage.TypeAAAA: if a, ok := answer.Body.(*dnsmessage.AAAAResource); ok { addr, ok := netip.AddrFromSlice(a.AAAA[:]) if ok { return &addr, nil - } else { - return nil, fmt.Errorf("failed to create netip.Addr from TypeAAAA resource") } + + return nil, fmt.Errorf("failed to create netip.Addr from TypeAAAA resource") } }