Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Commit

Permalink
Reinstate deprecated Remove() method to reverse breakage (#12)
Browse files Browse the repository at this point in the history
Reinstate deprecated Remove() method to reverse breakage
  • Loading branch information
raulk authored May 16, 2019
2 parents 0be077b + a858621 commit 05a9b9b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (fs *Filters) find(ipnet net.IPNet) (int, *filterEntry) {
// No effort is made to prevent duplication of filters, or to simplify
// the filters list.
//
// DEPRECATED. Use AddFilter.
// Deprecated: Use AddFilter().
func (fs *Filters) AddDialFilter(f *net.IPNet) {
fs.AddFilter(*f, ActionDeny)
}
Expand All @@ -78,6 +78,15 @@ func (fs *Filters) AddFilter(ipnet net.IPNet, action Action) {
}
}

// RemoveLiteral removes the first filter associated with the supplied IPNet,
// returning whether something was removed or not. It makes no distinction
// between whether the rule is an accept or a deny.
//
// Deprecated: use RemoveLiteral() instead.
func (fs *Filters) Remove(ipnet *net.IPNet) (removed bool) {
return fs.RemoveLiteral(*ipnet)
}

// RemoveLiteral removes the first filter associated with the supplied IPNet,
// returning whether something was removed or not. It makes no distinction
// between whether the rule is an accept or a deny.
Expand Down Expand Up @@ -134,7 +143,7 @@ func (fs *Filters) AddrBlocked(a ma.Multiaddr) (deny bool) {
//
// A copy of the filters is made prior to returning, so the inner state is not exposed.
//
// DEPRECATED. Use FiltersForAction().
// Deprecated: Use FiltersForAction().
func (fs *Filters) Filters() (result []*net.IPNet) {
ffa := fs.FiltersForAction(ActionDeny)
for _, res := range ffa {
Expand Down

0 comments on commit 05a9b9b

Please sign in to comment.