From 5138bcb1c79014a22fb76d52bcc7a5a1f595ccaa Mon Sep 17 00:00:00 2001 From: Emmanuel Odeke Date: Fri, 15 Sep 2017 14:02:06 -0600 Subject: [PATCH] p2p: delete unused and untested *IPRangeCount functions Fixes #602 Delete unused and untested functions: - AddToIPRangeCounts - CheckIPRangeCounts --- p2p/ip_range_counter.go | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 p2p/ip_range_counter.go diff --git a/p2p/ip_range_counter.go b/p2p/ip_range_counter.go deleted file mode 100644 index 85d9d407a..000000000 --- a/p2p/ip_range_counter.go +++ /dev/null @@ -1,29 +0,0 @@ -package p2p - -import ( - "strings" -) - -// TODO Test -func AddToIPRangeCounts(counts map[string]int, ip string) map[string]int { - changes := make(map[string]int) - ipParts := strings.Split(ip, ":") - for i := 1; i < len(ipParts); i++ { - prefix := strings.Join(ipParts[:i], ":") - counts[prefix] += 1 - changes[prefix] = counts[prefix] - } - return changes -} - -// TODO Test -func CheckIPRangeCounts(counts map[string]int, limits []int) bool { - for prefix, count := range counts { - ipParts := strings.Split(prefix, ":") - numParts := len(ipParts) - if limits[numParts] < count { - return false - } - } - return true -}