初步支持禁止国内省份地域

This commit is contained in:
2025-08-21 10:43:52 +08:00
parent 60778c4436
commit f6adc5b2a1
4 changed files with 38 additions and 3 deletions

View File

@@ -312,9 +312,12 @@ func RunMainProcess() { // 主进程逻辑
goto next
}
REGION := "中国 内网" // 默认地域
if Is_Ip_Ipset(ipStr) != 0 { // IP 不在 ipset 集合中
if !strings.Contains(region, "中国") && !strings.Contains(region, "内网") { // 离线库判断不在中国内
//if !strings.Contains(region, "中国") && !strings.Contains(region, "内网") { // 离线库判断不在中国内
if !ContainsPart(region, REGION) {
log.Printf("\033[33m [%s %s] 离线库为国外, 进一步API判断\033[0m\n", ipStr, region)
if position, err := curl_(ipStr); err != nil { // 使用 API 判断地域
@@ -322,7 +325,8 @@ func RunMainProcess() { // 主进程逻辑
} else {
log.Printf("\033[31m [%s %s]\033[0m\n\n", ipStr, position) // 打印地域
if !strings.Contains(position, "中国") && !strings.Contains(position, "内网") { // API 判断为国外
//if !strings.Contains(position, "中国") && !strings.Contains(position, "内网") { // API 判断为国外
if !ContainsPart(region, REGION) {
AddIPSet(IPSET_NAME, ipStr) // 添加 IP 到 ipset 集合
// 钉钉告警,废弃!钉钉可能限制文本长度,和发送次数!