mirror of
https://github.com/isboyjc/GoProxy.git
synced 2026-05-07 06:12:41 +08:00
feat: ✨ implement geo-filtering with whitelist and blacklist support
- Added support for geo-filtering in the proxy pool, allowing configuration of allowed and blocked countries via environment variables. - Updated `.env.example` and `docker-compose.yml` to include `ALLOWED_COUNTRIES` for whitelist functionality. - Enhanced `CLAUDE.md`, `GEO_FILTER.md`, and `README.md` to document the new geo-filtering features and usage instructions. - Modified proxy validation logic to prioritize whitelist over blacklist during admission checks. - Improved WebUI to allow dynamic configuration of geo-filter settings.
This commit is contained in:
9
main.go
9
main.go
@@ -59,7 +59,14 @@ func main() {
|
||||
|
||||
// 清理无效代理
|
||||
totalDeleted := 0
|
||||
if len(cfg.BlockedCountries) > 0 {
|
||||
if len(cfg.AllowedCountries) > 0 {
|
||||
// 白名单模式:清理不在白名单中的代理
|
||||
if deleted, err := store.DeleteNotAllowedCountries(cfg.AllowedCountries); err == nil && deleted > 0 {
|
||||
log.Printf("[main] 🧹 已清理 %d 个非白名单国家出口代理 (允许: %v)", deleted, cfg.AllowedCountries)
|
||||
totalDeleted += int(deleted)
|
||||
}
|
||||
} else if len(cfg.BlockedCountries) > 0 {
|
||||
// 黑名单模式:清理屏蔽国家的代理
|
||||
if deleted, err := store.DeleteBlockedCountries(cfg.BlockedCountries); err == nil && deleted > 0 {
|
||||
log.Printf("[main] 🧹 已清理 %d 个屏蔽国家出口代理 (屏蔽: %v)", deleted, cfg.BlockedCountries)
|
||||
totalDeleted += int(deleted)
|
||||
|
||||
Reference in New Issue
Block a user