reputation: name a client on AbuseIPDB's blacklist BlacklistEntry
check / check (push) Failing after 3m48s
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:
1 parent
da6667957f
commit
3060788ca3
6 files changed
+24
-18
No files matched your search
@@ -14,7 +14,7 @@ import (
|
||||
// BanForAbuseIPDB describes, and logs how many clients were listed and how
|
||||
// many bans were made. Clients in one netblock make one ban, with the
|
||||
// highest of their scores. In observe mode it makes no ban.
|
||||
func (h *handler) banAbuseIPDBBlacklist(listed []reputation.Listed) {
|
||||
func (h *handler) banAbuseIPDBBlacklist(listed []reputation.BlacklistEntry) {
|
||||
scores := make(map[netip.Prefix]int64, len(listed))
|
||||
|
||||
for _, client := range listed {
|
||||
|
||||
@@ -54,7 +54,7 @@ func TestClientsOnTheAbuseIPDBBlacklistAreBannedForTheBanDays(t *testing.T) {
|
||||
})
|
||||
|
||||
// Two clients in one netblock make one ban, with the higher score.
|
||||
server.BanAbuseIPDBBlacklist([]reputation.Listed{
|
||||
server.BanAbuseIPDBBlacklist([]reputation.BlacklistEntry{
|
||||
{Addr: netip.MustParseAddr(client), Score: 95},
|
||||
{Addr: netip.MustParseAddr(otherClient), Score: 100},
|
||||
{Addr: netip.MustParseAddr("2001:db8:5::1"), Score: 90},
|
||||
@@ -88,7 +88,7 @@ func TestAbuseIPDBBlacklistMakesNoBanInObserveMode(t *testing.T) {
|
||||
map[string]string{mode: "observe"},
|
||||
)
|
||||
|
||||
server.BanAbuseIPDBBlacklist([]reputation.Listed{
|
||||
server.BanAbuseIPDBBlacklist([]reputation.BlacklistEntry{
|
||||
{Addr: netip.MustParseAddr(client), Score: 100},
|
||||
})
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ func (s *Server) SetBesideLookupTimeLimit(limit time.Duration) {
|
||||
|
||||
// BanAbuseIPDBBlacklist does on s what a fetch of AbuseIPDB's blacklist with
|
||||
// the clients on listed does.
|
||||
func (s *Server) BanAbuseIPDBBlacklist(listed []reputation.Listed) {
|
||||
func (s *Server) BanAbuseIPDBBlacklist(listed []reputation.BlacklistEntry) {
|
||||
h := s.Handler.(*handler) //nolint:forcetypeassert // New makes it one
|
||||
h.banAbuseIPDBBlacklist(listed)
|
||||
}
|
||||
@@ -206,7 +206,8 @@ func newHandler(params Params) *handler {
|
||||
// m, AbuseIPDB's while SWW_WAF_ABUSEIPDB_KEY is set. blacklisted receives
|
||||
// the clients on each AbuseIPDB blacklist fetched.
|
||||
func newReputation(
|
||||
params Params, m *metrics.Metrics, blacklisted func([]reputation.Listed),
|
||||
params Params, m *metrics.Metrics,
|
||||
blacklisted func([]reputation.BlacklistEntry),
|
||||
) (*reputation.Lists, *reputation.DNSBL, *reputation.AbuseIPDB) {
|
||||
cfg := params.Config
|
||||
lists := reputation.New(reputation.Params{
|
||||
|
||||
Reference in new issue
Block a user