rebased on develop

This commit is contained in:
0xdcarns
2021-10-26 12:58:50 -04:00
parent 8f72ecbaa0
commit 7ddf36520a
3 changed files with 42 additions and 50 deletions

View File

@@ -433,35 +433,6 @@ func GenKeyName() string {
return "key" + string(b)
}
// IsIPUnique - checks if an IP is unique
func IsIPUnique(network string, ip string, tableName string, isIpv6 bool) bool {
isunique := true
collection, err := database.FetchRecords(tableName)
if err != nil {
return isunique
}
for _, value := range collection { // filter
var node models.Node
if err = json.Unmarshal([]byte(value), &node); err != nil {
continue
}
if isIpv6 {
if node.Address6 == ip && node.Network == network {
return false
}
} else {
if node.Address == ip && node.Network == network {
return false
}
}
}
return isunique
}
// DeleteKey - deletes a key
func DeleteKey(network models.Network, i int) {