屏蔽国内IP访问插件,支持在线下载和更新IP库。
plugins/BlockChinaIp/https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt系统会自动添加"状态"开关,用于启用或禁用IP屏蔽功能。
IP库文件应为CIDR格式的IP段列表,每行一个IP段,例如:
1.0.1.0/24
1.0.2.0/23
1.0.8.0/21
支持以 # 开头的注释行,空行会被自动忽略。
为了方便开发和测试,插件支持测试模式:
在浏览器地址栏添加 ?test_ip=IP地址 参数:
# 测试中国IP(会被屏蔽)
http://your-domain.com/?test_ip=114.114.114.114
# 测试非中国IP(不会屏蔽)
http://your-domain.com/?test_ip=8.8.8.8
使用浏览器开发者工具或ModHeader扩展,添加请求头:
X-Test-IP114.114.114.114在 .env 文件中添加:
BLOCK_CHINA_IP_TEST_IP=114.114.114.114
中国IP(会被屏蔽):
114.114.114.114 - 114 DNS223.5.5.5 - 阿里云 DNS180.76.76.76 - 百度 DNS非中国IP(不会被屏蔽):
8.8.8.8 - Google DNS(美国)1.1.1.1 - Cloudflare DNS(美国)208.67.222.222 - OpenDNS(美国)storage/app/block_china_ip/china_ip_ranges.txtmaintenance 视图)BlockChinaIp/
├── Boot.php # 插件启动类
├── config.json # 插件配置文件
├── fields.php # 插件字段配置
├── Controllers/
│ └── Panel/
│ └── BlockChinaIpController.php # 后台控制器
├── Middleware/
│ └── Front/
│ └── BlockChinaIp.php # 前台中间件
├── Services/
│ └── IpBlockService.php # IP检查服务
├── Routes/
│ └── panel.php # 后台路由
├── Views/
│ └── plugins/
│ └── fields/
│ └── ip_database_url.blade.php # IP库字段视图
└── Lang/
├── en/
│ └── common.php # 英文语言包
└── zh-cn/
└── common.php # 中文语言包