From 0f88644cdf10877e495a140e2eefd9fa69399dd1 Mon Sep 17 00:00:00 2001 From: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Mon, 4 Oct 2021 15:41:26 +0800 Subject: Feat: remove unused replace action --- lib/lib.go | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'lib') diff --git a/lib/lib.go b/lib/lib.go index c3203eeb..440628ec 100644 --- a/lib/lib.go +++ b/lib/lib.go @@ -11,20 +11,18 @@ import ( ) const ( - ActionAdd Action = "add" - ActionRemove Action = "remove" - ActionReplace Action = "replace" - ActionOutput Action = "output" + ActionAdd Action = "add" + ActionRemove Action = "remove" + ActionOutput Action = "output" IPv4 IPType = "ipv4" IPv6 IPType = "ipv6" ) var ActionsRegistry = map[Action]bool{ - ActionAdd: true, - ActionRemove: true, - ActionReplace: true, - ActionOutput: true, + ActionAdd: true, + ActionRemove: true, + ActionOutput: true, } type Action string @@ -326,7 +324,6 @@ type Container interface { GetEntry(name string) (*Entry, bool) Add(entry *Entry, opts ...IgnoreIPOption) error Remove(name string, opts ...IgnoreIPOption) - Replace(entry *Entry, opts ...IgnoreIPOption) Loop() <-chan *Entry } @@ -457,22 +454,3 @@ func (c *container) Remove(name string, opts ...IgnoreIPOption) { c.entries.Delete(name) } } - -func (c *container) Replace(entry *Entry, opts ...IgnoreIPOption) { - var ignoreIPType IPType - for _, opt := range opts { - if opt != nil { - ignoreIPType = opt() - } - } - - switch ignoreIPType { - case IPv4: - entry.ipv4Builder = nil - case IPv6: - entry.ipv6Builder = nil - } - - name := entry.GetName() - c.entries.Store(name, entry) -} -- cgit v1.3.1