Skip to content

Commit

Permalink
minor changes in blocklist.go, file.go
Browse files Browse the repository at this point in the history
  • Loading branch information
jreisinger committed Apr 29, 2022
1 parent d6fa29a commit 505f0ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions check/blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/jreisinger/checkip"
)

// BlockList searches the ipaddr in http://api.blocklist.de.
// BlockList searches the ipaddr in lists.blocklist.de/lists/dnsbl/all.list.
func BlockList(ipaddr net.IP) (checkip.Result, error) {
result := checkip.Result{
Name: "blocklist.de",
Expand All @@ -21,9 +21,8 @@ func BlockList(ipaddr net.IP) (checkip.Result, error) {
return result, err
}

url := "https://lists.blocklist.de/lists/dnsbl/all.list"

if err := updateFile(file, url, ""); err != nil {
u := "https://lists.blocklist.de/lists/dnsbl/all.list"
if err := updateFile(file, u, ""); err != nil {
return result, newCheckError(err)
}

Expand All @@ -38,7 +37,7 @@ func BlockList(ipaddr net.IP) (checkip.Result, error) {
fields := strings.Split(input.Text(), ":")
if net.ParseIP(fields[0]).Equal(ipaddr) {
result.Malicious = true
return result, nil
break
}
}
if err := input.Err(); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions check/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"time"
)

// getDbFilesPath returns absolute path to a filename. On Unix it will be
// $HOME/.checkip/<filename>
// getDbFilesPath returns OS specific absolute path to filename. On Unix it will
// be $HOME/.checkip/<filename>
func getDbFilesPath(filename string) (string, error) {
usr, err := user.Current()
if err != nil {
Expand Down

0 comments on commit 505f0ac

Please sign in to comment.