14.04.2026 Update

This commit is contained in:
2026-04-15 11:38:26 +03:00
parent 6aa0349f5d
commit f50d79fab3
45 changed files with 5645 additions and 751 deletions

View File

@@ -14,7 +14,7 @@ import (
const (
pollInterval = 20 * time.Second
OnlineWindow = 5 * time.Minute
trackerTableName = "alpine-router-traffic"
trackerTableName = "nano-router-traffic"
)
type IPStats struct {
@@ -82,6 +82,7 @@ func EnsureIPTracked(ip string) {
return
}
prev[ip] = [2]uint64{}
stats[ip] = &IPStats{}
addNFTRule(ip)
}
@@ -90,10 +91,10 @@ func setupNFTTable() error {
script := fmt.Sprintf(`table ip %s {
chain tx {
type filter hook forward priority filter + 10; policy accept;
type filter hook prerouting priority raw; policy accept;
}
chain rx {
type filter hook forward priority filter + 20; policy accept;
type filter hook postrouting priority raw; policy accept;
}
}`, trackerTableName)
@@ -154,6 +155,7 @@ func poll() {
for ip := range prev {
if _, exists := current[ip]; !exists {
prev[ip] = [2]uint64{0, 0}
addNFTRule(ip)
}
}
}