fix: 1.4.7 default unban log path
Release / Gitea release (push) Successful in 5s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Successful in 1m10s
Release / Build image (amd64) (push) Successful in 23s
Release / Build image (arm64) (push) Successful in 1m20s
Release / Publish tags (push) Successful in 19s
CI / Format and vet (push) Successful in 33s
CI / Tests (Linux, race detector) (push) Successful in 37s
CI / Dependency audit (push) Successful in 37s
CI / Docker image (build and smoke test) (push) Skipped
Release / Gitea release (push) Successful in 5s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Successful in 1m10s
Release / Build image (amd64) (push) Successful in 23s
Release / Build image (arm64) (push) Successful in 1m20s
Release / Publish tags (push) Successful in 19s
CI / Format and vet (push) Successful in 33s
CI / Tests (Linux, race detector) (push) Successful in 37s
CI / Dependency audit (push) Successful in 37s
CI / Docker image (build and smoke test) (push) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
da333d70f1
commit
873219416f
5 files changed
+36
-2
No files matched your search
+12
-1
@@ -35,7 +35,7 @@ func newEnforce(c Config, st *store.Store, peers []fed.Peer, en enricher, ready
|
||||
}
|
||||
}
|
||||
e := enforce.New(enforce.Config{
|
||||
Mode: mode, Path: c.EnforceLog, UnbanPath: c.EnforceUnbanLog, StatePath: filepath.Join(c.DataDir, "enforce.json"), Host: c.Name,
|
||||
Mode: mode, Path: c.EnforceLog, UnbanPath: unbanLogPath(c), StatePath: filepath.Join(c.DataDir, "enforce.json"), Host: c.Name,
|
||||
Threshold: c.EnforceThreshold, MaxPerMin: c.EnforceMaxPerMin, Share: strings.EqualFold(c.EnforceShare, "on"),
|
||||
Trusted: trusted, PeerHosts: hosts, InfraHosts: hosts, Resolve: resolveHost,
|
||||
Crawler: func(ip string, uas []string) bool { v := st.FCrDNS(ip, uas); return v != nil && *v },
|
||||
@@ -192,3 +192,14 @@ func cloudflareClients(path string) (cf, total int) {
|
||||
}
|
||||
return cf, total
|
||||
}
|
||||
|
||||
// unbanLogPath is --enforce-unban-log, or unban.log next to --enforce-log.
|
||||
func unbanLogPath(c Config) string {
|
||||
if c.EnforceUnbanLog != "" {
|
||||
return c.EnforceUnbanLog
|
||||
}
|
||||
if c.EnforceLog == "" {
|
||||
return ""
|
||||
}
|
||||
return filepath.Join(filepath.Dir(c.EnforceLog), "unban.log")
|
||||
}
|
||||
Reference in new issue
Block a user