Browse Source

Implement Containers in set

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Guillaume J. Charmes 11 năm trước cách đây
mục cha
commit
43bcbf06a6
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 10 0
      networkdriver/portallocator/ipset.go

+ 10 - 0
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) {