Skip to content

Commit cf542f7

Browse files
committed
added:random mode for proxy support
1 parent f61cc32 commit cf542f7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

XEngine_Source/XEngine_ServiceApp/XEngine_ProxyTask.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ bool XEngine_Proxy_Connect(LPCXSTR lpszClientAddr)
6767
APIAddr_IPAddr_SegAddr(tszDstIPAddr, &nDstPort);
6868
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("Proxy客户端:%s,代理转发规则地址未命中,使用HASH规则,规则地址:%s:%d"), lpszClientAddr, tszDstIPAddr, nDstPort);
6969
}
70+
else if (2 == st_ServiceConfig.st_XProxy.nRuleMode)
71+
{
72+
XNETHANDLE xhIndex = 0;
73+
BaseLib_Handle_Create(&xhIndex, 0, st_ServiceConfig.st_XProxy.pStl_ListDestAddr->size());
74+
auto stl_ListIterator = st_ServiceConfig.st_XProxy.pStl_ListDestAddr->begin();
75+
std::advance(stl_ListIterator, xhIndex);
76+
_tcsxcpy(tszIPAddr, stl_ListIterator->c_str());
77+
_tcsxcpy(tszDstIPAddr, stl_ListIterator->c_str());
78+
APIAddr_IPAddr_SegAddr(tszDstIPAddr, &nDstPort);
79+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("Proxy客户端:%s,代理转发规则地址未命中,使用随机规则,规则地址:%s:%d"), lpszClientAddr, tszDstIPAddr, nDstPort);
80+
}
7081
}
7182
if (!XClient_TCPSelect_InsertEx(xhProxyClient, &xhClient, tszDstIPAddr, nDstPort, false))
7283
{

0 commit comments

Comments
 (0)