mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 15:04:03 +03:00
Fix broken whitelists
This commit is contained in:
@@ -163,7 +163,7 @@ func (f *Firehol) update() {
|
||||
f.treeV4 = v4tree
|
||||
f.treeV6 = v6tree
|
||||
|
||||
f.logger.Info("blocklist was updated")
|
||||
f.logger.Info("ip list was updated")
|
||||
}
|
||||
|
||||
func (f *Firehol) updateFromFile(mutex sync.Locker,
|
||||
|
||||
+4
-1
@@ -2,13 +2,16 @@ package ipblocklist
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/9seconds/mtg/v2/mtglib"
|
||||
)
|
||||
|
||||
type noop struct{}
|
||||
|
||||
func (n noop) Contains(ip net.IP) bool { return false }
|
||||
func (n noop) Contains(ip net.IP) bool { return false }
|
||||
func (n noop) Run(updateEach time.Duration) {}
|
||||
func (n noop) Shutdown() {}
|
||||
|
||||
// NewNoop returns a dummy ipblocklist which allows all incoming
|
||||
// connections.
|
||||
|
||||
@@ -17,6 +17,13 @@ func (suite *NoopTestSuite) TestOp() {
|
||||
suite.False(ipblocklist.NewNoop().Contains(net.ParseIP("10.0.0.10")))
|
||||
}
|
||||
|
||||
func (suite *NoopTestSuite) TestRun() {
|
||||
blocklist := ipblocklist.NewNoop()
|
||||
|
||||
blocklist.Run(0)
|
||||
blocklist.Shutdown()
|
||||
}
|
||||
|
||||
func TestNoop(t *testing.T) {
|
||||
t.Parallel()
|
||||
suite.Run(t, &NoopTestSuite{})
|
||||
|
||||
Reference in New Issue
Block a user