Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mauro Ezequiel Moltrasio <[email protected]>
  • Loading branch information
JoukoVirtanen and Molter73 committed Oct 25, 2024
1 parent dbed0a1 commit fd24fe8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration-tests/pkg/mock_sensor/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,11 @@ func (m *MockSensor) translateAddress(addr *sensorAPI.NetworkAddress) string {
}

ipNetwork := utils.IPNetworkFromCIDRBytes(ipNetworkData)
numBytes := len(ipNetworkData)
prefixLen := ipNetwork.PrefixLen()
// If this is IPv4 and the prefix length is 32 or this is IPv6 and the prefix length
// is 128 this is a regular IP address and not a CIDR block
if (numBytes == 5 && prefixLen == byte(32)) || (numBytes == 17 && prefixLen == byte(128)) {
if (ipNetwork.Family() == utils.IPv4 && prefixLen == byte(32)) ||
(ipNetwork.Family() == utils.IPv6 && prefixLen == byte(128)) {
peerId.Address = ipNetwork.IP()
} else {
peerId.IPNetwork = ipNetwork
Expand Down

0 comments on commit fd24fe8

Please sign in to comment.