in pkg/policyendpoints/manager.go [245:263]
func (m *policyEndpointsManager) getEndpointInfoKey(info policyinfo.EndpointInfo) string {
hasher := sha256.New()
hasher.Write([]byte(info.CIDR))
for _, except := range info.Except {
hasher.Write([]byte(except))
}
for _, port := range info.Ports {
if port.Protocol != nil {
hasher.Write([]byte(*port.Protocol))
}
if port.Port != nil {
hasher.Write([]byte(strconv.Itoa(int(*port.Port))))
}
if port.EndPort != nil {
hasher.Write([]byte(strconv.Itoa(int(*port.EndPort))))
}
}
return hex.EncodeToString(hasher.Sum(nil))
}