Skip to content

Commit

Permalink
Merge pull request #3 from tkhq/sean/allow-unknown-country-processing
Browse files Browse the repository at this point in the history
allow unknown country IPs to continue being processed
  • Loading branch information
Ulexus authored Nov 1, 2023
2 parents a9129b9 + ce7b0b5 commit 8b8a24c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 0 additions & 4 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8b8a24c

Please sign in to comment.