This commit is contained in:
wjqserver
2025-07-22 17:29:38 +08:00
parent cc4b04ede2
commit 33bb588c36
2 changed files with 6 additions and 4 deletions

View File

@@ -130,10 +130,10 @@ type WhitelistConfig struct {
}
type IPFilterConfig struct {
Enabled bool `toml:"enabled"`
EnableAllowList bool `toml:"enableAllowList"`
EnableBlockList bool `toml:"enableBlockList"`
IPFilterFile string
Enabled bool `toml:"enabled"`
EnableAllowList bool `toml:"enableAllowList"`
EnableBlockList bool `toml:"enableBlockList"`
IPFilterFile string `toml:"ipFilterFile"`
}
/*

View File

@@ -373,6 +373,7 @@ func main() {
ipAllowList, ipBlockList, err := auth.ReadIPFilterList(cfg)
if err != nil {
fmt.Printf("Failed to read IP filter list: %v\n", err)
logger.Errorf("Failed to read IP filter list: %v", err)
os.Exit(1)
}
ipBlockFilter, err := ipfilter.NewIPFilter(ipfilter.IPFilterConfig{
@@ -383,6 +384,7 @@ func main() {
})
if err != nil {
fmt.Printf("Failed to initialize IP filter: %v\n", err)
logger.Errorf("Failed to initialize IP filter: %v", err)
os.Exit(1)
} else {
r.Use(ipBlockFilter)