diff options
| author | loyalsoldier <[email protected]> | 2021-10-04 15:41:26 +0800 |
|---|---|---|
| committer | loyalsoldier <[email protected]> | 2021-10-04 15:41:26 +0800 |
| commit | 0f88644cdf10877e495a140e2eefd9fa69399dd1 (patch) | |
| tree | 835005dc3c8cacd342ab8bae094bc58d940f2333 /lib | |
| parent | 11925f1ee7190145a4105e4edc7e6ed98f99d304 (diff) | |
Feat: remove unused replace action
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lib.go | 34 |
1 files changed, 6 insertions, 28 deletions
@@ -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) -} |
