From b34a8c169c0a7ba84d97464b2a34b4fdff5c17bd Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Mon, 15 May 2023 10:33:52 +0300 Subject: [PATCH] filtering: imp tests --- internal/filtering/dnsrewrite.go | 4 ++-- internal/filtering/dnsrewrite_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/filtering/dnsrewrite.go b/internal/filtering/dnsrewrite.go index ee93104b..389fafce 100644 --- a/internal/filtering/dnsrewrite.go +++ b/internal/filtering/dnsrewrite.go @@ -27,8 +27,8 @@ func (d *DNSFilter) processDNSRewrites(dnsr []*rules.NetworkRule) (res Result) { slices.SortFunc(dnsr, rewriteSortsBefore) - for _, nr := range dnsr { - if containsWildcard(nr) { + for i, nr := range dnsr { + if i > 0 && containsWildcard(nr) { break } diff --git a/internal/filtering/dnsrewrite_test.go b/internal/filtering/dnsrewrite_test.go index 7d9ae867..6c3427ac 100644 --- a/internal/filtering/dnsrewrite_test.go +++ b/internal/filtering/dnsrewrite_test.go @@ -204,7 +204,7 @@ func TestDNSFilter_CheckHostRules_dnsrewrite(t *testing.T) { }) } -func TestDNSFilter_processDNSRewrites(t *testing.T) { +func TestDNSFilter_ProcessDNSRewrites(t *testing.T) { const text = ` |www.example.com^$dnsrewrite=127.0.0.1 |*.example.com^$dnsrewrite=127.0.0.2