ProxyShield
面向 Minecraft 服务器的反 VPN 和反代理防护。支持国家过滤、Discord Webhook 警报、静默模式和干跑模式。拥有统一的检测核心,在所有平台上行为一致。
下载
每个平台都有一个对应的文件:ProxyShield-Universal-<version>.jar。
| 运行环境 |
放置位置 |
| Paper, Purpur 和 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 独有的类型被封装在一个永远不会在非 Paper 服务器上加载的类中。
在接收连接的机器上安装一个 JAR 包即可。在网络环境中,这通常是代理服务器(BungeeCord 或 Velocity)。如果将 Paper 构建放在代理后面,它将只能看到代理自身的地址。
展示
简要演示检查过程、判定结果以及被阻止的连接外观。
功能
检测
- 内置 26 个 IP 情报服务,可按名称启用——其中 15 个完全不需要 API 密钥
- 共识评分机制:同时向多个提供商发起查询并将权重相加,确保从未听说过某 VPN 的服务无法将其放行,且嘈杂的服务无法单独踢出任何玩家
- 公共 VPN、数据中心和 Tor 出口节点数据源,支持正确的 CIDR 匹配,涵盖 IPv4 和 IPv6
- 网络(ASN)黑名单和白名单规则,可在任何数据源列出之前捕获 VPN 的新网段,并附带可自动刷新的 ASN 列表供下载
- 基于正则表达式的 ISP 过滤器,用于屏蔽主机商或始终允许移动运营商
- 针对任意提供商返回值的条件判断(如
risk.score >= 85、connection.type = mobile)及自定义请求头,以便精确接入未列入清单的服务
- 直接拒绝 Bogon 地址
- 反向 DNS 模式作为信号源——免费、无限制,且在未编目的网段上非常有效
- 行为启发式规则:子网内的加入频率、单地址下的账户数量、账户变更国家等
- 对常客建立信任,防止因规则收紧或某提供商状态不佳而误踢玩家
- 国家过滤,支持黑名单或白名单模式
- 手动黑名单,优先级最高,在其他检查之前执行
- 按在线玩家数或时间窗口限制单地址连接数
- 当检查无法完成时,可配置为“失败开放”或“失败关闭”行为
豁免
- IP 白名单,支持单个地址、CIDR 块和范围
- 玩家名称白名单
- 绕过权限
- 回环地址和私有地址永不进行检查,也不消耗查询配额
- 默认情况下,通过 Geyser/Floodgate 加入的 Bedrock 玩家享有豁免权
运维
- 试运行模式:检测并报告,但不断开任何人的连接
- 被动模式:登录时不进行检查,仅在需要时进行查询
- BungeeCord 和 Velocity 上的受限服务器:将标记的玩家保留在大厅中,而不是将其踢出
- 白名单和黑名单条目包含原因和过期时间
/proxyshield alts 列出同一地址上看到的每个账号
- 调试输出显示每个提供者的原始回答
- 检测到时的控制台命令,以便标记或限制玩家,而不是直接踢出
/proxyshield check 显示每个提供者的具体说法,以便追踪误报
- 查找缓存在重启和重载后依然存在;来自同一地址的同时登录共享一次查询
- 网络共享存储:MySQL、MariaDB、PostgreSQL、SQLite、H2 或 Redis
- PlaceholderAPI 支持和匿名 bStats 指标
- 静默模式:不向工作人员或控制台发送警报,但日志文件和 Webhook 仍会记录
- Discord Webhook,支持队列、重试和速率限制处理,以及由你自定义的布局
- Telegram 和 VK 警报
- 拦截日志位于
plugins/ProxyShield/blocks.log
- 完整的
/proxyshield 命令集,支持标签补全
- 内置英语和德语,通过复制一个文件即可添加任意语言
开始使用
- 将 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 部分底部的注释示例。
国家过滤
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% |
实时状态 |
指标
通过 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> 设置为对应的代码。如果你删除了任何键,它将回退到内置英文,因此来自旧版本的配置文件在更新后仍可正常工作。
命令
所有这些命令都需要权限 proxyshield.admin。别名:/ps、/antivpn。
| 命令 |
功能 |
/proxyshield info |
版本、活动模式、查找模式和列表状态 |
/proxyshield providers |
每个启用的服务及其权重、健康状况和延迟 |
/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 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 权限 |
allow |
none |
| 2 |
名称在 whitelist.players 中 |
allow |
none |
| 3 |
IP 在 whitelist.ips 中 |
allow |
none |
| 4 |
通过 Floodgate 连接的基岩版玩家 |
allow |
none |
| 5 |
回环地址或私有地址 |
allow |
none |
| 6 |
Bogon 地址 |
block |
none |
| 7 |
IP 在 blacklist.ips 中 |
block |
none |
| 8 |
IP 在下载的数据源中 |
block |
~0.6 µs |
| 9 |
网络 (ASN) 或 ISP 规则 |
allow or block |
每个未缓存的 IP 一次 HTTP 请求 |
| 10 |
提供商报告 proxy |
block |
同上请求 |
| 11 |
提供商报告 hosting |
block |
同上请求 |
| 12 |
国家不在允许列表中 |
block |
同上请求 |
| 13 |
超过连接限制 |
block |
none |
步骤 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,124 个测试
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.
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
- 26 IP intelligence services built in, enabled by name - 15 of them need no API key at all
- 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
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 exempt by default
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
- 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.
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 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 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, 124 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
登录后参与评分
还没有评论,来抢沙发吧