diff --git a/plugin.go b/plugin.go index 0ece473..3ff5beb 100644 --- a/plugin.go +++ b/plugin.go @@ -170,10 +170,6 @@ func (p Plugin) CheckAllowed(ip string) (allow bool, country string, err error) return false, ip, fmt.Errorf("lookup of %s failed: %w", ip, err) } - if country == "-" { - return p.allowPrivate, country, nil - } - if country != "-" { for _, item := range p.blockedCountries { if item == country { diff --git a/plugin_test.go b/plugin_test.go index f9359d0..5293252 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -106,8 +106,8 @@ func TestPlugin_ServeHTTP(t *testing.T) { Enabled: true, DatabaseFilePath: dbFilePath, AllowedCountries: []string{}, - AllowPrivate: true, DisallowedStatusCode: http.StatusOK, + DefaultAllow: true, } plugin, err := New(context.TODO(), &noopHandler{}, cfg, pluginName) @@ -157,6 +157,7 @@ func TestPlugin_ServeHTTP(t *testing.T) { AllowedCountries: []string{}, AllowPrivate: false, DisallowedStatusCode: http.StatusForbidden, + DefaultAllow: false, } plugin, err := New(context.TODO(), &noopHandler{}, cfg, pluginName)