Перейти к содержимому
Mineforgian

NG HaProxy Support

Adds HAProxy protocol support to Forge servers. See real player IPs behind Velocity, TCPShield, FRP, and Nginx proxies. Features hot-reload config, status command, and connection logging.

Загрузки
267
Подписчики
3
Обновлён
15 марта 2026 г.
Лицензия
MIT

Опубликован 19 декабря 2025 г.

NG Proxy Support

Adds HAProxy PROXY protocol support to your Minecraft Forge server.

See real player IP addresses when your server is behind a proxy like Velocity, TCPShield, FRP, Nginx, or any other HAProxy-compatible reverse proxy.


Features

  • HAProxy PROXY Protocol v1/v2 — Full support for both protocol versions
  • Real IP Resolution — Players connecting through a proxy will show their real IP in server logs, bans, and plugins
  • Hybrid Mode — Supports both proxied and direct connections simultaneously
  • Fail-Closed Security — Connections from unknown IPs are automatically rejected, preventing proxy bypass attacks
  • CIDR Notation — Whitelist entire subnets (e.g. 192.168.0.0/16)
  • TCPShield Integration — Automatically fetch and whitelist TCPShield server IPs
  • Hot-Reload Config — Reload configuration without restarting the server
  • Status Command — View current configuration and connection stats in-game
  • Connection Logging — Log real player IPs and proxy IPs to a dedicated log file

Commands

Command Permission Description
/proxyprotocol reload OP Level 4 Reload config without restart
/proxyprotocol status OP Level 4 View current config and active rules

Configuration

Config file: config/proxy_protocol_support.json

{
  "enableProxyProtocol": true,
  "proxyServerIPs": ["127.0.0.1"],
  "directAccessIPs": ["127.0.0.1", "192.168.0.0/16"],
  "whitelistTCPShieldServers": false,
  "logConnections": true
}
Option Description
enableProxyProtocol Enable/disable the mod entirely
proxyServerIPs IPs of your proxy servers (Velocity, HAProxy, etc.) — PROXY headers will only be accepted from these IPs
directAccessIPs IPs allowed to connect directly without PROXY headers
whitelistTCPShieldServers Auto-fetch TCPShield IPs and add them to proxy whitelist
logConnections Log real IP and proxy IP to logs/proxy_connections.log

How It Works

Player → Proxy (Velocity/HAProxy/FRP) → Forge Server (with NG Proxy Support)
                                          ↓
                                   Reads PROXY header
                                   Extracts real IP
                                   Sets player address
  1. Your proxy sends a PROXY protocol header with the real client IP
  2. NG Proxy Support intercepts incoming connections and reads the header
  3. The player's address is set to their real IP instead of the proxy IP
  4. All server logs, ban systems, and plugins see the correct IP

Security Model

NG Proxy Support uses a fail-closed model:

  • ✅ Connections from proxyServerIPs → PROXY header is read, real IP is extracted
  • ✅ Connections from directAccessIPs → Allowed without PROXY header
  • ❌ Connections from any other IP → Automatically rejected

This prevents players from bypassing your proxy to connect directly and spoof their IP.

Setup Guide

With Velocity

  1. Install NG Proxy Support on your Forge server
  2. Enable PROXY protocol in Velocity's velocity.toml:
   [advanced]
   haproxy-protocol = true
  1. Add your Velocity server IP to proxyServerIPs in the mod config
  2. Restart both servers

With HAProxy / Nginx / FRP

  1. Configure your reverse proxy to send PROXY protocol headers
  2. Add the proxy IP to proxyServerIPs
  3. Restart the Forge server

Requirements

  • Minecraft 1.20.1
  • Forge 47.x
  • Java 17+
  • Server-side only (no client mod needed)

Credits

Made by xylos | © 2024-2026 All rights reserved

Ченджлог

1.0.0Релиз1.20.1 · 15 марта 2026 г.

Release Date: 2026-02-15
Minecraft: 1.20.1 | Forge: 47.x | Java: 17+
License: MIT


🎉 Initial Release

First public release of NG Proxy Support for Minecraft Forge 1.20.1.
Ported from the Fabric mod proxy-protocol-support with new features and improvements.


✨ Features

  • HAProxy PROXY Protocol v1/v2 — full support for both protocol versions
  • Real IP Resolution — players connecting via proxy show their real IP in logs, bans, and plugins
  • Hybrid Mode — supports both proxied and direct connections simultaneously
  • Fail-Closed Security — unknown IPs are automatically rejected to prevent proxy bypass
  • CIDR Notation — whitelist entire subnets (e.g. 192.168.0.0/16)
  • TCPShield Integration — auto-fetch and whitelist TCPShield server IPs
  • Hot-Reload Config/proxyprotocol reload reloads config without server restart
  • Status Command/proxyprotocol status shows current config and active rules in-game
  • Connection Logging — logs real player IPs and proxy IPs to logs/proxy_connections.log

🔧 Configuration

Config file: config/proxy_protocol_support.json

Option Default Description
enableProxyProtocol true Enable/disable the mod
proxyServerIPs ["127.0.0.1"] Trusted proxy IPs
directAccessIPs ["127.0.0.1", "192.168.0.0/16"] IPs allowed to connect directly
whitelistTCPShieldServers false Auto-fetch TCPShield IPs
logConnections true Log connections to file

🛡️ Commands

Command Permission Description
/proxyprotocol reload OP 4 Reload config without restart
/proxyprotocol status OP 4 View current configuration

🔗 Compatible Proxies

  • Velocity (with haproxy-protocol = true)
  • TCPShield
  • HAProxy
  • Nginx (with proxy_protocol on)
  • FRP
  • Any HAProxy-compatible reverse proxy

Author: xylos
© 2024-2026 xylos. Licensed under MIT.

1.0.0Альфа1.20.1 · 19 декабря 2025 г.

🚀 Major Features

🛡️ Advanced Proxy Protocol Support

  • NEW: Complete HAProxy PROXY protocol v1/v2 implementation
  • Seamless integration with reverse proxies (HAProxy, Nginx, Velocity)
  • Real player IP detection behind proxies
  • Zero client-side requirements (server-only mod)
  • Production-ready security model

🔒 Connection Security System

Connection Throttling:

  • Per-IP rate limiting to prevent flooding
  • Configurable threshold (default: 5 connections/second)
  • Automatic cleanup of old tracking data
  • Thread-safe concurrent handling
  • Minimal memory footprint

IP Validation:

  • CIDR notation support for flexible IP ranges
  • Trusted proxy whitelist system
  • Direct access whitelist for local connections
  • Fail-closed security (unknown IPs rejected by default)
  • Auto-whitelist RFC1918 private networks (10.x, 172.16-31.x, 192.168.x)

TCPShield Integration:

  • Automatic TCPShield server list fetching
  • Configurable cache duration (default: 60 minutes)
  • IPv4 and Cloudflare endpoint support
  • Auto-retry on fetch failures

📊 Analytics & Monitoring

Real-Time Metrics:

  • Total connection attempts counter
  • Proxied connections tracker
  • Direct connections tracker
  • Rejected connections logger
  • Throttled connections monitor
  • Malformed headers detector
  • Server uptime calculator

Detailed Logging:

  • Verbose mode for debugging
  • Color-coded log levels
  • Connection decision logging
  • IP matching results
  • Beautiful startup banner
  • Configuration summary display

🔧 Technical Implementation

Code Architecture:

  • ✅ Clean package structure (net.ssbaxy.proxycore)
  • ✅ Separated concerns (core, network, security, analytics, mixins)
  • ✅ Thread-safe concurrent operations
  • ✅ Optimized memory usage
  • ✅ High-performance Netty pipeline integration

Configuration System:

  • ✅ JSON-based configuration file
  • ✅ 15+ configurable options
  • ✅ Auto-generated default config
  • ✅ Hot-reload support
  • ✅ Future-proof feature flags

Mixin Integration:

  • ✅ Non-invasive server hooks
  • ✅ ServerConnectionListener injection
  • ✅ Connection address modification
  • ✅ Pipeline initialization wrapper

📦 Technical Details

  • Version: 1.0.0
  • Build Date: 2025-12-19
  • File Size: ~35 KB
  • Minecraft: 1.20.1
  • Forge: 47.2.0+
  • Java: 17+
  • License: MIT

Dependencies:

  • Netty HAProxy Codec 4.1.108.Final
  • Apache Commons IO 2.15.1
  • Gson 2.10.1

New Files:

  • ProxyCoreForge.java - Mod entry point
  • ModCore.java - Core initialization
  • ServerConfiguration.java - Config model
  • ConfigurationManager.java - Config loader
  • IPValidator.java - CIDR validator
  • ConnectionThrottle.java - Rate limiter
  • ConnectionMetrics.java - Analytics
  • TCPShieldProvider.java - TCPShield integration
  • ConnectionPipeline.java - Network pipeline
  • ProxyProtocolDecoder.java - Protocol decoder
  • PipelineInvoker.java - Mixin invoker
  • AddressModifier.java - Address accessor
  • ServerConnectionMixin.java - Connection hook

🎯 What's Included

Core Functionality:

  • ✅ HAProxy PROXY protocol v1/v2 parsing
  • ✅ Real IP address extraction
  • ✅ Connection pipeline modification
  • ✅ Fail-closed security model
  • ✅ CIDR notation support

Security Features:

  • ✅ Connection rate limiting
  • ✅ IP whitelist system
  • ✅ Trusted proxy validation
  • ✅ Auto-reject unauthorized IPs
  • ✅ Private network auto-whitelist

Monitoring & Analytics:

  • ✅ Real-time connection metrics
  • ✅ Detailed event logging
  • ✅ Verbose debug mode
  • ✅ Performance statistics
  • ✅ Uptime tracking

Configuration Options:

  • ✅ Enable/disable proxy protocol
  • ✅ Trusted proxy IP list
  • ✅ Direct access IP list
  • ✅ TCPShield auto-whitelist
  • ✅ Verbose logging toggle
  • ✅ Rate limiting toggle
  • ✅ Max connections per second
  • ✅ Metrics enable/disable
  • ✅ Custom rejection message
  • ✅ Auto-whitelist private networks
  • ✅ Future feature flags (VPN blocking, GeoIP, etc.)

🖼️ Configuration Example

Basic Setup (Behind HAProxy):

{
  "enableProxyProtocol": true,
  "proxyServerIPs": ["YOUR_HAPROXY_IP"],
  "directAccessIPs": ["127.0.0.1"],
  "enableRateLimiting": true,
  "maxConnectionsPerSecond": 10,
  "enableMetrics": true
}

TCPShield Protected Server:

{
  "enableProxyProtocol": true,
  "whitelistTCPShieldServers": true,
  "directAccessIPs": ["127.0.0.1"],
  "enableRateLimiting": true,
  "tcpShieldCacheDurationMinutes": 120
}

Development/Testing:

{
  "enableProxyProtocol": true,
  "proxyServerIPs": ["127.0.0.1"],
  "directAccessIPs": ["127.0.0.1", "192.168.0.0/16"],
  "verboseLogging": true,
  "autoWhitelistPrivateNetworks": true
}

📖 Usage

Installation:

  1. Download falaxy_haproxy-1.0.0.jar
  2. Place in server mods/ folder
  3. Start server to generate config
  4. Edit config/falaxy_haproxy.json
  5. Restart server

Configuring Proxy:

  • HAProxy: Add send-proxy-v2 to backend server
  • Nginx: Use proxy_protocol on; directive
  • TCPShield: Enable in mod config
  • Velocity/BungeeCord: Enable proxy protocol support

Monitoring:

  • Check server logs for connection events
  • Enable verbose logging for detailed info
  • Monitor metrics in logs
  • Review rejected connections

⚡ Performance

  • Memory Overhead: < 1 MB (with 1000+ tracked IPs)
  • CPU Impact: < 0.1% on modern servers
  • Connection Latency: < 1ms additional processing
  • Thread Safety: Fully concurrent, no blocking
  • Scalability: Tested with 1000+ simultaneous connections

🔄 Compatibility

Full server-side mod

  • No client installation required
  • Works on dedicated servers
  • Compatible with Forge 47.2.0+
  • Java 17+ required

Proxy Compatibility:

  • HAProxy 1.5+ (PROXY protocol v1/v2)
  • Nginx with proxy_protocol
  • TCPShield
  • Velocity with proxy protocol
  • BungeeCord with proxy protocol plugin

⚠️ Important Notes

Security:

  • Always use fail-closed mode (default)
  • Only whitelist trusted proxy IPs
  • Enable rate limiting on public servers
  • Monitor rejected connections regularly
  • Keep TCPShield cache reasonable (60-120 min)

Performance:

  • Verbose logging impacts performance - use only for debugging
  • Rate limiting adds minimal overhead
  • Metrics collection is lightweight
  • Auto-cleanup runs every 10 seconds

Configuration:

  • Config auto-generates on first run
  • Use CIDR notation for IP ranges
  • Restart required after config changes
  • Test in development before production

🎨 Log Output Example

[INFO] ═══════════════════════════════════════════
[INFO]  Falaxy HaProxy Support v1.0.0
[INFO]  Author: SSbaxyS
[INFO]  Build Date: 2025-12-19
[INFO]  Minecraft: 1.20.1 | Forge: 47.2.0+
[INFO] ═══════════════════════════════════════════
[INFO] ✓ Connection throttling: 10 conn/sec per IP
[INFO] ✓ Analytics enabled
[INFO] ✓ Auto-whitelisting RFC1918 private networks
[INFO] ◆ TCPShield integration active - fetching server list...
[INFO] ✓ Added 42 TCPShield servers
[INFO] → Trusted proxies loaded: 43
[INFO] → Direct access rules: 3
[INFO] ═══════════════════════════════════════════
[INFO] ✓ ProxyCore initialized successfully
[INFO] ═══════════════════════════════════════════
[DEBUG] [PROXY] Accepted: 10.0.0.1
[DEBUG] [DIRECT] Accepted: 192.168.1.100
[WARN] [THROTTLE] Blocked: 203.0.113.50
[WARN] [REJECT] Unauthorized: 198.51.100.25

This is the inaugural release with comprehensive proxy protocol support! 🛡️

Installation Notes:

  • Replace any existing proxy mods
  • Config file: config/falaxy_haproxy.json
  • All settings customizable
  • Restart after config changes

Why Use This:

  • 🛡️ Production-ready security!
  • ⚡ High-performance implementation!
  • 📊 Built-in monitoring & analytics!
  • 🔧 Flexible configuration!
  • 🚀 Active development!

Author: SSbaxyS Build Date: 2025-12-19 License: MIT

Enjoy secure and reliable HaProxy PROXY protocol support! 🎮✨

Комментарии

Загружаем…