mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 06:36:24 +00:00
feat(Core/Network): Add Proxy Protocol v2 support. (#18839)
* feat(Core/Network): Add Proxy Protocol v2 support. * Fix codestyle and build. * Another codestyle fix. * One more missing include.
This commit is contained in:
committed by
GitHub
parent
715b290cb7
commit
9815025341
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "AuthSession.h"
|
||||
#include "SocketMgr.h"
|
||||
#include "Config.h"
|
||||
|
||||
class AuthSocketMgr : public SocketMgr<AuthSession>
|
||||
{
|
||||
@@ -44,7 +45,13 @@ public:
|
||||
protected:
|
||||
NetworkThread<AuthSession>* CreateThreads() const override
|
||||
{
|
||||
return new NetworkThread<AuthSession>[1];
|
||||
NetworkThread<AuthSession>* threads = new NetworkThread<AuthSession>[1];
|
||||
|
||||
bool proxyProtocolEnabled = sConfigMgr->GetOption<bool>("EnableProxyProtocol", false, true);
|
||||
if (proxyProtocolEnabled)
|
||||
threads[0].EnableProxyProtocol();
|
||||
|
||||
return threads;
|
||||
}
|
||||
|
||||
static void OnSocketAccept(tcp::socket&& sock, uint32 threadIndex)
|
||||
|
||||
@@ -64,6 +64,16 @@ RealmServerPort = 3724
|
||||
|
||||
BindIP = "0.0.0.0"
|
||||
|
||||
#
|
||||
# EnableProxyProtocol
|
||||
# Description: Enables Proxy Protocol v2. When your server is behind a proxy,
|
||||
# load balancer, or similar component, you need to enable Proxy Protocol v2 on both
|
||||
# this server and the proxy/load balancer to track the real IP address of players.
|
||||
# Example: 1 - (Enabled)
|
||||
# Default: 0 - (Disabled)
|
||||
|
||||
EnableProxyProtocol = 0
|
||||
|
||||
#
|
||||
# PidFile
|
||||
# Description: Auth server PID file.
|
||||
|
||||
Reference in New Issue
Block a user