Skip to content

Commit

Permalink
Minor linting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atomirex committed Dec 21, 2024
1 parent eb0b0f9 commit e55ee40
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")
}
}

Expand Down

0 comments on commit e55ee40

Please sign in to comment.