~sircmpwn/abused-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH abused] rules: use rule logger

Details
Message ID
<20240205150124.88883-1-naglis@mailbox.org>
DKIM signature
pass
Download raw message
Patch: +5 -5
This allows to remove the rule name prefixes from the log message.
---
Sending as separate patch instead of v2 since the old commit message no
longer applies and I don't know if it is possible to change the commit
message when doing a v2 (if it is, how?).

 rules/commercial-isp.go | 2 +-
 rules/networks.go       | 6 +++---
 rules/tor-exit.go       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/rules/commercial-isp.go b/rules/commercial-isp.go
index 5768cef..0cc63ce 100644
--- a/rules/commercial-isp.go
+++ b/rules/commercial-isp.go
@@ -75,7 +75,7 @@ func (rule *CommercialISPRule) Test(ctx context.Context, sample *model.Sample) i

	clientIP := net.ParseIP(*sample.IPAddress)
	if clientIP == nil {
		log.Printf("Warning: block-tor-exit saw invalid IP '%s'",
		rule.log.Printf("Warning: invalid IP '%s'",
			*sample.IPAddress)
		return SKIP
	}
diff --git a/rules/networks.go b/rules/networks.go
index 5bd8814..8d2bf1b 100644
--- a/rules/networks.go
+++ b/rules/networks.go
@@ -71,7 +71,7 @@ func (rule *NetworksRule) Test(ctx context.Context, sample *model.Sample) int {
	// TODO: Add a custom IP unmarshaller in the gqlgen riggings
	clientIP := net.ParseIP(*sample.IPAddress)
	if clientIP == nil {
		log.Printf("Warning: block-networks saw invalid IP '%s'",
		rule.log.Printf("Warning: invalid IP '%s'",
			*sample.IPAddress)
		return SKIP
	}
@@ -90,10 +90,10 @@ func (rule *NetworksRule) Report(ctx context.Context, sample *model.Sample, user

	err := rule.ReportSubnet(ctx, *sample.IPAddress+"/32", user, reason)
	if err != nil {
		log.Printf("[block-networks] error reporting %s: %s",
		rule.log.Printf("Error reporting %s: %s",
			*sample.IPAddress, err.Error())
	}
	log.Printf("[block-networks] added %s/32", *sample.IPAddress)
	rule.log.Printf("Added %s/32", *sample.IPAddress)
}

func (rule *NetworksRule) ReportSubnet(ctx context.Context, cidr, source, reason string) error {
diff --git a/rules/tor-exit.go b/rules/tor-exit.go
index 40c9aa5..55cb9b2 100644
--- a/rules/tor-exit.go
+++ b/rules/tor-exit.go
@@ -47,7 +47,7 @@ func (rule *TorExitRule) Test(ctx context.Context, sample *model.Sample) int {

	clientIP := net.ParseIP(*sample.IPAddress)
	if clientIP == nil {
		log.Printf("Warning: block-tor-exit saw invalid IP '%s'",
		rule.log.Printf("Warning: invalid IP '%s'",
			*sample.IPAddress)
		return SKIP
	}
-- 
2.43.0
Details
Message ID
<CYXVBWL2MFYJ.30VMQIG4Q9CDG@taiga>
In-Reply-To
<20240205150124.88883-1-naglis@mailbox.org> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/abused
   92a5de3..39fc8a0  master -> master
Reply to thread Export thread (mbox)