use net.IP.Equal to compare net.IPs, not bytes.Equal
42 return false
43 }
44
45 return bytes.Equal(allowedIP, net.ParseIP(addr)) // Check if the user-provided IP is allowed.46}
47
48func dialSSH(user, password string, port int) (*ssh.Client, func(), error) {
Description
A net.IP stores an IPv4 or IPv6 address as a slice of bytes. The length of the slice for an IPv4 address, however, can be either 4 or 16 bytes long, using different ways of representing IPv4 addresses.
In order to correctly compare two net.IPs, the net.IP.Equal method should be used, as it takes both representations into account.