From 43bcbf06a663c5d8cac63f2af8fefef7edc5513a Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Wed, 22 Jan 2014 16:13:28 -0800 Subject: [PATCH] Implement Containers in set Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes (github: creack) --- networkdriver/portallocator/ipset.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/networkdriver/portallocator/ipset.go b/networkdriver/portallocator/ipset.go index b7737bdb73..83203a1688 100644 --- a/networkdriver/portallocator/ipset.go +++ b/networkdriver/portallocator/ipset.go @@ -45,6 +45,16 @@ func (s *iPSet) Pop() string { return "" } +// Exists checks if the given element present in the list. +func (s *iPSet) Exists(elem string) bool { + for _, e := range s.set { + if e == elem { + return true + } + } + return false +} + // Remove removes an element from the list. // If the element is not found, it has no effect. func (s *iPSet) Remove(elem string) {