@@ -50,18 +50,6 @@ func (fs *Filters) find(ipnet net.IPNet) (int, *filterEntry) {
50
50
return - 1 , nil
51
51
}
52
52
53
- // AddDialFilter adds a deny rule to this Filters set. Hosts
54
- // matching the given net.IPNet filter will be denied, unless
55
- // another rule is added which states that they should be accepted.
56
- //
57
- // No effort is made to prevent duplication of filters, or to simplify
58
- // the filters list.
59
- //
60
- // Deprecated: Use AddFilter().
61
- func (fs * Filters ) AddDialFilter (f * net.IPNet ) {
62
- fs .AddFilter (* f , ActionDeny )
63
- }
64
-
65
53
// AddFilter adds a rule to the Filters set, enforcing the desired action for
66
54
// the provided IPNet mask.
67
55
func (fs * Filters ) AddFilter (ipnet net.IPNet , action Action ) {
@@ -75,15 +63,6 @@ func (fs *Filters) AddFilter(ipnet net.IPNet, action Action) {
75
63
}
76
64
}
77
65
78
- // RemoveLiteral removes the first filter associated with the supplied IPNet,
79
- // returning whether something was removed or not. It makes no distinction
80
- // between whether the rule is an accept or a deny.
81
- //
82
- // Deprecated: use RemoveLiteral() instead.
83
- func (fs * Filters ) Remove (ipnet * net.IPNet ) (removed bool ) {
84
- return fs .RemoveLiteral (* ipnet )
85
- }
86
-
87
66
// RemoveLiteral removes the first filter associated with the supplied IPNet,
88
67
// returning whether something was removed or not. It makes no distinction
89
68
// between whether the rule is an accept or a deny.
@@ -144,20 +123,6 @@ func (fs *Filters) AddrBlocked(a Multiaddr) (deny bool) {
144
123
return action == ActionDeny
145
124
}
146
125
147
- // Filters returns the list of DENY net.IPNet masks. For backwards compatibility.
148
- //
149
- // A copy of the filters is made prior to returning, so the inner state is not exposed.
150
- //
151
- // Deprecated: Use FiltersForAction().
152
- func (fs * Filters ) Filters () (result []* net.IPNet ) {
153
- ffa := fs .FiltersForAction (ActionDeny )
154
- for _ , res := range ffa {
155
- res := res // allocate a new copy
156
- result = append (result , & res )
157
- }
158
- return result
159
- }
160
-
161
126
func (fs * Filters ) ActionForFilter (ipnet net.IPNet ) (action Action , ok bool ) {
162
127
if _ , f := fs .find (ipnet ); f != nil {
163
128
return f .action , true
0 commit comments