summaryrefslogtreecommitdiff
path: root/internal/blocklist/blocklist.go
diff options
context:
space:
mode:
authorradhitya <alif@radhitya.org>2026-06-21 09:48:42 +0700
committerradhitya <alif@radhitya.org>2026-06-21 09:48:42 +0700
commitb7359e1d45f505171356bcae3c7d5e2341ecc859 (patch)
treef91d4a4b08ce279d488a76e9b7141e69fc844ea9 /internal/blocklist/blocklist.go
parent2b1f613c42de3861141eb6f93c1740b6937ee183 (diff)
forward mode, cache opt, ACL, rate limit, admin/health, systemd, fix UDP reply
Diffstat (limited to 'internal/blocklist/blocklist.go')
-rw-r--r--internal/blocklist/blocklist.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/internal/blocklist/blocklist.go b/internal/blocklist/blocklist.go
index f6e0592..8925299 100644
--- a/internal/blocklist/blocklist.go
+++ b/internal/blocklist/blocklist.go
@@ -2,9 +2,9 @@ package blocklist
import (
"bufio"
+ "fmt"
"net/http"
"os"
- "fmt"
"strings"
"sync"
"sync/atomic"
@@ -18,19 +18,19 @@ const (
)
type Blocklist struct {
- mu sync.RWMutex
- blocked *trie
+ mu sync.RWMutex
+ blocked *trie
exceptions *trie
- response ResponseAction
+ response ResponseAction
TotalRules int32
- Hits int64
+ Hits int64
}
func New(action ResponseAction) *Blocklist {
return &Blocklist{
- blocked: newTrie(),
+ blocked: newTrie(),
exceptions: newTrie(),
- response: action,
+ response: action,
}
}
@@ -128,8 +128,6 @@ func (b *Blocklist) LoadURL(url string) error {
return b.load(bufio.NewScanner(resp.Body))
}
-
-
func splitDomain(domain string) []string {
domain = strings.TrimSuffix(domain, ".")
return strings.Split(domain, ".")