# HAProxy-Detector **Repository Path**: clm_liming/HAProxy-Detector ## Basic Information - **Project Name**: HAProxy-Detector - **Description**: 优秀的项目,fork一下学习学习 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-01 - **Last Updated**: 2024-04-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # HAProxyDetector [![](https://img.shields.io/github/downloads/HaHaWTH/HAProxy-Detector/total?style=for-the-badge)](https://github.com/HaHaWTH/HAProxy-Detector/releases) [![](https://img.shields.io/github/license/HaHaWTH/HAProxy-Detector?style=for-the-badge)](https://github.com/HaHaWTH/HAProxy-Detector/blob/master/LICENSE) [![](https://img.shields.io/bstats/servers/21070?label=Spigot%20Servers&style=for-the-badge)](https://bstats.org/plugin/bukkit/HAProxyDetector/21070) [![](https://img.shields.io/bstats/servers/12605?label=BC%20Servers&style=for-the-badge)](https://bstats.org/plugin/bungeecord/HAProxyDetector/12605) [![](https://img.shields.io/bstats/servers/14442?label=Velocity%20Servers&style=for-the-badge)](https://bstats.org/plugin/velocity/HAProxyDetector/14442) This [BungeeCord](https://github.com/SpigotMC/BungeeCord/) (and now [Spigot](https://www.spigotmc.org/wiki/spigot/) and [Velocity](https://papermc.io/software/velocity/)) plugin enables proxied and direct connections both at the same time. More information about [HAProxy](https://www.haproxy.org/) and its uses can be found [here](https://github.com/MinelinkNetwork/BungeeProxy/blob/master/README.md). **Originally made by Andylizi** { 插件原作者:Andylizi 目前由HaHaWTH(github)进行维护和更新 我(clm)觉得这是个优秀的项目,所以fork来学习学习 对于这里的项目,{ } 里的内容表示非原项目有的,是我后来添加进去的。 } { 我为了方便自己理解,从其他地方找一些原项目没有的注意事项添加进来(不是我自己写的): 本Spigot/Bungeecord/Velocity插件可以让你的服务器同时支持直连和通过跨服连接/获取内网穿透背后玩家的真实IP 获取真实IP功能需要在frpc.ini配置打开haproxy!!! 只需要在代理配置中增加一行 proxy_protocol_version = v2 即可开启此功能 } ## Security Warning Allowing both direct and proxied connections has significant security implications — a malicious player can access the server through their own HAProxy instance, thus tricking the server into believing the connection is coming from a fake IP. To counter this, this plugin implements IP whitelisting. **By default, only proxied connections from `localhost` will be allowed** (direct connections aren't affected). You can add the IP/domain of your trusted HAProxy instance by editing `whitelist.conf`, which can be found under the plugin data folder.
Details of the whitelist format ``` # List of allowed proxy IPs # # An empty whitelist will disallow all proxies. # Each entry must be an valid IP address, domain name or CIDR. # Domain names will be resolved only once at startup. # Each domain can have multiple A/AAAA records, all of them will be allowed. # CIDR prefixes are not allowed in domain names. 127.0.0.0/8 ::1/128 ``` If you want to disable the whitelist (which you should never do), you can do so by putting this line verbatim, before any other entries: ``` YesIReallyWantToDisableWhitelistItsExtremelyDangerousButIKnowWhatIAmDoing!!! ```
## Platform-specific Notes #### BungeeCord `proxy_protocol` needs to be enabled in BC `config.yml` for this plugin to work. (Not to be confused with the similar option in `paper.yml`) Older versions of BC can in theory use [BungeeProxy](https://github.com/MinelinkNetwork/BungeeProxy) in parallel with this plugin, but it hasn't been tested yet. Feedback is welcomed. #### Spigot and its derivatives [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997/) is a required dependency. This plugin was developed using ProtocolLib 5.0. #### Paper New versions of Paper have built-in HAProxy support (proxied connection only). It's not compatible with this plugin, so please disable the `proxy-protocol` option in `paper.yml`. #### Velocity `haproxy-protocol` needs to be enabled in Velocity config for this plugin to work. Versions older than 3.0 are not supported. #### Java >= 9 **No need to use this, ImagineBreaker has already wiped it** If errors like `NoClassDefFoundError: sun.misc.Unsafe`, `InaccessibleObjectException` and such are encountered, please add `--add-opens java.base/java.lang.invoke=ALL-UNNAMED` to JVM arguments. #### Java >= 18 **No need to use this, ImagineBreaker has already wiped it** If errors like `IllegalAccessException: static final field has no write access` are encountered, please upgrade the plugin to at least v3.0.2. If you cannot upgrade for whatever reason, a temporary workaround would be to add `-Djdk.reflect.useDirectMethodHandle=false` to JVM arguments. Note that this argument will be removed in future Java releases. ## Metrics This plugin uses [bStats](https://bStats.org) for metrics. It collects some basic information, like how many people use this plugin and the total player count. You can opt out at any time by editing the config file under `plugins/bStats/`.