reputation: name a client on AbuseIPDB's blacklist BlacklistEntry
check / check (push) Failing after 3m48s

The type was named Listed, in a package whose DNSBL verdicts carry a
field Listed and whose blocklists list clients too, so the name alone
did not say which list it was on.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-19 08:53:21 +00:00
1 parent da6667957f
commit 3060788ca3
6 files changed
+24 -18

No files matched your search

+10 -8
View File
@@ -59,9 +59,9 @@ type ChecksSpent struct {
Spent int
}
// Listed is a client on AbuseIPDB's blacklist: its address and its abuse
// confidence score.
type Listed struct {
// BlacklistEntry is a client on AbuseIPDB's blacklist: its address and its
// abuse confidence score.
type BlacklistEntry struct {
Addr netip.Addr
Score int64
}
@@ -90,7 +90,7 @@ type AbuseIPDBParams struct {
BlacklistURL string
Threshold int64
BlacklistRefresh time.Duration
Blacklisted func([]Listed)
Blacklisted func([]BlacklistEntry)
// Now tells the time, normally time.Now in UTC.
Now func() time.Time
// ProcessLog receives each check or fetch of the blacklist that fails,
@@ -404,7 +404,9 @@ func (a *AbuseIPDB) ask(
// Threshold or more, sending the key in the header Key. An answer other
// than 200, one longer than maxListBytes or without the list, an entry
// whose address does not read, and none within fetchTimeout, fail.
func (a *AbuseIPDB) fetchBlacklist(ctx context.Context) ([]Listed, error) {
func (a *AbuseIPDB) fetchBlacklist(
ctx context.Context,
) ([]BlacklistEntry, error) {
ctx, cancel := context.WithTimeout(ctx, fetchTimeout)
defer cancel()
@@ -447,7 +449,7 @@ func (a *AbuseIPDB) fetchBlacklist(ctx context.Context) ([]Listed, error) {
}
// parseBlacklist reads body, AbuseIPDB's answer with its blacklist.
func parseBlacklist(body []byte) ([]Listed, error) {
func parseBlacklist(body []byte) ([]BlacklistEntry, error) {
var answer struct {
Data *[]struct {
IPAddress string `json:"ipAddress"`
@@ -464,7 +466,7 @@ func parseBlacklist(body []byte) ([]Listed, error) {
return nil, errNoBlacklist
}
listed := make([]Listed, 0, len(*answer.Data))
listed := make([]BlacklistEntry, 0, len(*answer.Data))
for i, entry := range *answer.Data {
addr, err := netip.ParseAddr(entry.IPAddress)
@@ -478,7 +480,7 @@ func parseBlacklist(body []byte) ([]Listed, error) {
)
}
listed = append(listed, Listed{
listed = append(listed, BlacklistEntry{
Addr: addr.Unmap(), Score: entry.AbuseConfidenceScore,
})
}