ProxyShield
面向 Minecraft 服务器的反 VPN 和反代理保护。支持国家过滤、Discord Webhook 警报、静默模式和干跑模式(dry-run mode)。拥有统一的检测核心,在所有平台上行为一致。
它自带免费的检测服务 PaperStream Intel,默认开启:无需密钥,无需注册账号。自 3.2 版本起,插件内置了该服务的数据库本地副本,因此大多数玩家的判定可在服务器端直接完成,无需等待外部响应。
实测数据,而非宣称
以下数据来自 mc-antivpn-bench,由另一位插件作者运行的开源基准测试。ProxyShield 3.2.0 在发布前使用相同的测试工具在 Velocity 上进行了测量,因此这些是我们自己的测试结果,并非已发布表格中的数据。
|
ProxyShield 3.2.0 |
| 阻止的恶意地址(VPN、IPv6 VPN、新 VPN 服务器、Tor、代理) |
361 of 361 |
| 误拦的真实玩家(家庭网络、IPv6 家庭网络、移动网络) |
0 of 306 |
| 压力测试:20 秒内 1,000 名玩家 |
1,000 of 1,000 checked |
| 单次加入,第 95 百分位延迟 |
289 ms |
| 重复加入,中位数延迟 |
4 ms 以内 |
| 从同一地址进行 100 次加入的查询次数 |
1 |
| 启动至受保护状态耗时 |
6.5 s |
下载
每个平台对应一个文件:ProxyShield-Universal-<version>.jar。
| 运行环境 |
放置位置 |
| Paper, Purpur and Spigot 1.21+, Folia |
plugins/ |
| BungeeCord / Waterfall |
plugins/ |
| Velocity 3.3+ |
plugins/ |
| Sponge (SpongeAPI 17) |
mods/ |
该 jar 包同时包含四个入口点和四种插件描述符。每个服务器都会读取其识别的描述符并忽略其余部分,因此同一个文件既适用于单机服务器,也适用于整个网络。3.0.2 之前的版本曾按平台分别发布独立的 jar 包,这些旧文件仍列在“早期版本”下。
Spigot 也由同一个 jar 包支持。Paper 和 Folia 提供了 AsyncScheduler、实体级调度器和 Adventure 组件;而 Spigot 并不具备这三项功能。该 jar 包会在启动时选择对应的实现方式,且仅适用于 Paper 的类型被封装在一个不会在无此特性的服务器上加载的类中。
请在接收连接的机器上安装一个 jar 包。在网络架构中,这通常是代理服务器(BungeeCord 或 Velocity)。若将 Paper 构建版放在代理后方,它将只能看到代理自身的地址。
展示
简短演示检查过程、判定结果以及被阻止连接的表现。
特性
检测
- 内置 27 项 IP 情报服务,按名称启用——其中 16 项完全无需 API 密钥
- PaperStream Intel 作为首个提供商:提供来自每日更新的网络类型、国家和 ASN,以及 VPN、代理和 Tor 列表,还有其他 ProxyShield 服务器报告的地址
- VPN 运营商自行发布的服务器列表(包括 Mullvad、IVPN、NordVPN、Private Internet Access),涵盖任何公开列表都不知晓的 IPv6 中继。一旦命中,立即拒绝玩家加入
- 离线网络更新源:无需针对每个玩家发起请求,即可区分家庭/移动网络与托管网络,因此配额耗尽时不会让恶意流量涌入
- 共识评分:同时查询多个提供商并累加其权重,确保从未听说过某 VPN 的服务无法放行它,而噪声较大的服务也不能单独踢人
- 公共 VPN、数据中心和 Tor 出口节点更新源,支持精确 CIDR 匹配,兼容 IPv4 和 IPv6
- 网络(ASN)封禁与白名单规则,可在任何更新源列出之前拦截 VPN 的新网段;附带可下载的 ASN 列表,自动刷新
- 基于正则表达式的 ISP 过滤器,用于屏蔽特定主机商或始终放行移动运营商
- 对任意提供商返回结果的条件判断(如
risk.score >= 85、connection.type = mobile)及自定义请求头,以便精确接入未列出的服务
- 直接拒绝 Bogon 地址
- 反向 DNS 模式作为信号特征——免费、无限使用,且对未被收录的地址范围同样有效
- 行为启发式检测:子网内的加入频率、单地址下的账户数量、账户变更国家等行为
- 对常客建立信任机制,防止因规则收紧或某提供商状态不佳而误踢玩家
- 国家过滤功能,支持黑名单或白名单模式
- 手动黑名单,优先级最高,最先检查
- 按地址限制连接数,可基于当前在线玩家数或指定时间窗口进行统计
- 当检查无法完成时,可配置为失败开放(fail-open)或失败关闭(fail-closed)行为
- 自动快速放行:当大量玩家同时加入时,来自家庭网络的地址将跳过提供商查询,从而保护配额供其他请求使用,避免加入高峰拖垮服务
例外设置
- IP 白名单支持单个地址、CIDR 块和地址范围
- 玩家名称白名单
- 绕过权限(Bypass permission)
- 回环地址(Loopback)和私有地址永不检查,且不消耗查询配额
- 通过 Geyser/Floodgate 连接的 Bedrock 玩家将以其真实地址进行检查,Floodgate 会传递该地址。
whitelist.geyser-addresses 可用于放行以自身地址显示的 Geyser 服务器
运维功能
- 试运行模式(Dry-run mode):仅检测并报告,不断开任何人连接
- 被动模式:登录时不执行检查,仅在需要时进行查询
- BungeeCord 和 Velocity 上的受限服务器:将标记玩家留在大厅而非直接踢出
- 白名单和黑名单条目支持添加原因和过期时间
/proxyshield alts 列出同一地址下出现的所有账户
- 调试输出包含每个提供商的原始响应数据
- 检测到异常时触发控制台命令,允许对标记玩家进行标记或限制而非直接踢出
/proxyshield check 显示每位提供商的具体反馈,便于追踪误判原因
- 查询缓存在重启和重载后依然保留;来自同一地址的同时登录共享一次查询
- 支持跨网络共享存储:MySQL、MariaDB、PostgreSQL、SQLite、H2 或 Redis
- 支持 PlaceholderAPI 及匿名 bStats 指标上报
- 静默模式:不向管理员或控制台发送警报,但日志文件和 webhook 仍继续记录
- Discord webhook 支持队列、重试和速率限制处理,并提供自定义布局
- Telegram 和 VK 警报支持
- 拦截日志保存至
plugins/ProxyShield/blocks.log
- 完整的
/proxyshield 命令集,支持 Tab 补全
- 控制台自动检查更新(每 12 小时一次,不会发送任何关于你服务器的信息),也可通过
/proxyshield update 手动触发;在 Paper、Folia 和 Spigot 上,若开启相应选项,新 jar 文件可自动下载至更新文件夹
config.yml 启动时自动升级:新增选项及其注释会自动添加,已删除的配置不会恢复,已修改的值不会被覆盖
- 可选向 PaperStream Intel 上报数据,默认关闭
- 本地缓存 PaperStream Intel 数据库,每日自动刷新并签名,从而实现无需请求即可拒绝 VPN、Tor 和托管地址
- 踢人界面显示简明原因(如“数据中心网络 (Hetzner Online GmbH)”、“Tor 网络”),并提供申诉码,玩家可将其提交给管理员,管理员可通过
/proxyshield allow <code> 解除限制
/proxyshield doctor 检查配置,/proxyshield explain 逐步解释某次判定过程,/proxyshield ping 实时测试各提供商连通性
- 每周向 Discord webhook 发送报告:包含检查的加入次数、被拒玩家数、失效的提供商等
- 首次启动后可选择学习阶段(
detection.learn-hours):此期间不会踢人,之后控制台会提示本应踢出的人数
- 内置英文和德文支持,复制单个文件即可切换其他语言
快速上手
- 将 jar 文件放入
plugins/ 目录(Sponge 则为 mods/),然后启动服务器一次。
- 编辑
plugins/ProxyShield/config.yml。
- 运行
/proxyshield reload。
建议首次运行时保持 detection.dry-run: true 持续一天,并观察 blocks.log。该日志会记录原本会被阻止的情况,而不会断开任何人连接,这是在误判影响真实玩家前发现问题的最低成本方式。
提供商与评分
按名称启用某项服务。以下列为免费的十五项完全无需密钥:
api:
mode: consensus # 或 failover
required-score: 1.5
providers:
ip-api: { enabled: true, weight: 1.0 }
blackbox: { enabled: true, weight: 1.0 }
ipapi-is: { enabled: true, weight: 1.5 }
proxycheck: { enabled: false, weight: 2.0, key: "" }
在共识模式下,所有启用的提供商会同时被查询,并将标记该地址的提供商权重相加。当 required-score: 1.5 时,一个高权重的提供商就足够了,或者任意两个较低权重的提供商,或者一个低权重提供商加上反向 DNS 命中。如果你更倾向于漏判 VPN 而不是踢出真实玩家,可以将其提高到 2.5;如果希望任何单次命中就进行拦截,可以将其降低到 1.0。
这并不会像看起来那样成倍增加你的配额。答案是缓存的(IPv6 折叠至其 /64 前缀),来自同一地址的同时登录共享一次查询,一旦达到分数要求扇出就会停止,缓存在重启和重载后依然存在,并且一旦某个提供商开始失败,它将被从轮询中移除,直到恢复为止。
目录中未收录的服务可以直接在 config.yml 中使用 URL 和点号分隔的字段路径来描述——请参阅 providers 部分底部的注释示例。
PaperStream Intel
PaperStream Intel 是我们自己的免费反 VPN 服务,也是列表中的第一个提供商。它的答案来自每晚重建的网络数据源,包括公开的 VPN、数据中心、Tor 和代理列表,VPN 运营商发布的服务器列表,以及其他 ProxyShield 服务器报告的地址。无需密钥或账户,每个地址每分钟 600 次请求。
报告是可选的,默认关闭。 通过 reporting.enabled: true,被提供商拒绝为代理的地址每 10 分钟分批发送,附带一个随机安装 ID。不包含玩家名称、UUID 或服务器地址。服务保留这些数据 14 天,并统计地址出现的服务器数量;从第 3 个服务器出现起,它会向所有人投票判定为“代理”。/proxyshield reporting 显示状态,/proxyshield reporting forget 删除所有已发送的数据。详细信息见 隐私政策。
国家过滤
country:
enabled: true
mode: whitelist # 仅允许这些国家的连接
codes: ["DE", "AT", "CH"]
block-unknown: false
设置 mode: blacklist 可反转其行为。国家数据来自查找提供商,因此即使 detection.use-api 关闭,country.enabled 也会触发提供商查询。
静默模式
notifications:
silent: true
抑制工作人员广播和控制台行。日志文件和 webhook 仍会记录每次检测,这样你可以在不向所有在线人员宣布过滤器触发的情况下保留数据。
检测时的命令
并非每个服务器都希望标记的玩家离开。相反,你可以运行原本需要手动运行的命令:
detection:
dry-run: true
actions:
on-flag:
- "lp user {player} permission set myserver.vpnflagged true"
- "webhook {player} flagged {reason} from {ip}"
delay-seconds: 3
run-when: always
开启 dry-run 后,检测仍然触发,警报和 webhook 仍然发出,这些命令仍然运行,但玩家保持连接。这就是标记而非踢出的设置:将他们放入受限组,让他们通过 Discord 验证,或将名字交给另一个插件处理。
命令以控制台身份运行,带或不带前导斜杠。可用的占位符有 {player}、{uuid}、{ip}、{reason}、{reason_id}、{country}、{isp}、{asn}、{score}、{sources}、{action} 和 {platform}。
delay-seconds 的作用比看起来更大。连接是在玩家进入服务器之前进行评估的,因此在 0 时,命令会在他们仍在连接时运行。这对于权限授予或 webhook 没问题,但对于需要他们实际在线的命令(如向他们发送消息或提示他们关联账户),则需要在这里留出几秒时间。
run-when 接受 always、kicked 或 allowed,以便仅在玩家被断开连接时或仅在未被断开连接时才触发命令。
Discord webhook
discord:
enabled: true
webhook-url: "https://discord.com/api/webhooks/..."
show-ip: true
show-ip: false 将发布 hidden 而不是地址。仅接受 https:// URL。
消息布局由你自定义。默认情况下它是一个标题和六个内联框;清除字段并编写描述即可:
discord:
embed:
title: "`{player}`"
description: |
```ansi
IP: `{ip}`
Country: {country}
Action: {action}
```
thumbnail: "https://your-server.example/alert.gif"
fields: {}
占位符:{player} {uuid} {ip} {reason} {country} {isp} {asn} {score} {sources} {platform} {version} {action} {action_id}。字段是按名称命名的条目,并按书写顺序显示。
值按原样写入,因此你需要放置反引号。Discord 将嵌入文本解析为 Markdown,而下划线是合法的 Minecraft 名称字符,因此如果没有代码块包裹,Some_Name 会显示为斜体,__Name__ 会显示为带下划线的删除线(下划线消失)。删除整个 embed 部分可保留 2.4 版本之前的布局。
网络存储
单个服务器无需设置——判决和信任存储在两个文件中。多个代理组成的网络应共享它们,这样每个地址只需为整个网络查找一次,而不是为每个代理查找一次:
storage:
type: redis # 也可以是 mysql, mariadb, postgresql, sqlite, h2, file, memory
redis:
host: "127.0.0.1"
port: 6379
password: ""
Redis 还推送无效化通知:在一个代理上对地址进行白名单操作或运行 /proxyshield clearcache 会立即在其他代理上生效,而不是等到条目过期。
ProxyShield 不捆绑任何数据库驱动程序或 Redis 库,因此不会将依赖项重定位到未请求它们的服务器中。大多数 Bukkit 服务器已经内置了 MySQL 和 SQLite 驱动;如果您的服务器没有,请将驱动 jar 包放入 ProxyShield 文件夹,并在 storage.sql.driver-path 下命名它。如果无法访问存储库,插件会提示一次并回退到文件存储——数据库故障绝不会导致登录中断。
PlaceholderAPI
当安装了 PlaceholderAPI 时,在 Bukkit 构建版中可用。每个占位符都会读取缓存,因此没有任何一个会阻塞主线程:
| 占位符 |
显示内容 |
%proxyshield_blocked% / %proxyshield_checked% |
自启动以来的计数器 |
%proxyshield_blocked_proxy% / %proxyshield_blocked_hosting% / %proxyshield_blocked_country% |
按原因拦截的数量 |
%proxyshield_country% / %proxyshield_isp% / %proxyshield_asn% |
玩家自身的地址信息 |
%proxyshield_is_proxy% / %proxyshield_is_hosting% / %proxyshield_score% |
对该地址的判定结果 |
%proxyshield_sources% |
标记该地址的服务来源 |
%proxyshield_trusted% |
玩家是否已获得豁免权 |
%proxyshield_mode% / %proxyshield_providers% / %proxyshield_storage% |
插件的配置设置 |
%proxyshield_cache_size% / %proxyshield_trusted_players% / %proxyshield_uptime% |
实时状态 |
Metrics
通过 bStats 发送匿名统计数据:服务器数量、平台类型、Java 版本以及正在使用的 ProxyShield 设置。不包含任何地址或玩家数据。公开页面位于 bstats.org,可通过 metrics.enabled: false 关闭。
其他插件的 API
if (ProxyShieldApi.isAvailable() && ProxyShieldApi.isProxy(address)) {
// 仅使用缓存,在主线程上安全
}
LookupResult result = ProxyShieldApi.lookup(address); // 阻塞式调用,仅限异步环境
boolean regular = ProxyShieldApi.isTrusted(uuid);
de.lucasthcr.bridgesave.proxyshield.api.ProxyShieldApi 是只读的:它只回答问题,永远不会更改判定结果或断开任何人的连接。
语言
所有面向玩家的文本都存储在 messages_en.yml 和 messages_de.yml 中。将 settings.language 指向您想要的语言文件。如需其他语言,请复制一个文件并重命名为 messages_<code>.yml,翻译后设置 settings.language: <code>。如果您删除了某个键值,它将回退到内置的英文默认值,因此旧版本的 message 文件在更新后仍可正常工作。
命令
所有这些命令都需要权限 proxyshield.admin。别名:/ps、/antivpn。
| 命令 |
功能 |
/proxyshield info |
显示版本、当前模式、查询模式和列表状态 |
/proxyshield providers |
列出所有启用的服务及其权重、健康状况和延迟 |
/proxyshield ping |
向每个提供商发起一次请求并显示响应时间 |
/proxyshield doctor |
检查配置并显示需要关注的问题 |
/proxyshield explain <player|ip> |
逐步解释为何拒绝或允许某个地址 |
/proxyshield allow <code> [minutes] |
根据踢出屏幕上的代码放行被拒玩家 |
/proxyshield stats |
显示检测计数、缓存状态和 webhook 状态 |
/proxyshield check <player|ip> |
运行完整流程并解释最终判定 |
/proxyshield lookup <player|ip> |
忽略缓存,执行新的提供商查询 |
/proxyshield whitelist <add|remove|info|list|purge> [entry] [time] [reason] |
管理永不拦截的白名单 |
/proxyshield blacklist <add|remove|info|list|purge> [entry] [time] [reason] |
管理始终拦截的黑名单 |
/proxyshield alts <player|ip> |
查看同一地址下的所有账号 |
/proxyshield refresh |
重新下载数据源 |
/proxyshield update [install] |
检查新版本,若带 install 参数则下载至更新文件夹 |
/proxyshield reporting [forget] |
显示上报状态,若带 forget 参数则清除已发送的所有数据 |
/proxyshield recheck |
重新检查所有在线玩家,断开不符合条件的玩家 |
/proxyshield clearcache |
清除缓存的查询结果 |
/proxyshield reload |
重新读取 config.yml 和消息文件 |
在游戏中添加的条目会保存在 whitelist.txt 和 blacklist.txt 中,重启后依然保留。从 config.yml 中添加的条目必须在该文件中移除。
/proxyshield check 是用于处理误报的工具:它会遍历整个流程并打印每一阶段的决策,以便您准确查看是哪条规则触发了拦截。
权限
| 节点 |
默认值 |
授予权限 |
proxyshield.bypass |
op |
跳过所有检查 |
proxyshield.notify |
op |
接收实时拦截警报 |
proxyshield.admin |
op |
使用 /proxyshield 命令 |
在 Paper、BungeeCord 和 Sponge 平台上,登录握手期间尚无权限数据存在,因此 proxyshield.bypass 仅对管理员生效。要在这些平台上实现可靠的豁免,请使用 whitelist.players 或 whitelist.ips。在 Velocity 中,玩家对象在 LoginEvent 阶段即可获取,权限可正常使用。
连接判定逻辑
严格按从上到下的顺序执行,首次匹配即生效。所有能 允许 玩家的条件都会在 拦截 条件之前进行评估,因此管理员始终可以通过白名单绕过误报。
| # |
检查项 |
结果 |
耗时 |
| 1 |
proxyshield.bypass 权限 |
允许 |
无 |
| 2 |
名称在 whitelist.players 中 |
允许 |
无 |
| 3 |
IP 在 whitelist.ips 中 |
允许 |
无 |
| 4 |
通过 Floodgate 连接的基岩版玩家 |
允许 |
无 |
| 5 |
回环地址或私有地址 |
允许 |
无 |
| 6 |
Bogon 地址 |
阻止 |
无 |
| 7 |
IP 在 blacklist.ips 中 |
阻止 |
无 |
| 8 |
IP 在下载的数据源中 |
阻止 |
~0.6 µs |
| 9 |
网络(ASN)或 ISP 规则 |
允许或 阻止 |
每个未缓存的 IP 一次 HTTP 请求 |
| 10 |
提供商报告为 proxy |
阻止 |
同上请求 |
| 11 |
提供商报告为 hosting |
阻止 |
同上请求 |
| 12 |
国家/地区不被允许 |
阻止 |
同上请求 |
| 13 |
超过连接限制 |
阻止 |
无 |
步骤 1 到 8 从不涉及网络。从步骤 9 开始,对于不在缓存中的每个地址,需要一次提供商查询请求,这也是为什么在大多数服务器上,缓存 TTL 比速率限制更重要。
性能
使用四个默认数据源进行测试(共 62,555 个条目编译成 35,161 个合并范围):
|
|
| 占用内存 |
1.3 MB |
| 启动解析 |
259 ms,在异步线程上执行 |
| 每次登录的数据源检查 |
589 ns |
| 1000 次登录 |
总计 0.59 ms,约等于 1/85 个游戏刻 |
提供商查找是唯一具有实际延迟的部分:通常为 50 到 200 ms,受 api.timeout-seconds 限制。它在所有平台上都在主线程之外运行,因此只会延迟该玩家的登录,而不会导致服务器卡顿。设置 detection.use-api: false 可启用纯数据源模式,每次登录零网络流量。
构建
需要 JDK 21 和 Maven。
mvn clean package
生成的 jar 文件位于 proxyshield-*/target/ 目录下;proxyshield-universal 包含发布版本。测试作为构建过程的一部分自动运行。
模块结构
proxyshield-common 检测核心,无平台 API,321 个测试
proxyshield-paper Bukkit 适配器 -> AsyncPlayerPreLoginEvent, Paper/Folia/Spigot
proxyshield-folia 与 proxyshield-paper 相同源码,独立的描述符和 jar 名称
proxyshield-bungee Bungee 适配器 -> LoginEvent with intents
proxyshield-velocity Velocity 适配器 -> LoginEvent with EventTask.async
proxyshield-sponge Sponge 适配器 -> ServerSideConnectionEvent.Auth
每个平台模块都阴影打包了 proxyshield-common,因此每个 jar 都是自包含的。Velocity 和 Sponge 构建还捆绑了一个重定位的 SnakeYAML,因为它们都不提供 YAML 配置 API,并且都读取与其他模块相同的 config.yml。
proxyshield-folia 没有添加任何自己的 Java 源代码。它通过 build-helper-maven-plugin 引入 proxyshield-paper/src/main/java,因此两个 jar 都是从同一份代码编译而来,修复措施永远不会只出现在其中一个中。
测试
mvn -pl proxyshield-common test
除了单元测试外,有两个测试值得了解:ShieldConfigTest 解析 jar 中实际附带的 config.yml,并断言阅读器期望的所有值;MessagesTest 断言两个捆绑的消息文件恰好定义了代码查找所需的所有键,且没有任何键或值被 YAML 的布尔类型强制转换所吞没。这两个测试在开发期间都捕获到了真实缺陷。
来自 1.1 版本的变更
请参阅 CHANGELOG.md。简要说明:在 v1 中,IP 数据源从未匹配到任何内容,因为 CIDR 前缀被丢弃了;代理检测是子字符串匹配;Webhook 负载可注入;BungeeCord 和 Velocity 在错误的线程上执行阻塞操作。
原始的 1.1 源代码保留在 legacy-1.1/ 下,原始反编译器输出保留在 decompiled/ 下以供参考。
许可证
GPL-3.0,见 LICENSE。
ProxyShield
Anti-VPN and anti-proxy protection for Minecraft servers. Country filtering, Discord webhook alerts,
a silent mode and a dry-run mode. One shared detection core that behaves identically everywhere.
It comes with its own free detection service, PaperStream Intel,
which is switched on out of the box: no key, no account. Since 3.2 a local copy of its database is
part of the plugin, so most players are decided on the server itself, without waiting for anybody.
Measured, not claimed
Numbers from mc-antivpn-bench, an open benchmark run
by another plugin author. ProxyShield 3.2.0 was measured with the same harness on Velocity before its
release, so these are our own runs, not part of the published table.
|
ProxyShield 3.2.0 |
| Bad addresses blocked (VPN, IPv6 VPN, new VPN servers, Tor, proxies) |
361 of 361 |
| Real players refused (home, IPv6 home, mobile) |
0 of 306 |
| Stress test, 1,000 players in 20 seconds |
1,000 of 1,000 checked |
| Single join, 95th percentile |
289 ms |
| Repeat join, median |
under 4 ms |
| Lookups for 100 joins from one address |
1 |
| Start-up until protected |
6.5 s |
Download
There is one file for every platform: ProxyShield-Universal-<version>.jar.
| Runs on |
Put it in |
| Paper, Purpur and Spigot 1.21+, Folia |
plugins/ |
| BungeeCord / Waterfall |
plugins/ |
| Velocity 3.3+ |
plugins/ |
| Sponge (SpongeAPI 17) |
mods/ |
The jar carries all four entry points and all four plugin descriptors at once. Every server reads
the descriptor it knows and ignores the rest, so the same file works on a single server and on a
whole network. Versions before 3.0.2 were also published as one jar per platform. Those files are
still listed under the older releases.
Spigot is supported by the same jar. Paper and Folia offer AsyncScheduler, a per-entity scheduler
and Adventure components; Spigot has none of the three. The jar picks an implementation at start-up,
and the Paper-only types live in a class that is never loaded on a server without them.
Install one jar, on the machine that accepts the connection. On a network that is the proxy
(BungeeCord or Velocity). The Paper build behind a proxy would only ever see the proxy's own
address.
Showcase
A short demonstration of the checks, the verdict and what a blocked connection looks like.
Features
Detection
- 27 IP intelligence services built in, enabled by name - 16 of them need no API key at all
- PaperStream Intel as the first provider: network type, country and ASN from a daily feed, VPN,
proxy and Tor lists, and addresses other ProxyShield servers reported
- The server lists that VPN operators publish themselves (Mullvad, IVPN, NordVPN, Private Internet
Access), including IPv6 relays that no public list knows. A hit refuses the player at once
- Offline network feed: home and mobile networks are told apart from hosting networks without a
request per player, so a quota that runs out does not open the door
- Consensus scoring: several providers are asked at once and their weights added up, so one service
that has never heard of a VPN cannot clear it, and one noisy service cannot kick anybody alone
- Public VPN, datacenter and Tor exit feeds with correct CIDR matching, IPv4 and IPv6
- Network (ASN) block and allow rules, which catch a VPN's new range before any feed lists it,
plus downloadable ASN lists that refresh on their own
- ISP filter with regular expressions, to block a hoster or always admit a mobile carrier
- Conditions on any provider's answer (
risk.score >= 85, connection.type = mobile) and
custom request headers, so an unlisted service can be wired in exactly
- Bogon addresses refused outright
- Reverse DNS patterns as a signal - free, unlimited, and effective on ranges nobody has catalogued
- Behavioural heuristics: join rate per subnet, accounts per address, an account changing country
- Trust for regulars, so a tightened rule or a provider having a bad day does not kick your players
- Country filtering, blacklist or whitelist mode
- Manual blacklist, checked before everything else
- Connection limit per address, by players online or within a time window
- Configurable fail-open or fail-closed behaviour when a check cannot complete
- Automatic fast admit: while many players join at once, addresses in home networks skip the
provider lookup and keep the quota for the rest, so a join wave does not wear the services out
Exemptions
- IP whitelist accepting single addresses, CIDR blocks and ranges
- Player name whitelist
- Bypass permission
- Loopback and private addresses are never checked, and never cost lookup quota
- Bedrock players joining through Geyser/Floodgate are checked with their real address, which
Floodgate passes on.
whitelist.geyser-addresses admits a Geyser server that shows up with its
own address instead
Operations
- Dry-run mode: detect and report without disconnecting anybody
- Passive mode: no checks at login, lookups on demand only
- Restricted servers on BungeeCord and Velocity: keep a flagged player in the lobby instead of
disconnecting them
- Whitelist and blacklist entries with a reason and an expiry
/proxyshield alts lists every account seen on the same address
- Debug output with every provider's raw answer
- Console commands on a detection, so a flagged player can be marked or restricted instead of kicked
/proxyshield check shows what every single provider said, so a false positive can be traced
- Lookup cache survives restarts and reloads; simultaneous logins from one address share one query
- Shared storage for a network: MySQL, MariaDB, PostgreSQL, SQLite, H2 or Redis
- PlaceholderAPI support and anonymous bStats metrics
- Silent mode: no staff or console alerts, while the log file and webhook keep recording
- Discord webhook with queueing, retry and rate-limit handling, and a layout you write yourself
- Telegram and VK alerts
- Block log at
plugins/ProxyShield/blocks.log
- Full
/proxyshield command set with tab completion
- Update check in the console (once every 12 hours, nothing about your server is sent) and on
request with
/proxyshield update; on Paper, Folia and Spigot the new jar can be downloaded into
the update folder automatically, if you switch that on
config.yml upgrades itself on start: new options appear with their comments, nothing you
deleted comes back and no value you changed is touched
- Optional reporting to PaperStream Intel, off by default
- Local copy of the PaperStream Intel database, refreshed daily and signed, so VPN, Tor and hosting
addresses are refused without a request
- Plain reasons on the kick screen ("datacenter network (Hetzner Online GmbH)", "Tor network") and an
appeal code a player can give to staff, cleared with
/proxyshield allow <code>
/proxyshield doctor checks the setup, /proxyshield explain walks through one verdict step by
step, /proxyshield ping measures every provider live
- Weekly report to the Discord webhook: joins checked, players refused, providers that failed
- Optional learning phase after the first start (
detection.learn-hours): nobody is kicked, the
console says afterwards how many would have been
- English and German out of the box, any language by copying one file
Getting started
- Drop the jar into
plugins/ (mods/ on Sponge) and start the server once.
- Edit
plugins/ProxyShield/config.yml.
- Run
/proxyshield reload.
Recommended first run: leave detection.dry-run: true for a day and watch blocks.log. It records
what would have been blocked without disconnecting anybody, which is the cheapest way to find false
positives before they hit real players.
Providers and scoring
Enable a service by name. The fifteen listed as free need no key at all:
api:
mode: consensus # or failover
required-score: 1.5
providers:
ip-api: { enabled: true, weight: 1.0 }
blackbox: { enabled: true, weight: 1.0 }
ipapi-is: { enabled: true, weight: 1.5 }
proxycheck: { enabled: false, weight: 2.0, key: "" }
In consensus mode every enabled provider is asked at once and the weights of those flagging the
address are added up. At required-score: 1.5 a single strong provider is enough, or any two weaker
ones, or one weak provider plus a reverse DNS hit. Raise it to 2.5 if you would rather miss a VPN
than kick a real player; lower it to 1.0 to block on any single hit.
This does not multiply your quota the way it looks. Answers are cached (IPv6 folded to its /64),
simultaneous logins from one address share one lookup, the fan-out stops the moment the score is
reached, the cache survives restarts and reloads, and a provider that starts failing is dropped from
the rotation until it recovers.
A service the catalog does not know can be described directly in config.yml with a URL and dotted
field paths - see the commented example at the bottom of the providers section.
PaperStream Intel
PaperStream Intel is our own free anti-VPN service and the first provider in the list. It answers
from a network feed that is rebuilt every night, from public VPN, datacenter, Tor and proxy lists,
from the server lists the VPN operators publish, and from addresses that other ProxyShield servers
reported. No key and no account, 600 requests a minute per address.
Reporting is optional and off by default. With reporting.enabled: true the addresses that the
providers refused as proxies are sent in batches every 10 minutes, together with a random install
id. No player names, no UUIDs, no server address. The service keeps them for 14 days and counts on
how many servers an address showed up; from 3 servers it votes "proxy" for everybody.
/proxyshield reporting shows the state and /proxyshield reporting forget deletes everything that
was sent. Details are in the privacy policy.
Country filtering
country:
enabled: true
mode: whitelist # only these countries may connect
codes: ["DE", "AT", "CH"]
block-unknown: false
Set mode: blacklist to invert it. Country data comes from the lookup provider, so country.enabled
triggers a provider query even when detection.use-api is off.
Silent mode
notifications:
silent: true
Suppresses the staff broadcast and the console line. The log file and the webhook still record every
detection, so you keep the data without announcing to everyone online that the filter fired.
Commands on a detection
Not every server wants a flagged player gone. To mark them instead, run whatever you would have run
by hand:
detection:
dry-run: true
actions:
on-flag:
- "lp user {player} permission set myserver.vpnflagged true"
- "webhook {player} flagged {reason} from {ip}"
delay-seconds: 3
run-when: always
With dry-run on, the detection still fires, the alert and the webhook still go out and these
commands still run, but the player stays connected. That is the flag-instead-of-kick setup: put them
in a restricted group, make them verify through Discord, hand the name to another plugin.
Commands run as the console, with or without a leading slash. Available placeholders are
{player}, {uuid}, {ip}, {reason}, {reason_id}, {country}, {isp}, {asn}, {score},
{sources}, {action} and {platform}.
delay-seconds matters more than it looks. A connection is judged before the player is on the
server, so at 0 the commands run while they are still connecting. That is fine for a permission
grant or a webhook, but anything that needs them actually online, such as messaging them or
prompting them to link an account, needs a few seconds here.
run-when accepts always, kicked or allowed when the commands should only fire for players
who were disconnected, or only for those who were not.
Discord webhook
discord:
enabled: true
webhook-url: "https://discord.com/api/webhooks/..."
show-ip: true
show-ip: false posts hidden instead of the address. Only https:// URLs are accepted.
The message layout is yours to write. By default it is a title and six inline boxes; clear the
fields and write a description instead:
discord:
embed:
title: "`{player}`"
description: |
```ansi
IP: `{ip}`
Country: {country}
Action: {action}
```
thumbnail: "https://your-server.example/alert.gif"
fields: {}
Placeholders: {player} {uuid} {ip} {reason} {country} {isp} {asn} {score}
{sources} {platform} {version} {action} {action_id}. Fields are named entries and appear
in the order written.
Values go in exactly as written, so you place the backticks. Discord parses embed text as Markdown
and an underscore is a legal Minecraft name character, so without a code span Some_Name shows up
italic and __Name__ underlined with the underscores gone. Deleting the whole embed section
keeps the layout from before 2.4.
Storage on a network
One server needs no setup - verdicts and trust live in two files. A network of several proxies
should share them, so each address is looked up once for the whole network instead of once per
proxy:
storage:
type: redis # or mysql, mariadb, postgresql, sqlite, h2, file, memory
redis:
host: "127.0.0.1"
port: 6379
password: ""
Redis also pushes invalidations: whitelisting an address or running /proxyshield clearcache on one
proxy takes effect on the others immediately, rather than when the entry expires.
ProxyShield bundles no database driver and no Redis library, so nothing is relocated into a server
that did not ask for it. Most Bukkit servers already have a MySQL and a SQLite driver; if yours does
not, drop the driver jar into the ProxyShield folder and name it under storage.sql.driver-path. If
the store cannot be reached, the plugin says so once and falls back to file storage - a database
outage never becomes a login outage.
PlaceholderAPI
Available on the Bukkit builds when PlaceholderAPI is installed. Every placeholder reads the cache,
so none of them can stall the main thread:
| Placeholder |
Shows |
%proxyshield_blocked% / %proxyshield_checked% |
Counters since start-up |
%proxyshield_blocked_proxy% / %proxyshield_blocked_hosting% / %proxyshield_blocked_country% |
Blocks by reason |
%proxyshield_country% / %proxyshield_isp% / %proxyshield_asn% |
The player's own address |
%proxyshield_is_proxy% / %proxyshield_is_hosting% / %proxyshield_score% |
The verdict on it |
%proxyshield_sources% |
Which services flagged it |
%proxyshield_trusted% |
Whether the player has earned an exemption |
%proxyshield_mode% / %proxyshield_providers% / %proxyshield_storage% |
How the plugin is set up |
%proxyshield_cache_size% / %proxyshield_trusted_players% / %proxyshield_uptime% |
Live state |
Metrics
Anonymous statistics through bStats: server count, platform, Java version and which ProxyShield
settings are in use. No addresses and no player data. Public at
bstats.org, and switched off with
metrics.enabled: false.
API for other plugins
if (ProxyShieldApi.isAvailable() && ProxyShieldApi.isProxy(address)) {
// cache-only, safe on the main thread
}
LookupResult result = ProxyShieldApi.lookup(address); // blocking, async only
boolean regular = ProxyShieldApi.isTrusted(uuid);
de.lucasthcr.bridgesave.proxyshield.api.ProxyShieldApi is read-only: it answers questions, it never
changes a verdict or disconnects anybody.
Language
All player facing text lives in messages_en.yml and messages_de.yml. Point settings.language at
the one you want. For another language, copy a file to messages_<code>.yml, translate it and set
settings.language: <code>. Any key you delete falls back to the built-in English, so a message file
from an older version keeps working after an update.
Commands
All of these need proxyshield.admin. Aliases: /ps, /antivpn.
| Command |
Does |
/proxyshield info |
Version, active mode, lookup mode and list status |
/proxyshield providers |
Every enabled service with its weight, health and latency |
/proxyshield ping |
Asks every provider once and shows its response time |
/proxyshield doctor |
Checks the setup and shows what needs attention |
/proxyshield explain <player|ip> |
Step by step why an address is refused or let in |
/proxyshield allow <code> [minutes] |
Lets a refused player in by the code on their kick screen |
/proxyshield stats |
Detection counters, cache and webhook state |
/proxyshield check <player|ip> |
Runs the full pipeline and explains the verdict |
/proxyshield lookup <player|ip> |
Fresh provider lookup, ignoring the cache |
/proxyshield whitelist <add|remove|info|list|purge> [entry] [time] [reason] |
Manage the never-block list |
/proxyshield blacklist <add|remove|info|list|purge> [entry] [time] [reason] |
Manage the always-block list |
/proxyshield alts <player|ip> |
Every account seen on the same address |
/proxyshield refresh |
Re-download the feeds |
/proxyshield update [install] |
Check for a new version, install downloads it into the update folder |
/proxyshield reporting [forget] |
Show the state of reporting, forget deletes everything sent so far |
/proxyshield recheck |
Re-check everyone online, disconnect whoever fails |
/proxyshield clearcache |
Drop cached lookup results |
/proxyshield reload |
Re-read config.yml and the message file |
Entries added in game are stored in whitelist.txt and blacklist.txt and survive restarts.
Entries that came from config.yml have to be removed there.
/proxyshield check is the tool for a false-positive report: it walks the whole pipeline and prints
what each stage decided, so you can see exactly which rule fired.
Permissions
| Node |
Default |
Grants |
proxyshield.bypass |
op |
Skip every check |
proxyshield.notify |
op |
Receive live block alerts |
proxyshield.admin |
op |
Use /proxyshield |
On Paper, BungeeCord and Sponge no permission data exists yet during the login handshake, so
proxyshield.bypass only resolves for operators there. For reliable exemptions on those platforms
use whitelist.players or whitelist.ips. On Velocity the player object is available at
LoginEvent and the permission works normally.
How a connection is decided
Strictly top to bottom, first match wins. Everything that can allow a player is evaluated before
anything that can block one, so an operator can always whitelist their way out of a false positive.
| # |
Check |
Result |
Cost |
| 1 |
proxyshield.bypass permission |
allow |
none |
| 2 |
Name in whitelist.players |
allow |
none |
| 3 |
IP in whitelist.ips |
allow |
none |
| 4 |
Bedrock player via Floodgate |
allow |
none |
| 5 |
Loopback or private address |
allow |
none |
| 6 |
Bogon address |
block |
none |
| 7 |
IP in blacklist.ips |
block |
none |
| 8 |
IP in a downloaded feed |
block |
~0.6 µs |
| 9 |
Network (ASN) or ISP rule |
allow or block |
one HTTP request per uncached IP |
| 10 |
Provider reports proxy |
block |
same request |
| 11 |
Provider reports hosting |
block |
same request |
| 12 |
Country not permitted |
block |
same request |
| 13 |
Over the connection limit |
block |
none |
Steps 1 to 8 never touch the network. Step 9 onwards costs one provider request per address that is
not in the cache, which is why the cache TTL matters more than the rate limit on most servers.
Performance
Measured with the four default feeds (62,555 entries compiled into 35,161 merged ranges):
|
|
| Memory held |
1.3 MB |
| Startup parse |
259 ms, on an async thread |
| Feed check per login |
589 ns |
| 1000 logins |
0.59 ms total, about 1/85th of one tick |
The provider lookup is the only part with real latency: typically 50 to 200 ms, capped by
api.timeout-seconds. It runs off the main thread on every platform, so it delays that one player's
login and never the server tick. Set detection.use-api: false for a pure feed setup with zero
network traffic per login.
Building
Requires JDK 21 and Maven.
mvn clean package
The jars land in proxyshield-*/target/; proxyshield-universal holds the one that is published. Tests run as part of the build.
Module layout
proxyshield-common detection core, no platform APIs, 321 tests
proxyshield-paper Bukkit adapter -> AsyncPlayerPreLoginEvent, Paper/Folia/Spigot
proxyshield-folia same sources as proxyshield-paper, own descriptor and jar name
proxyshield-bungee Bungee adapter -> LoginEvent with intents
proxyshield-velocity Velocity adapter -> LoginEvent with EventTask.async
proxyshield-sponge Sponge adapter -> ServerSideConnectionEvent.Auth
Each platform module shades proxyshield-common, so every jar is self-contained. The Velocity and
Sponge builds also bundle a relocated SnakeYAML, because neither exposes a YAML config API and both
read the same config.yml as the others.
proxyshield-folia adds no Java sources of its own. It pulls in proxyshield-paper/src/main/java
with build-helper-maven-plugin, so both jars are compiled from one copy of the code and a fix can
never land in only one of them.
Tests
mvn -pl proxyshield-common test
Beyond the unit tests, two of them are worth knowing about: ShieldConfigTest parses the
config.yml that actually ships in the jar and asserts every value the reader expects, and
MessagesTest asserts that both bundled message files define exactly the keys the code looks up and
that no key or value is swallowed by YAML's boolean coercion. Both of those caught real defects
during development.
Changes from 1.1
See CHANGELOG.md. The short version: the IP feeds never matched anything in v1
because the CIDR prefix was thrown away, proxy detection was a substring test, the webhook payload
was injectable, and BungeeCord and Velocity did blocking work on the wrong thread.
The original 1.1 sources are kept under legacy-1.1/ and the raw decompiler output under
decompiled/ for reference.
Licence
GPL-3.0, see LICENSE.
评论 0
登录后参与评分
还没有评论,来抢沙发吧