parent
1a4c76d333
commit
ded3b28a9e
File diff suppressed because it is too large
Load Diff
|
@ -65,7 +65,7 @@ public partial class MainForm : Form
|
|||
string.Format("{0:yyyyMMdd}", DateTime.Now) + ".log";
|
||||
//NetTunnelLib.InitTunnelSDKLog(path, LogLevel.LOG_DEBUG);
|
||||
NetTunnelLib.TunnelSDKInitEnv(Environment.CurrentDirectory, "http://xajhuang.com:9276", path, LogLevel.LOG_DEBUG, menuSetModeServer.Checked);
|
||||
|
||||
NetTunnelLib.EnableSCGProxy(true, "efc.xajhuang.com", 10000);
|
||||
GetCurrentNetCard();
|
||||
|
||||
NetCardMenuItems menuItems = new NetCardMenuItems(_curNetCard);
|
||||
|
@ -108,14 +108,6 @@ public partial class MainForm : Form
|
|||
Marshal.FreeCoTaskMem(pt);
|
||||
}
|
||||
|
||||
private void test_create_wg_key()
|
||||
{
|
||||
var buffer = new StringBuilder(64 + 1);
|
||||
var buffer2 = new StringBuilder(64 + 1);
|
||||
var v = NetTunnelLib.GenerateWireguardKeyPairs(buffer, 64, buffer2, 64);
|
||||
lstLogs.Items.Add(v.ToString() + ": [" + buffer.ToString() + "] / [" + buffer2.ToString() + "]");
|
||||
}
|
||||
|
||||
private void test_create_wg_svr_cfg()
|
||||
{
|
||||
WgSvrConfig wsg = new WgSvrConfig();
|
||||
|
|
|
@ -181,10 +181,6 @@ public class NetTunnelLib
|
|||
|
||||
[DllImport("NetTunnelSDK.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SetProtocolEncryptType(ProtoCryptoType type, String pProKey);
|
||||
|
||||
[DllImport("NetTunnelSDK.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int GenerateWireguardKeyPairs(StringBuilder wgPubKey, int maxPubKey, StringBuilder wgPrivKey,
|
||||
int MaxPrivKey);
|
||||
|
||||
[DllImport("NetTunnelSDK.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int GetAllNICInfo(out IntPtr netCard, ref int size);
|
||||
|
@ -229,6 +225,12 @@ public class NetTunnelLib
|
|||
[DllImport("NetTunnelSDK.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void SetCurrentNetShareMode(NET_SHARE_MODE shareMode);
|
||||
|
||||
[DllImport("NetTunnelSDK.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int EnableSCGProxy(bool isEnable, String proxyIp, int proxyPort);
|
||||
|
||||
[DllImport("NetTunnelSDK.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool UsedSCGProxy();
|
||||
|
||||
//[DllImport("NetTunnelSDK.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
//public static extern int RunPipeCmd(String pszCmd, StringBuilder pszResultBuffer, int dwResultBufferSize);
|
||||
}
|
|
@ -45,6 +45,7 @@
|
|||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
|
@ -114,16 +115,20 @@
|
|||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>.\depends\WinDivert\include;.\include;.\depends\WireGuardNT\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalLibraryDirectories>.\WinDivert\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /y $(TargetDir)*.dll $(SolutionDir)\NetTunnelApp\bin\$(ConfigurationName)\
|
||||
<Command>copy /y $(ProjectDir)depends\tunnel\amd64\tunnel.dll $(TargetDir)
|
||||
copy /y $(ProjectDir)depends\WireGuardNT\amd64\wireguard.dll $(TargetDir)
|
||||
copy /y $(TargetDir)fmtd.dll $(SolutionDir)NetTunnelApp\bin\$(ConfigurationName)\
|
||||
copy /y $(TargetDir)NetTunnelSDK.dll $(SolutionDir)NetTunnelApp\bin\$(ConfigurationName)\
|
||||
|
||||
|
||||
</Command>
|
||||
|
@ -149,47 +154,41 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AIGCJson.hpp" />
|
||||
<ClInclude Include="common.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="globalcfg.h" />
|
||||
<ClInclude Include="httplib.h" />
|
||||
<ClInclude Include="misc.h" />
|
||||
<ClInclude Include="network.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="protocol.h" />
|
||||
<ClInclude Include="ProtocolBase.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="tunnel.h" />
|
||||
<ClInclude Include="user.h" />
|
||||
<ClInclude Include="usrerr.h" />
|
||||
<ClInclude Include="WinDivert\include\windivert.h" />
|
||||
<ClInclude Include="include\AIGCJson.hpp" />
|
||||
<ClInclude Include="include\common.h" />
|
||||
<ClInclude Include="include\framework.h" />
|
||||
<ClInclude Include="include\globalcfg.h" />
|
||||
<ClInclude Include="include\httplib.h" />
|
||||
<ClInclude Include="include\misc.h" />
|
||||
<ClInclude Include="include\network.h" />
|
||||
<ClInclude Include="include\pch.h" />
|
||||
<ClInclude Include="include\protocol.h" />
|
||||
<ClInclude Include="include\ProtocolBase.h" />
|
||||
<ClInclude Include="include\resource.h" />
|
||||
<ClInclude Include="include\tunnel.h" />
|
||||
<ClInclude Include="include\user.h" />
|
||||
<ClInclude Include="include\usrerr.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ControlService.cpp" />
|
||||
<ClCompile Include="crypto.cpp" />
|
||||
<ClCompile Include="crypto\crypto.cpp" />
|
||||
<ClCompile Include="crypto\HashDigest.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="HashDigest.cpp" />
|
||||
<ClCompile Include="ipcalc.cpp" />
|
||||
<ClCompile Include="misc.cpp" />
|
||||
<ClCompile Include="network.cpp" />
|
||||
<ClCompile Include="misc\ipcalc.cpp" />
|
||||
<ClCompile Include="misc\misc.cpp" />
|
||||
<ClCompile Include="network\ControlService.cpp" />
|
||||
<ClCompile Include="network\network.cpp" />
|
||||
<ClCompile Include="network\ProxyService.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="protocol.cpp" />
|
||||
<ClCompile Include="ProtocolBase.cpp" />
|
||||
<ClCompile Include="ProxyService.cpp" />
|
||||
<ClCompile Include="tunnel.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="protocol\protocol.cpp" />
|
||||
<ClCompile Include="tunnel\tunnel.cpp" />
|
||||
<ClCompile Include="tunnel\wireguard.cpp" />
|
||||
<ClCompile Include="tunnel\WireGuardService.cpp" />
|
||||
<ClCompile Include="UserManager.cpp" />
|
||||
<ClCompile Include="wireguard.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WireguardService.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
<Filter Include="源文件\crypto">
|
||||
<UniqueIdentifier>{1111b68b-34f2-49fa-8116-de5ae65603b6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\wireguard">
|
||||
<UniqueIdentifier>{7b591f9a-0c91-4e23-a6b2-bc3b5b25f008}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\network">
|
||||
<UniqueIdentifier>{f2474544-0d85-457c-a448-afdaaa4130d3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -37,51 +34,54 @@
|
|||
<Filter Include="头文件\http">
|
||||
<UniqueIdentifier>{f13f3513-264f-4e1a-a1c8-4b5cc9e8af5c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\misc">
|
||||
<UniqueIdentifier>{d3c17cbd-a724-43a2-8090-2fb15f62f88e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\tunnel">
|
||||
<UniqueIdentifier>{7b591f9a-0c91-4e23-a6b2-bc3b5b25f008}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="misc.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tunnel.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="usrerr.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="globalcfg.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="user.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ProtocolBase.h">
|
||||
<Filter>头文件\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protocol.h">
|
||||
<Filter>头文件\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AIGCJson.hpp">
|
||||
<Filter>头文件\json</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="httplib.h">
|
||||
<ClInclude Include="include\httplib.h">
|
||||
<Filter>头文件\http</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WinDivert\include\windivert.h">
|
||||
<ClInclude Include="include\AIGCJson.hpp">
|
||||
<Filter>头文件\json</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\protocol.h">
|
||||
<Filter>头文件\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\ProtocolBase.h">
|
||||
<Filter>头文件\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\common.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="common.h">
|
||||
<ClInclude Include="include\framework.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\globalcfg.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\misc.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\network.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\pch.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\resource.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\tunnel.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\user.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\usrerr.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
@ -92,44 +92,41 @@
|
|||
<ClCompile Include="pch.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tunnel.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="misc.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HashDigest.cpp">
|
||||
<Filter>源文件\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="crypto.cpp">
|
||||
<Filter>源文件\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wireguard.cpp">
|
||||
<Filter>源文件\wireguard</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network.cpp">
|
||||
<Filter>源文件\network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserManager.cpp">
|
||||
<Filter>源文件\user</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ProtocolBase.cpp">
|
||||
<ClCompile Include="misc\ipcalc.cpp">
|
||||
<Filter>源文件\misc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="misc\misc.cpp">
|
||||
<Filter>源文件\misc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="protocol\protocol.cpp">
|
||||
<Filter>源文件\protocol</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="protocol.cpp">
|
||||
<Filter>源文件\protocol</Filter>
|
||||
<ClCompile Include="crypto\crypto.cpp">
|
||||
<Filter>源文件\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ControlService.cpp">
|
||||
<ClCompile Include="crypto\HashDigest.cpp">
|
||||
<Filter>源文件\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\ControlService.cpp">
|
||||
<Filter>源文件\network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ipcalc.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ProxyService.cpp">
|
||||
<ClCompile Include="network\network.cpp">
|
||||
<Filter>源文件\network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WireguardService.cpp">
|
||||
<Filter>源文件\wireguard</Filter>
|
||||
<ClCompile Include="network\ProxyService.cpp">
|
||||
<Filter>源文件\network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tunnel\tunnel.cpp">
|
||||
<Filter>源文件\tunnel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tunnel\wireguard.cpp">
|
||||
<Filter>源文件\tunnel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tunnel\WireGuardService.cpp">
|
||||
<Filter>源文件\tunnel</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#include "pch.h"
|
||||
#include "ProtocolBase.h"
|
|
@ -1,126 +0,0 @@
|
|||
#include "pch.h"
|
||||
#include "WinDivert/include/windivert.h"
|
||||
|
||||
#include <strsafe.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "globalcfg.h"
|
||||
#include "usrerr.h"
|
||||
|
||||
#pragma comment(lib, "WinDivert.lib")
|
||||
|
||||
typedef struct {
|
||||
bool isRunning;
|
||||
HANDLE proxyThread;
|
||||
HANDLE proxyHandle;
|
||||
bool isExitSvr;
|
||||
} UDP_PROXY_CTX, *PUDP_PROXY_CTX;
|
||||
|
||||
typedef struct {
|
||||
TCHAR streamFilter[1024];
|
||||
TCHAR targetIp[MAX_IP_LEN];
|
||||
UINT16 targetPort;
|
||||
int vmId;
|
||||
int svrId;
|
||||
UDP_PROXY_CTX udpCtx;
|
||||
} PROXY_INFO, *PPROXY_INFO;
|
||||
|
||||
|
||||
static std::unordered_map<std::string, PPROXY_INFO> g_ProxyColleagues;
|
||||
|
||||
|
||||
int CreatePorxyService(const TCHAR *pTargetIp, int targetPort, int vmId, int svrId) {
|
||||
//int CreatePorxyService() {
|
||||
//int ret;
|
||||
static HANDLE hDriver;
|
||||
PPROXY_INFO pInfo;
|
||||
std::string key;
|
||||
std::unordered_map<std::string, PPROXY_INFO>::iterator iter;
|
||||
|
||||
// 查找先前代理是否存在
|
||||
key = std::string(pTargetIp) + ":" + std::to_string(targetPort);
|
||||
|
||||
if ((iter = g_ProxyColleagues.find(key)) != g_ProxyColleagues.end()) {
|
||||
pInfo = iter->second;
|
||||
// 如果配置完全相同则直接返回
|
||||
if (pInfo->vmId == vmId && pInfo->svrId == svrId) {
|
||||
return ERR_SUCCESS;
|
||||
} else {
|
||||
pInfo->vmId = vmId;
|
||||
pInfo->svrId = svrId;
|
||||
}
|
||||
} else {
|
||||
// 创建新的代理配置
|
||||
pInfo = static_cast<PPROXY_INFO>(HeapAlloc(GetProcessHeap(), 0, sizeof(PROXY_INFO)));
|
||||
|
||||
if (pInfo == nullptr) {
|
||||
SPDLOG_ERROR(TEXT("Error allocating {0} bytes memory "), sizeof(PROXY_INFO));
|
||||
return -ERR_MALLOC_MEMORY;
|
||||
}
|
||||
|
||||
memset(pInfo, 0, sizeof(PROXY_INFO));
|
||||
}
|
||||
|
||||
memset(pInfo->streamFilter, 0, 1024);
|
||||
|
||||
StringCbPrintf(pInfo->streamFilter, 1024, TEXT("(udp.DstPort == %d and )"), targetPort);
|
||||
|
||||
hDriver = WinDivertOpen(pInfo->streamFilter, WINDIVERT_LAYER_NETWORK, 0, 0);
|
||||
|
||||
if (hDriver == INVALID_HANDLE_VALUE) {
|
||||
//ERROR_INSUFFICIENT_BUFFER
|
||||
SPDLOG_ERROR(TEXT("Open Driver With Filter \"{1}\" Error: {0}"), GetLastError(), pInfo->streamFilter);
|
||||
return -ERR_SYS_CALL;
|
||||
}
|
||||
|
||||
CreateThread(
|
||||
nullptr, // Thread attributes
|
||||
0, // Stack size (0 = use default)
|
||||
[](LPVOID lpParameter) {
|
||||
const HANDLE h = lpParameter;
|
||||
unsigned char packet[2048];
|
||||
UINT packet_len;
|
||||
WINDIVERT_ADDRESS addr;
|
||||
|
||||
while (true) {
|
||||
if (!WinDivertRecv(h, packet, 0xFFFF, &packet_len, &addr)) {
|
||||
SPDLOG_ERROR(TEXT("failed to read packet ({0})"), GetLastError());
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (addr.Event) {
|
||||
case WINDIVERT_EVENT_SOCKET_BIND:
|
||||
SPDLOG_ERROR("BIND");
|
||||
break;
|
||||
case WINDIVERT_EVENT_SOCKET_LISTEN:
|
||||
|
||||
SPDLOG_ERROR("LISTEN");
|
||||
break;
|
||||
case WINDIVERT_EVENT_SOCKET_CONNECT:
|
||||
|
||||
SPDLOG_ERROR("CONNECT: {0:x}, {1:x}", addr.Socket.EndpointId, addr.Socket.ParentEndpointId);
|
||||
break;
|
||||
case WINDIVERT_EVENT_SOCKET_ACCEPT:
|
||||
|
||||
SPDLOG_ERROR("ACCEPT");
|
||||
break;
|
||||
case WINDIVERT_EVENT_SOCKET_CLOSE:
|
||||
|
||||
SPDLOG_ERROR("CLOSE: {0:x}, {1:x}", addr.Socket.EndpointId, addr.Socket.ParentEndpointId);
|
||||
break;
|
||||
default:
|
||||
SPDLOG_ERROR(TEXT("***({0})"), static_cast<int>(addr.Event));
|
||||
break;
|
||||
}
|
||||
|
||||
/*if (!WinDivertSendEx(h, packet, packet_len, nullptr, 0, &addr, sizeof(WINDIVERT_ADDRESS), nullptr)) {
|
||||
SPDLOG_ERROR(TEXT("warning: failed to reinject packet ({0})\n"), GetLastError());
|
||||
}*/
|
||||
}
|
||||
|
||||
return static_cast<DWORD>(0);
|
||||
}, // Thread start address
|
||||
hDriver, // Parameter to pass to the thread
|
||||
0, // Creation flags
|
||||
nullptr); // Thread id
|
||||
return 0;
|
||||
}
|
|
@ -356,16 +356,6 @@ int SetTunnelConfigure(const TCHAR *pCliPrivateKey,
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (GetCurrentNetShareMode() == NAT_SHARE_MODE) {
|
||||
// 清理旧的 NAT 配置
|
||||
if ((ret = RemoveNATRule(GetGlobalCfgInfo()->userCfg.userName)) != ERR_SUCCESS) {
|
||||
SPDLOG_ERROR(TEXT("Call GetNetIntelnetConnectionSharing error: {0}"), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = GetIpV4InfoFromCIDR(pSvrTunnelAddr, &tunnelInfo);
|
||||
|
||||
if (ret != ERR_SUCCESS) {
|
||||
|
@ -384,7 +374,12 @@ int SetTunnelConfigure(const TCHAR *pCliPrivateKey,
|
|||
StringCbCopy(cliCfg.PrivateKey, 64, pCliPrivateKey);
|
||||
StringCbCopy(cliCfg.Address, 32, pCliNetwork);
|
||||
StringCbCopy(cliCfg.SvrPubKey, 64, pSvrPublicKey);
|
||||
StringCbCopy(cliCfg.ServerURL, 256, pSvrEndPoint);
|
||||
if (UsedSCGProxy()) {
|
||||
StringCbPrintf(cliCfg.ServerURL, 256, TEXT("127.0.0.1:%d"), GetGlobalCfgInfo()->scgProxy.proxyPort);
|
||||
} else {
|
||||
StringCbCopy(cliCfg.ServerURL, 256, pSvrEndPoint);
|
||||
}
|
||||
|
||||
StringCbPrintf(cliCfg.AllowNet,
|
||||
256,
|
||||
TEXT("%s/%d,%s/%d"),
|
||||
|
@ -455,7 +450,7 @@ int GetUserClientConfigure(const TCHAR *pUserName, const TCHAR *pToken, PUSER_CL
|
|||
ProtocolRequest<ReqGetUserCfgParams> req;
|
||||
ProtocolResponse<RspUsrCliConfigParams> rsp;
|
||||
|
||||
if (pUserName == nullptr || lstrlen(pUserName) == 0) {
|
||||
if (pUserName == nullptr || lstrlen(pUserName) == 0) {
|
||||
SPDLOG_ERROR(TEXT("Input pUserName params error: {0}"), pUserName);
|
||||
return -ERR_INPUT_PARAMS;
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,308 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 OR MIT
|
||||
*
|
||||
* Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <ipexport.h>
|
||||
#include <ifdef.h>
|
||||
#include <ws2ipdef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef ALIGNED
|
||||
# if defined(_MSC_VER)
|
||||
# define ALIGNED(n) __declspec(align(n))
|
||||
# elif defined(__GNUC__)
|
||||
# define ALIGNED(n) __attribute__((aligned(n)))
|
||||
# else
|
||||
# error "Unable to define ALIGNED"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MinGW is missing this one, unfortunately. */
|
||||
#ifndef _Post_maybenull_
|
||||
# define _Post_maybenull_
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4324) /* structure was padded due to alignment specifier */
|
||||
|
||||
/**
|
||||
* A handle representing WireGuard adapter
|
||||
*/
|
||||
typedef struct _WIREGUARD_ADAPTER *WIREGUARD_ADAPTER_HANDLE;
|
||||
|
||||
/**
|
||||
* Creates a new WireGuard adapter.
|
||||
*
|
||||
* @param Name The requested name of the adapter. Zero-terminated string of up to MAX_ADAPTER_NAME-1
|
||||
* characters.
|
||||
*
|
||||
* @param TunnelType Name of the adapter tunnel type. Zero-terminated string of up to MAX_ADAPTER_NAME-1
|
||||
* characters.
|
||||
*
|
||||
* @param RequestedGUID The GUID of the created network adapter, which then influences NLA generation deterministically.
|
||||
* If it is set to NULL, the GUID is chosen by the system at random, and hence a new NLA entry is
|
||||
* created for each new adapter. It is called "requested" GUID because the API it uses is
|
||||
* completely undocumented, and so there could be minor interesting complications with its usage.
|
||||
*
|
||||
* @return If the function succeeds, the return value is the adapter handle. Must be released with
|
||||
* WireGuardCloseAdapter. If the function fails, the return value is NULL. To get extended error information, call
|
||||
* GetLastError.
|
||||
*/
|
||||
typedef _Must_inspect_result_
|
||||
_Return_type_success_(return != NULL)
|
||||
_Post_maybenull_
|
||||
WIREGUARD_ADAPTER_HANDLE(WINAPI WIREGUARD_CREATE_ADAPTER_FUNC)
|
||||
(_In_z_ LPCWSTR Name, _In_z_ LPCWSTR TunnelType, _In_opt_ const GUID *RequestedGUID);
|
||||
|
||||
/**
|
||||
* Opens an existing WireGuard adapter.
|
||||
*
|
||||
* @param Name The requested name of the adapter. Zero-terminated string of up to MAX_ADAPTER_NAME-1
|
||||
* characters.
|
||||
*
|
||||
* @return If the function succeeds, the return value is the adapter handle. Must be released with
|
||||
* WireGuardCloseAdapter. If the function fails, the return value is NULL. To get extended error information, call
|
||||
* GetLastError.
|
||||
*/
|
||||
typedef _Must_inspect_result_
|
||||
_Return_type_success_(return != NULL)
|
||||
_Post_maybenull_
|
||||
WIREGUARD_ADAPTER_HANDLE(WINAPI WIREGUARD_OPEN_ADAPTER_FUNC)(_In_z_ LPCWSTR Name);
|
||||
|
||||
/**
|
||||
* Releases WireGuard adapter resources and, if adapter was created with WireGuardCreateAdapter, removes adapter.
|
||||
*
|
||||
* @param Adapter Adapter handle obtained with WireGuardCreateAdapter or WireGuardOpenAdapter.
|
||||
*/
|
||||
typedef VOID(WINAPI WIREGUARD_CLOSE_ADAPTER_FUNC)(_In_opt_ WIREGUARD_ADAPTER_HANDLE Adapter);
|
||||
|
||||
/**
|
||||
* Deletes the WireGuard driver if there are no more adapters in use.
|
||||
*
|
||||
* @return If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To
|
||||
* get extended error information, call GetLastError.
|
||||
*/
|
||||
typedef _Return_type_success_(return != FALSE)
|
||||
BOOL(WINAPI WIREGUARD_DELETE_DRIVER_FUNC)(VOID);
|
||||
|
||||
/**
|
||||
* Returns the LUID of the adapter.
|
||||
*
|
||||
* @param Adapter Adapter handle obtained with WireGuardCreateAdapter or WireGuardOpenAdapter
|
||||
*
|
||||
* @param Luid Pointer to LUID to receive adapter LUID.
|
||||
*/
|
||||
typedef VOID(WINAPI WIREGUARD_GET_ADAPTER_LUID_FUNC)(_In_ WIREGUARD_ADAPTER_HANDLE Adapter, _Out_ NET_LUID *Luid);
|
||||
|
||||
/**
|
||||
* Determines the version of the WireGuard driver currently loaded.
|
||||
*
|
||||
* @return If the function succeeds, the return value is the version number. If the function fails, the return value is
|
||||
* zero. To get extended error information, call GetLastError. Possible errors include the following:
|
||||
* ERROR_FILE_NOT_FOUND WireGuard not loaded
|
||||
*/
|
||||
typedef _Return_type_success_(return != 0)
|
||||
DWORD(WINAPI WIREGUARD_GET_RUNNING_DRIVER_VERSION_FUNC)(VOID);
|
||||
|
||||
/**
|
||||
* Determines the level of logging, passed to WIREGUARD_LOGGER_CALLBACK.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WIREGUARD_LOG_INFO, /**< Informational */
|
||||
WIREGUARD_LOG_WARN, /**< Warning */
|
||||
WIREGUARD_LOG_ERR /**< Error */
|
||||
} WIREGUARD_LOGGER_LEVEL;
|
||||
|
||||
/**
|
||||
* Called by internal logger to report diagnostic messages
|
||||
*
|
||||
* @param Level Message level.
|
||||
*
|
||||
* @param Timestamp Message timestamp in in 100ns intervals since 1601-01-01 UTC.
|
||||
*
|
||||
* @param Message Message text.
|
||||
*/
|
||||
typedef VOID(CALLBACK *WIREGUARD_LOGGER_CALLBACK)(
|
||||
_In_ WIREGUARD_LOGGER_LEVEL Level,
|
||||
_In_ DWORD64 Timestamp,
|
||||
_In_z_ LPCWSTR Message);
|
||||
|
||||
/**
|
||||
* Sets logger callback function.
|
||||
*
|
||||
* @param NewLogger Pointer to callback function to use as a new global logger. NewLogger may be called from various
|
||||
* threads concurrently. Should the logging require serialization, you must handle serialization in
|
||||
* NewLogger. Set to NULL to disable.
|
||||
*/
|
||||
typedef VOID(WINAPI WIREGUARD_SET_LOGGER_FUNC)(_In_ WIREGUARD_LOGGER_CALLBACK NewLogger);
|
||||
|
||||
/**
|
||||
* Whether and how logs from the driver are collected for the callback function.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WIREGUARD_ADAPTER_LOG_OFF, /**< No logs are generated from the driver. */
|
||||
WIREGUARD_ADAPTER_LOG_ON, /**< Logs are generated from the driver. */
|
||||
WIREGUARD_ADAPTER_LOG_ON_WITH_PREFIX /**< Logs are generated from the driver, index-prefixed. */
|
||||
} WIREGUARD_ADAPTER_LOG_STATE;
|
||||
|
||||
/**
|
||||
* Sets whether and how the adapter logs to the logger previously set up with WireGuardSetLogger.
|
||||
*
|
||||
* @param Adapter Adapter handle obtained with WireGuardCreateAdapter or WireGuardOpenAdapter
|
||||
*
|
||||
* @param LogState Adapter logging state.
|
||||
*
|
||||
* @return If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To
|
||||
* get extended error information, call GetLastError.
|
||||
*/
|
||||
typedef _Return_type_success_(return != FALSE)
|
||||
BOOL(WINAPI WIREGUARD_SET_ADAPTER_LOGGING_FUNC)
|
||||
(_In_ WIREGUARD_ADAPTER_HANDLE Adapter, _In_ WIREGUARD_ADAPTER_LOG_STATE LogState);
|
||||
|
||||
/**
|
||||
* Determines the state of the adapter.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WIREGUARD_ADAPTER_STATE_DOWN, /**< Down */
|
||||
WIREGUARD_ADAPTER_STATE_UP, /**< Up */
|
||||
} WIREGUARD_ADAPTER_STATE;
|
||||
|
||||
/**
|
||||
* Sets the adapter state of the WireGuard adapter. Note: sockets are owned by the process that sets the state to up.
|
||||
*
|
||||
* @param Adapter Adapter handle obtained with WireGuardCreateAdapter or WireGuardOpenAdapter
|
||||
*
|
||||
* @param State Adapter state.
|
||||
*
|
||||
* @return If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To
|
||||
* get extended error information, call GetLastError.
|
||||
*/
|
||||
typedef _Return_type_success_(return != FALSE)
|
||||
BOOL(WINAPI WIREGUARD_SET_ADAPTER_STATE_FUNC)
|
||||
(_In_ WIREGUARD_ADAPTER_HANDLE Adapter, _In_ WIREGUARD_ADAPTER_STATE State);
|
||||
|
||||
/**
|
||||
* Gets the adapter state of the WireGuard adapter.
|
||||
*
|
||||
* @param Adapter Adapter handle obtained with WireGuardCreateAdapter or WireGuardOpenAdapter
|
||||
*
|
||||
* @param State Pointer to adapter state.
|
||||
*
|
||||
* @return If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To
|
||||
* get extended error information, call GetLastError.
|
||||
*/
|
||||
typedef _Must_inspect_result_
|
||||
_Return_type_success_(return != FALSE)
|
||||
BOOL(WINAPI WIREGUARD_GET_ADAPTER_STATE_FUNC)
|
||||
(_In_ WIREGUARD_ADAPTER_HANDLE Adapter, _Out_ WIREGUARD_ADAPTER_STATE *State);
|
||||
|
||||
#define WIREGUARD_KEY_LENGTH 32
|
||||
|
||||
typedef struct _WIREGUARD_ALLOWED_IP WIREGUARD_ALLOWED_IP;
|
||||
struct ALIGNED(8) _WIREGUARD_ALLOWED_IP
|
||||
{
|
||||
union
|
||||
{
|
||||
IN_ADDR V4;
|
||||
IN6_ADDR V6;
|
||||
} Address; /**< IP address */
|
||||
ADDRESS_FAMILY AddressFamily; /**< Address family, either AF_INET or AF_INET6 */
|
||||
BYTE Cidr; /**< CIDR of allowed IPs */
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WIREGUARD_PEER_HAS_PUBLIC_KEY = 1 << 0, /**< The PublicKey field is set */
|
||||
WIREGUARD_PEER_HAS_PRESHARED_KEY = 1 << 1, /**< The PresharedKey field is set */
|
||||
WIREGUARD_PEER_HAS_PERSISTENT_KEEPALIVE = 1 << 2, /**< The PersistentKeepAlive field is set */
|
||||
WIREGUARD_PEER_HAS_ENDPOINT = 1 << 3, /**< The Endpoint field is set */
|
||||
WIREGUARD_PEER_REPLACE_ALLOWED_IPS = 1 << 5, /**< Remove all allowed IPs before adding new ones */
|
||||
WIREGUARD_PEER_REMOVE = 1 << 6, /**< Remove specified peer */
|
||||
WIREGUARD_PEER_UPDATE = 1 << 7 /**< Do not add a new peer */
|
||||
} WIREGUARD_PEER_FLAG;
|
||||
|
||||
typedef struct _WIREGUARD_PEER WIREGUARD_PEER;
|
||||
struct ALIGNED(8) _WIREGUARD_PEER
|
||||
{
|
||||
WIREGUARD_PEER_FLAG Flags; /**< Bitwise combination of flags */
|
||||
DWORD Reserved; /**< Reserved; must be zero */
|
||||
BYTE PublicKey[WIREGUARD_KEY_LENGTH]; /**< Public key, the peer's primary identifier */
|
||||
BYTE PresharedKey[WIREGUARD_KEY_LENGTH]; /**< Preshared key for additional layer of post-quantum resistance */
|
||||
WORD PersistentKeepalive; /**< Seconds interval, or 0 to disable */
|
||||
SOCKADDR_INET Endpoint; /**< Endpoint, with IP address and UDP port number*/
|
||||
DWORD64 TxBytes; /**< Number of bytes transmitted */
|
||||
DWORD64 RxBytes; /**< Number of bytes received */
|
||||
DWORD64 LastHandshake; /**< Time of the last handshake, in 100ns intervals since 1601-01-01 UTC */
|
||||
DWORD AllowedIPsCount; /**< Number of allowed IP structs following this struct */
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WIREGUARD_INTERFACE_HAS_PUBLIC_KEY = (1 << 0), /**< The PublicKey field is set */
|
||||
WIREGUARD_INTERFACE_HAS_PRIVATE_KEY = (1 << 1), /**< The PrivateKey field is set */
|
||||
WIREGUARD_INTERFACE_HAS_LISTEN_PORT = (1 << 2), /**< The ListenPort field is set */
|
||||
WIREGUARD_INTERFACE_REPLACE_PEERS = (1 << 3) /**< Remove all peers before adding new ones */
|
||||
} WIREGUARD_INTERFACE_FLAG;
|
||||
|
||||
typedef struct _WIREGUARD_INTERFACE WIREGUARD_INTERFACE;
|
||||
struct ALIGNED(8) _WIREGUARD_INTERFACE
|
||||
{
|
||||
WIREGUARD_INTERFACE_FLAG Flags; /**< Bitwise combination of flags */
|
||||
WORD ListenPort; /**< Port for UDP listen socket, or 0 to choose randomly */
|
||||
BYTE PrivateKey[WIREGUARD_KEY_LENGTH]; /**< Private key of interface */
|
||||
BYTE PublicKey[WIREGUARD_KEY_LENGTH]; /**< Corresponding public key of private key */
|
||||
DWORD PeersCount; /**< Number of peer structs following this struct */
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the configuration of the WireGuard adapter.
|
||||
*
|
||||
* @param Adapter Adapter handle obtained with WireGuardCreateAdapter or WireGuardOpenAdapter
|
||||
*
|
||||
* @param Config Configuration for the adapter.
|
||||
*
|
||||
* @param Bytes Number of bytes in Config allocation.
|
||||
*
|
||||
* @return If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To
|
||||
* get extended error information, call GetLastError.
|
||||
*/
|
||||
typedef _Return_type_success_(return != FALSE)
|
||||
BOOL(WINAPI WIREGUARD_SET_CONFIGURATION_FUNC)
|
||||
(_In_ WIREGUARD_ADAPTER_HANDLE Adapter, _In_reads_bytes_(Bytes) const WIREGUARD_INTERFACE *Config, _In_ DWORD Bytes);
|
||||
|
||||
/**
|
||||
* Gets the configuration of the WireGuard adapter.
|
||||
*
|
||||
* @param Adapter Adapter handle obtained with WireGuardCreateAdapter or WireGuardOpenAdapter
|
||||
*
|
||||
* @param Config Configuration for the adapter.
|
||||
*
|
||||
* @param Bytes Pointer to number of bytes in Config allocation.
|
||||
*
|
||||
* @return If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To
|
||||
* get extended error information, call GetLastError, which if ERROR_MORE_DATA, Bytes is updated with the
|
||||
* required size.
|
||||
*/
|
||||
typedef _Must_inspect_result_
|
||||
_Return_type_success_(return != FALSE)
|
||||
BOOL(WINAPI WIREGUARD_GET_CONFIGURATION_FUNC)
|
||||
(_In_ WIREGUARD_ADAPTER_HANDLE Adapter,
|
||||
_Out_writes_bytes_all_(*Bytes) WIREGUARD_INTERFACE *Config,
|
||||
_Inout_ DWORD *Bytes);
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,6 +2,8 @@
|
|||
#include <spdlog/spdlog.h>
|
||||
#include "common.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* @brief WireGuard 配置项
|
||||
|
@ -67,6 +69,19 @@ typedef struct {
|
|||
USER_SERVER_CONFIG svrConfig; ///< 用户服务端配置
|
||||
} USER_CONFIG, *PUSER_CONFIG;
|
||||
|
||||
typedef struct {
|
||||
TCHAR targetIp[MAX_IP_LEN];
|
||||
UINT16 targetPort;
|
||||
UINT16 proxyPort;
|
||||
UINT16 scgGwPort;
|
||||
TCHAR scgIpAddr[MAX_IP_LEN];
|
||||
SOCKET udpProxySock;
|
||||
SOCKET scgGwSock;
|
||||
HANDLE hProxyTunnelThread;
|
||||
HANDLE hProxySCGThread;
|
||||
bool exitNow;
|
||||
} SCG_PROXY_INFO, *PSCG_PROXY_INFO;
|
||||
|
||||
/**
|
||||
* @brief SDK 全局配置项
|
||||
*/
|
||||
|
@ -76,16 +91,16 @@ typedef struct {
|
|||
TCHAR systemDirectory[MAX_PATH]; ///< 操作系统目录
|
||||
TCHAR workDirectory[MAX_PATH]; ///< SDK 当前工作目录
|
||||
bool isWorkServer; ///< SDK 当前模式 客户端/服务端
|
||||
bool usedSCGProxy; ///< 是否启动 SCG 代理
|
||||
//int scgProxyPort; ///< SCG 代理端口, >0 启动 SCG代理,<=0 关闭SCG代理
|
||||
PROTO_CRYPTO_TYPE proCryptoType; ///< 协议加密类型
|
||||
TCHAR proKeyBuf[256]; ///< 协议加密秘钥
|
||||
BOOL enableLog; ///< 是否启用日志
|
||||
spdlog::level::level_enum logLevel; ///< 日志等级
|
||||
TCHAR cfgPath[MAX_PATH]; ///< 配置文件路径
|
||||
//WIREGUARD_CFG wireguardCfg; ///< wireguard 配置项 @see WIREGUARD_CFG
|
||||
WGINTERFACE_CFG wgServerCfg; ///< wireguard 服务端网络接口配置
|
||||
WGINTERFACE_CFG wgClientCfg; ///< wireguard 客户端网络接口配置
|
||||
USER_CONFIG userCfg; ///< 用户配置项
|
||||
SCG_PROXY_INFO scgProxy; ///< SCG UDP 代理信息
|
||||
int curConnVmId; ///< 当前连接的VM
|
||||
} SDK_CONFIG, *PSDK_CONFIG;
|
||||
|
|
@ -108,6 +108,12 @@ int GetIpV4InfoFromNetmask(const TCHAR *pIpStr, const TCHAR *pNetmask, PIP_INFO
|
|||
int GetIpV4InfoFromCIDR(const TCHAR *pIpStr, PIP_INFO pInfo);
|
||||
|
||||
int GetIpV4InfoFromHostname(int family, const char *host, PIP_INFO pInfo);
|
||||
|
||||
int InitializeWireGuardLibrary();
|
||||
void UnInitializeWireGuardLibrary();
|
||||
|
||||
void StopUDPProxyServer();
|
||||
int CreateUDPProxyServer();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -247,7 +247,7 @@ TUNNEL_API int __cdecl RemoveNATRule(const TCHAR *pInterfaceName);
|
|||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
TUNNEL_API int __cdecl SetInterfaceIpAddress(const TCHAR *pInterfaceName, const TCHAR *pIpaddr, const TCHAR *pNetmask);
|
||||
TUNNEL_API int __cdecl CreatePorxyService();
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* @brief 获取Windows Hyper-V 虚拟机状态, 必须开启后才能开启NAT转发功能
|
|
@ -109,19 +109,6 @@ TUNNEL_API int __cdecl SetProtocolEncryptType(const PROTO_CRYPTO_TYPE type, cons
|
|||
*/
|
||||
TUNNEL_API void __cdecl TunnelLogEnable(bool enLog);
|
||||
|
||||
/**
|
||||
* @brief 创建 WireGuard 密钥对
|
||||
* @param[out] pPubKey 公钥缓冲区
|
||||
* @param[in] pubkeySize 公钥缓冲区大小(字节数)
|
||||
* @param[out] pPrivKey 私钥缓冲区
|
||||
* @param[in] privKeySize 私钥缓冲区大小(字节数)
|
||||
* @return 函数执行结果 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_ITEM_UNEXISTS WireGuard 未配置或未安装
|
||||
* - -ERR_CALL_SHELL 调用操作系统命令行工具失败
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
TUNNEL_API int __cdecl GenerateWireguardKeyPairs(TCHAR *pPubKey, int pubkeySize, TCHAR *pPrivKey, int privKeySize);
|
||||
|
||||
/**
|
||||
* @brief 创建 WireGuard 服务端配置文件
|
||||
* @param[in] pWgConfig 配置文件相关配置项 @see WGSERVER_CONFIG
|
||||
|
@ -175,6 +162,7 @@ TUNNEL_API int __cdecl CreateWireGuardService(const TCHAR *pInterfaceName, const
|
|||
*/
|
||||
TUNNEL_API int __cdecl GetWireGuardServiceStatus(const TCHAR *pTunnelName, bool *pIsRunning);
|
||||
|
||||
TUNNEL_API int __cdecl GetWireGuradTunnelInfo(const TCHAR *pTunnelName);
|
||||
/**
|
||||
* @brief 移除 WireGuard 隧道服务
|
||||
* @param pTunnelName 隧道服务名
|
||||
|
@ -264,14 +252,19 @@ TUNNEL_API void __cdecl TunnelSDKUnInit();
|
|||
/**
|
||||
* @brief SCG 代理服务开关
|
||||
* @param isEnable TRUE: 启动 SCG 代理, FALSE: 禁用 SCG 代理
|
||||
* @param pSCGIpAddr SCG 代理 IP
|
||||
* @param scgPort SCG 代理端口
|
||||
* @return 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_INPUT_PARAMS 输入参数错误
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
TUNNEL_API void __cdecl EnableSCGProxy(bool isEnable);
|
||||
TUNNEL_API int __cdecl EnableSCGProxy(bool isEnable, const TCHAR* pSCGIpAddr, int scgPort);
|
||||
|
||||
/**
|
||||
* @brief 获取当前 SCG 代理服务状态
|
||||
* @return TRUE: SCG 代理启动, FALSE: SCG 代理禁用
|
||||
*/
|
||||
TUNNEL_API bool __cdecl GetSCGProxyStatus();
|
||||
TUNNEL_API bool __cdecl UsedSCGProxy();
|
||||
|
||||
/**
|
||||
* @brief 计算文件 Hash
|
||||
|
@ -291,48 +284,6 @@ TUNNEL_API bool __cdecl GetSCGProxyStatus();
|
|||
*/
|
||||
TUNNEL_API int __cdecl CalcFileHash(const HASH_TYPE type, const TCHAR *pPath, TCHAR outHash[]);
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++Temp Interface
|
||||
|
||||
//TUNNEL_API int __cdecl ProtoGetUserConfigure(const TCHAR *pUser, const TCHAR *pToken);
|
||||
//TUNNEL_API const TCHAR* __cdecl GetInterfaceGUIDByName(const TCHAR *pInterfaceName, GUID* pGuid);
|
||||
//------------------------------------------End Temp Interface
|
||||
#if 0
|
||||
/**
|
||||
* @brief 安装 Windows NAT 自定义 PowerShell 命令
|
||||
* @return 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_INPUT_PARAMS 输入参数错误
|
||||
* - -ERR_OPEN_FILE 打开文件失败
|
||||
* - -ERR_MEMORY_STR 字符串处理
|
||||
* - -ERR_ITEM_UNEXISTS 资源不存在
|
||||
* - -ERR_CALL_SHELL 调用系统命令行失败
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
TUNNEL_API int __cdecl InstallWindowsNATCommand();
|
||||
TUNNEL_API int __cdecl WireGuardNetConnectionSharingEnable();
|
||||
|
||||
|
||||
/**
|
||||
* @brief 查找 WireGuard 运行环境
|
||||
* @param[out] pFullPath wireguard.exe 程序路径
|
||||
* @param[in] maxSize pFullPath 缓冲区最大字节数
|
||||
* @return 函数执行结果 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_INPUT_PARAMS 输入参数错误
|
||||
* - -ERR_MALLOC_MEMORY 分配内存失败
|
||||
* - -ERR_FILE_NOT_EXISTS 文件不存在
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
TUNNEL_API int __cdecl FindWireguardExe(TCHAR *pFullPath, int maxSize);
|
||||
|
||||
/**
|
||||
* @brief 设置 wireguard.exe 程序路径
|
||||
* @param[in] pPath wireguard.exe 程序路径
|
||||
* @return 函数执行结果 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_INPUT_PARAMS 输入参数错误
|
||||
* - -ERR_ITEM_UNEXISTS 文件不存在
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
TUNNEL_API int __cdecl SetWireguardPath(const TCHAR *pPath);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -12,6 +12,8 @@ enum USER_ERRNO {
|
|||
ERR_ITEM_UNEXISTS, ///< 该内容不存在
|
||||
ERR_SYS_INIT, ///< 系统中断
|
||||
ERR_SYS_CALL, ///< 系统调用
|
||||
ERR_LOAD_LIBRARY, ///< 加载系统库失败
|
||||
ERR_MAP_LIBRARY, ///< 加载系统库接口失败
|
||||
ERR_SYS_TIMEOUT, ///< 系统超时
|
||||
ERR_SYSTEM_UNINITIALIZE, ///< 系统未初始化
|
||||
ERR_CREATE_FILE, ///< 创建文件/目录失败
|
|
@ -439,7 +439,7 @@ int GetIpV4InfoFromCIDR(const TCHAR *pIpStr, PIP_INFO pInfo) {
|
|||
TCHAR *prefixStr;
|
||||
TCHAR *ipStr = _strdup(pIpStr);
|
||||
|
||||
if (pIpStr == nullptr || lstrlen(pIpStr) < MIN_IP_LEN) {
|
||||
if (pIpStr == nullptr || lstrlen(pIpStr) < MIN_IP_LEN || lstrlen(pIpStr) >= MAX_IP_LEN) {
|
||||
SPDLOG_ERROR(TEXT("Input pIpStr format error: {}."), pIpStr);
|
||||
return -ERR_INPUT_PARAMS;
|
||||
}
|
||||
|
@ -485,12 +485,12 @@ int GetIpV4InfoFromCIDR(const TCHAR *pIpStr, PIP_INFO pInfo) {
|
|||
int GetIpV4InfoFromNetmask(const TCHAR *pIpStr, const TCHAR *pNetmask, PIP_INFO pInfo) {
|
||||
int prefix;
|
||||
|
||||
if (pIpStr == nullptr || lstrlen(pIpStr) < MIN_IP_LEN) {
|
||||
if (pIpStr == nullptr || lstrlen(pIpStr) < MIN_IP_LEN || lstrlen(pIpStr) >= MAX_IP_LEN) {
|
||||
SPDLOG_ERROR(TEXT("Input pIpStr format error: {}."), pIpStr);
|
||||
return -ERR_INPUT_PARAMS;
|
||||
}
|
||||
|
||||
if (pNetmask == nullptr || lstrlen(pNetmask) < MIN_IP_LEN) {
|
||||
if (pNetmask == nullptr || lstrlen(pNetmask) < MIN_IP_LEN || lstrlen(pNetmask) >= MAX_IP_LEN) {
|
||||
SPDLOG_ERROR(TEXT("Input pNetmask format error: {}."), pNetmask);
|
||||
return -ERR_INPUT_PARAMS;
|
||||
}
|
|
@ -204,7 +204,7 @@ int CreateControlService(PUSER_SERVER_CONFIG pSvr) {
|
|||
}
|
||||
}
|
||||
|
||||
if (isSvrStart) {
|
||||
if (reqData.msgContent.isStart) {
|
||||
SPDLOG_INFO(TEXT("Tunnel Service Start Now: {0}"), GetGlobalCfgInfo()->userCfg.userName);
|
||||
} else {
|
||||
SPDLOG_INFO(TEXT("Tunnel Service Stoped: {0}"), GetGlobalCfgInfo()->userCfg.userName);
|
||||
|
@ -270,16 +270,7 @@ int CreateControlService(PUSER_SERVER_CONFIG pSvr) {
|
|||
g_InterfaceMutex.unlock();
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
// 启动服务
|
||||
ret = WireGuardInstallDefaultServerService(true);
|
||||
if (ret != ERR_SUCCESS) {
|
||||
// 返回启动服务失败
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置路由表
|
||||
#endif
|
||||
// 返回当前隧道信息
|
||||
rsp.msgContent.errCode = ERR_SUCCESS;
|
||||
rsp.msgContent.errMessage = TEXT("OK");
|
|
@ -0,0 +1,241 @@
|
|||
#include "pch.h"
|
||||
|
||||
#include <strsafe.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "globalcfg.h"
|
||||
#include "usrerr.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
typedef struct {
|
||||
bool isRunning;
|
||||
HANDLE proxyThread;
|
||||
HANDLE proxyHandle;
|
||||
bool isExitSvr;
|
||||
} UDP_PROXY_CTX, *PUDP_PROXY_CTX;
|
||||
|
||||
typedef struct {
|
||||
TCHAR streamFilter[1024];
|
||||
TCHAR targetIp[MAX_IP_LEN];
|
||||
UINT16 targetPort;
|
||||
int vmId;
|
||||
int svrId;
|
||||
UDP_PROXY_CTX udpCtx;
|
||||
} PROXY_INFO, *PPROXY_INFO;
|
||||
|
||||
void StopUDPProxyServer() {
|
||||
const PSCG_PROXY_INFO pProxy = &GetGlobalCfgInfo()->scgProxy;
|
||||
pProxy->exitNow = true;
|
||||
|
||||
if (pProxy->hProxyTunnelThread) {
|
||||
if (WaitForSingleObject(pProxy->hProxyTunnelThread, 10 * 1000) == WAIT_TIMEOUT) {
|
||||
SPDLOG_ERROR(TEXT("Waitting HTTP Service clost timeout"));
|
||||
}
|
||||
|
||||
closesocket(pProxy->udpProxySock);
|
||||
}
|
||||
|
||||
if (pProxy->hProxySCGThread) {
|
||||
if (WaitForSingleObject(pProxy->hProxySCGThread, 10 * 1000) == WAIT_TIMEOUT) {
|
||||
SPDLOG_ERROR(TEXT("Waitting HTTP Service clost timeout"));
|
||||
}
|
||||
|
||||
closesocket(pProxy->scgGwSock);
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD UDPProxvRemoteThread(LPVOID lpParameter) {
|
||||
const auto pPeerSock = static_cast<sockaddr_in *>(lpParameter);
|
||||
const PSCG_PROXY_INFO pProxy = &GetGlobalCfgInfo()->scgProxy;
|
||||
|
||||
while (pPeerSock && !pProxy->exitNow) {
|
||||
sockaddr_in remoteWgAddr {};
|
||||
TCHAR ipAddr[MAX_IP_LEN];
|
||||
|
||||
int addrSize = sizeof(SOCKADDR);
|
||||
char recvBuf[1500];
|
||||
int iRecvBytes;
|
||||
|
||||
// 代理服务 In
|
||||
iRecvBytes = recvfrom(pProxy->scgGwSock,
|
||||
recvBuf,
|
||||
1500,
|
||||
0,
|
||||
reinterpret_cast<SOCKADDR *>(&remoteWgAddr),
|
||||
&addrSize);
|
||||
|
||||
memset(ipAddr, 0, MAX_IP_LEN);
|
||||
InetNtop(AF_INET, &remoteWgAddr.sin_addr.s_addr, ipAddr, MAX_IP_LEN);
|
||||
SPDLOG_TRACE(TEXT(">>> Scoket In {1} Recv {0} bytes from {2}:{3}"),
|
||||
iRecvBytes,
|
||||
pProxy->scgGwSock,
|
||||
ipAddr,
|
||||
ntohs(remoteWgAddr.sin_port));
|
||||
|
||||
if (iRecvBytes != SOCKET_ERROR) {
|
||||
int sendBytes = sendto(pProxy->udpProxySock,
|
||||
recvBuf,
|
||||
iRecvBytes,
|
||||
0,
|
||||
reinterpret_cast<SOCKADDR *>(pPeerSock),
|
||||
sizeof(SOCKADDR));
|
||||
memset(ipAddr, 0, MAX_IP_LEN);
|
||||
InetNtop(AF_INET, &pPeerSock->sin_addr.s_addr, ipAddr, MAX_IP_LEN);
|
||||
SPDLOG_TRACE(TEXT("<<< Scoket In Send {0} bytes to {2}:{3}"),
|
||||
sendBytes,
|
||||
pProxy->udpProxySock,
|
||||
ipAddr,
|
||||
ntohs(pPeerSock->sin_port));
|
||||
}
|
||||
|
||||
Sleep(100);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD UDPProxyRecvThread(LPVOID lpParameter) {
|
||||
bool isRemoteInit = false;
|
||||
sockaddr_in localWgAddr {};
|
||||
sockaddr_in scgAddr {};
|
||||
const PSCG_PROXY_INFO pProxy = &GetGlobalCfgInfo()->scgProxy;
|
||||
pProxy->exitNow = false;
|
||||
|
||||
scgAddr.sin_family = AF_INET;
|
||||
scgAddr.sin_port = htons(pProxy->scgGwPort);
|
||||
InetPton(AF_INET, pProxy->scgIpAddr, &scgAddr.sin_addr.s_addr);
|
||||
|
||||
while (!pProxy->exitNow) {
|
||||
TCHAR ipAddr[MAX_IP_LEN];
|
||||
int addrSize = sizeof(SOCKADDR);
|
||||
char recvBuf[1500];
|
||||
int iRecvBytes;
|
||||
|
||||
// 代理服务 Out
|
||||
iRecvBytes = recvfrom(pProxy->udpProxySock,
|
||||
recvBuf,
|
||||
1500,
|
||||
0,
|
||||
reinterpret_cast<SOCKADDR *>(&localWgAddr),
|
||||
&addrSize);
|
||||
|
||||
InetNtop(AF_INET, &localWgAddr.sin_addr.s_addr, ipAddr, MAX_IP_LEN);
|
||||
SPDLOG_TRACE(TEXT(">>> Scoket Out {1} Recv {0} bytes from {2}:{3}"),
|
||||
iRecvBytes,
|
||||
pProxy->udpProxySock,
|
||||
ipAddr,
|
||||
ntohs(localWgAddr.sin_port));
|
||||
|
||||
if (iRecvBytes != SOCKET_ERROR) {
|
||||
int sendBytes;
|
||||
|
||||
if (!isRemoteInit) {
|
||||
HANDLE handle;
|
||||
isRemoteInit = true;
|
||||
// 创建远端接收线程
|
||||
handle = CreateThread(nullptr, // Thread attributes
|
||||
0, // Stack size (0 = use default)
|
||||
UDPProxvRemoteThread, // Thread start address
|
||||
&localWgAddr, // Parameter to pass to the thread
|
||||
0, // Creation flags
|
||||
nullptr); // Thread id
|
||||
|
||||
if (handle == nullptr) {
|
||||
SPDLOG_ERROR("Create Thread failed with error = {0}", GetLastError());
|
||||
closesocket(pProxy->udpProxySock);
|
||||
closesocket(pProxy->scgGwSock);
|
||||
pProxy->exitNow = true;
|
||||
return -ERR_CREATE_THREAD;
|
||||
}
|
||||
|
||||
pProxy->hProxySCGThread = handle;
|
||||
}
|
||||
|
||||
sendBytes = sendto(pProxy->scgGwSock,
|
||||
recvBuf,
|
||||
iRecvBytes,
|
||||
0,
|
||||
reinterpret_cast<SOCKADDR *>(&scgAddr),
|
||||
sizeof(SOCKADDR));
|
||||
memset(ipAddr, 0, MAX_IP_LEN);
|
||||
InetNtop(AF_INET, &scgAddr.sin_addr.s_addr, ipAddr, MAX_IP_LEN);
|
||||
SPDLOG_TRACE(TEXT("<<< Scoket Out Send {0} bytes to {2}:{3}"),
|
||||
sendBytes,
|
||||
pProxy->scgGwSock,
|
||||
ipAddr,
|
||||
ntohs(scgAddr.sin_port));
|
||||
}
|
||||
|
||||
Sleep(100);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CreateUDPProxyServer() {
|
||||
HANDLE handle;
|
||||
int ret;
|
||||
int addrSize = sizeof(sockaddr_in);
|
||||
sockaddr_in server {};
|
||||
sockaddr_in bindAddr {};
|
||||
SOCKET sock;
|
||||
const PSCG_PROXY_INFO pProxy = &GetGlobalCfgInfo()->scgProxy;
|
||||
|
||||
// 创建本地 SOCKET 代理服务器
|
||||
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (sock == INVALID_SOCKET) {
|
||||
SPDLOG_ERROR("Create UDP Socket failed with error = {0}", WSAGetLastError());
|
||||
return -ERR_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
server.sin_family = AF_INET;
|
||||
server.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
server.sin_port = htons(0);
|
||||
|
||||
if (bind(sock, reinterpret_cast<SOCKADDR *>(&server), sizeof(SOCKADDR)) == SOCKET_ERROR) {
|
||||
closesocket(sock);
|
||||
SPDLOG_ERROR("Bind local UDP Socket failed with error = {0}", WSAGetLastError());
|
||||
return -ERR_SOCKET_BIND;
|
||||
}
|
||||
|
||||
if ((ret = getsockname(sock, reinterpret_cast<SOCKADDR *>(&bindAddr), &addrSize)) != 0) {
|
||||
closesocket(sock);
|
||||
SPDLOG_ERROR("Get UDP Socket bind port failed with error = {0}, {1}", WSAGetLastError(), ret);
|
||||
return -ERR_SOCKET_BIND;
|
||||
}
|
||||
|
||||
// 保存 UDP 代理服务器信息
|
||||
pProxy->udpProxySock = sock;
|
||||
pProxy->proxyPort = ntohs(bindAddr.sin_port);
|
||||
|
||||
SPDLOG_DEBUG(TEXT("Proxy Server socket {0} bind {1} prot"), sock, pProxy->proxyPort);
|
||||
|
||||
// 创建SCG SOCKET 连接客户端服务
|
||||
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (sock == INVALID_SOCKET) {
|
||||
SPDLOG_ERROR("Create UDP Socket failed with error = {0}", WSAGetLastError());
|
||||
closesocket(pProxy->udpProxySock);
|
||||
return -ERR_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
pProxy->scgGwSock = sock;
|
||||
|
||||
// 创建代理服务发送线程
|
||||
handle = CreateThread(nullptr, // Thread attributes
|
||||
0, // Stack size (0 = use default)
|
||||
UDPProxyRecvThread, // Thread start address
|
||||
nullptr, // Parameter to pass to the thread
|
||||
0, // Creation flags
|
||||
nullptr); // Thread id
|
||||
|
||||
if (handle == nullptr) {
|
||||
SPDLOG_ERROR("Create Thread failed with error = {0}", GetLastError());
|
||||
closesocket(pProxy->udpProxySock);
|
||||
closesocket(pProxy->scgGwSock);
|
||||
return -ERR_CREATE_THREAD;
|
||||
}
|
||||
|
||||
pProxy->hProxyTunnelThread = handle;
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
|
@ -15,25 +15,58 @@ static httplib::Client *g_httpCtx = nullptr;
|
|||
static httplib::Client *g_tunnelHttpCtx = nullptr;
|
||||
|
||||
int InitControlServer(const TCHAR *pUserSvrUrl) {
|
||||
const PUSER_CONFIG pUser = &GetGlobalCfgInfo()->userCfg;
|
||||
PUSER_SERVER_CONFIG pUserCfg = &pUser->svrConfig;
|
||||
|
||||
if (g_tunnelHttpCtx) {
|
||||
delete g_tunnelHttpCtx;
|
||||
g_tunnelHttpCtx = nullptr;
|
||||
}
|
||||
|
||||
g_tunnelHttpCtx = new httplib::Client(pUserSvrUrl);
|
||||
if (GetGlobalCfgInfo()->scgProxy.scgGwPort > 0) {
|
||||
TCHAR scgProxyUrl[MAX_PATH];
|
||||
StringCbPrintf(scgProxyUrl, MAX_PATH, TEXT("http://127.0.0.1:%d"), GetGlobalCfgInfo()->scgProxy.scgGwPort);
|
||||
g_tunnelHttpCtx = new httplib::Client(pUserSvrUrl);
|
||||
} else {
|
||||
g_tunnelHttpCtx = new httplib::Client(pUserSvrUrl);
|
||||
}
|
||||
|
||||
if (g_tunnelHttpCtx) {
|
||||
g_tunnelHttpCtx->set_connection_timeout(0, 1000000); // 1 second
|
||||
g_tunnelHttpCtx->set_read_timeout(5, 0); // 5 seconds
|
||||
g_tunnelHttpCtx->set_write_timeout(5, 0); // 5 seconds
|
||||
g_tunnelHttpCtx->set_post_connect_cb([](socket_t sock) {
|
||||
SPDLOG_DEBUG(TEXT("Service Connected: {0}"), sock);
|
||||
if (UsedSCGProxy()) {
|
||||
int ret;
|
||||
unsigned char vmid[4];
|
||||
const unsigned int id = htonl(GetGlobalCfgInfo()->curConnVmId);
|
||||
unsigned char scgProxy[] = {0x01, // VERSION
|
||||
0x09, // Length
|
||||
0xF0, // ++++++ INFO[0] TYPE
|
||||
0x04, // INFO[0] LENGTH
|
||||
0, // INFO[0] VMID[0]
|
||||
0, // INFO[0] VMID[1]
|
||||
0, // INFO[0] VMID[2]
|
||||
0, // INFO[0] VMID[3]
|
||||
0xF1, // INFO[1] TYPE
|
||||
0x01, // INFO[1] LENGTH
|
||||
0x07}; // ------ INFO[1] SCG Service ID
|
||||
|
||||
// TODO Send SCG Message
|
||||
// send(sock, ..... GetGlobalCfgInfo()->curConnVmId
|
||||
unsigned char *p = scgProxy;
|
||||
|
||||
memcpy(vmid, &id, 4);
|
||||
scgProxy[4] = vmid[0];
|
||||
scgProxy[5] = vmid[1];
|
||||
scgProxy[6] = vmid[2];
|
||||
scgProxy[7] = vmid[3];
|
||||
|
||||
ret = send(sock, reinterpret_cast<const char *>(p), sizeof(scgProxy), 0);
|
||||
|
||||
while (ret < static_cast<int>(sizeof(scgProxy))) {
|
||||
p += ret;
|
||||
ret += send(sock, reinterpret_cast<const char *>(p), sizeof(scgProxy), 0);
|
||||
}
|
||||
|
||||
SPDLOG_DEBUG(TEXT("Service Connected To SCG Server: {0}"), sock);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -2,11 +2,95 @@
|
|||
#include "usrerr.h"
|
||||
#include "globalcfg.h"
|
||||
#include "tunnel.h"
|
||||
#include "wireguard.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <shlwapi.h>
|
||||
#include <strsafe.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
static WIREGUARD_CREATE_ADAPTER_FUNC *WireGuardCreateAdapter;
|
||||
static WIREGUARD_OPEN_ADAPTER_FUNC *WireGuardOpenAdapter;
|
||||
static WIREGUARD_CLOSE_ADAPTER_FUNC *WireGuardCloseAdapter;
|
||||
static WIREGUARD_GET_ADAPTER_LUID_FUNC *WireGuardGetAdapterLUID;
|
||||
static WIREGUARD_GET_RUNNING_DRIVER_VERSION_FUNC *WireGuardGetRunningDriverVersion;
|
||||
static WIREGUARD_DELETE_DRIVER_FUNC *WireGuardDeleteDriver;
|
||||
static WIREGUARD_SET_LOGGER_FUNC *WireGuardSetLogger;
|
||||
static WIREGUARD_SET_ADAPTER_LOGGING_FUNC *WireGuardSetAdapterLogging;
|
||||
static WIREGUARD_GET_ADAPTER_STATE_FUNC *WireGuardGetAdapterState;
|
||||
static WIREGUARD_SET_ADAPTER_STATE_FUNC *WireGuardSetAdapterState;
|
||||
static WIREGUARD_GET_CONFIGURATION_FUNC *WireGuardGetConfiguration;
|
||||
static WIREGUARD_SET_CONFIGURATION_FUNC *WireGuardSetConfiguration;
|
||||
|
||||
typedef struct {
|
||||
WIREGUARD_INTERFACE Interface;
|
||||
WIREGUARD_PEER RemoteServer;
|
||||
WIREGUARD_ALLOWED_IP Allow1;
|
||||
WIREGUARD_ALLOWED_IP Allow2;
|
||||
} WG_CONFIG_INFO;
|
||||
|
||||
static HMODULE g_WireGarudModule;
|
||||
|
||||
int InitializeWireGuardLibrary() {
|
||||
TCHAR dllPath[MAX_PATH];
|
||||
|
||||
StringCbPrintf(dllPath, MAX_PATH, TEXT("%s\\wireguard.dll"), GetGlobalCfgInfo()->workDirectory);
|
||||
if(!PathFileExists(dllPath)) {
|
||||
SPDLOG_ERROR(TEXT("WireGuard DLL Not Found: {0}"), dllPath);
|
||||
return -ERR_ITEM_UNEXISTS;
|
||||
}
|
||||
|
||||
g_WireGarudModule = LoadLibraryEx(dllPath,
|
||||
nullptr,
|
||||
LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
if (!g_WireGarudModule) {
|
||||
DWORD errCode = GetLastError();
|
||||
SPDLOG_ERROR(TEXT("LoadLibraryEx WireGuard DLL error: {0}"), errCode);
|
||||
return -ERR_LOAD_LIBRARY;
|
||||
}
|
||||
#define X(Name) ((*(FARPROC *)&(Name) = GetProcAddress(g_WireGarudModule, #Name)) == nullptr)
|
||||
if (X(WireGuardCreateAdapter) || X(WireGuardOpenAdapter) || X(WireGuardCloseAdapter) ||
|
||||
X(WireGuardGetAdapterLUID) || X(WireGuardGetRunningDriverVersion) || X(WireGuardDeleteDriver) ||
|
||||
X(WireGuardSetLogger) || X(WireGuardSetAdapterLogging) || X(WireGuardGetAdapterState) ||
|
||||
X(WireGuardSetAdapterState) || X(WireGuardGetConfiguration) || X(WireGuardSetConfiguration))
|
||||
#undef X
|
||||
{
|
||||
SPDLOG_ERROR(TEXT("Map WireGuard DLL EntryPoint error: {0}"), GetLastError());
|
||||
FreeLibrary(g_WireGarudModule);
|
||||
return -ERR_MAP_LIBRARY;
|
||||
}
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
void UnInitializeWireGuardLibrary() {
|
||||
if (g_WireGarudModule) {
|
||||
FreeLibrary(g_WireGarudModule);
|
||||
}
|
||||
}
|
||||
|
||||
int GetWireGuradTunnelInfo(const TCHAR *pTunnelName) {
|
||||
WIREGUARD_ADAPTER_HANDLE Adapter;
|
||||
int ret;
|
||||
WCHAR wstrName[MAX_PATH];
|
||||
|
||||
if ((ret = TCharToWideChar(pTunnelName, wstrName, MAX_PATH)) != ERR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
Adapter = WireGuardOpenAdapter(wstrName);
|
||||
|
||||
if (Adapter) {
|
||||
WG_CONFIG_INFO config;
|
||||
|
||||
DWORD Bytes = sizeof(WG_CONFIG_INFO);
|
||||
if (!WireGuardGetConfiguration(Adapter, &config.Interface, &Bytes)) {
|
||||
SPDLOG_ERROR("Failed to get configuration: {0}", GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
int GetWireGuardServiceStatus(const TCHAR *pTunnelName, bool *pIsRunning) {
|
||||
SC_HANDLE schSCManager;
|
||||
SC_HANDLE schService;
|
|
@ -14,7 +14,7 @@
|
|||
#include "user.h"
|
||||
|
||||
#include <shlwapi.h>
|
||||
#include <ws2def.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
#pragma comment(lib, "Dbghelp.lib")
|
||||
|
||||
|
@ -94,7 +94,9 @@ int TunnelSDKInitEnv(const TCHAR *pWorkDir,
|
|||
const TCHAR *pLogFile,
|
||||
LOG_LEVEL level,
|
||||
bool isWorkServer) {
|
||||
size_t length;
|
||||
int ret;
|
||||
size_t length;
|
||||
WSADATA WsaData;
|
||||
|
||||
CoInitialize(nullptr);
|
||||
CoInitializeSecurity(nullptr,
|
||||
|
@ -106,11 +108,12 @@ int TunnelSDKInitEnv(const TCHAR *pWorkDir,
|
|||
nullptr,
|
||||
EOAC_NONE,
|
||||
nullptr);
|
||||
WSAStartup(MAKEWORD(2, 2), &WsaData);
|
||||
|
||||
memset(&g_globalConfig, 0, sizeof(SDK_CONFIG));
|
||||
|
||||
g_globalConfig.isWorkServer = isWorkServer;
|
||||
g_globalConfig.usedSCGProxy = false;
|
||||
g_globalConfig.isWorkServer = isWorkServer;
|
||||
g_globalConfig.scgProxy.scgGwPort = 0;
|
||||
|
||||
if (pWorkDir == nullptr) {
|
||||
// 获取当前文件默认路径
|
||||
|
@ -156,6 +159,10 @@ int TunnelSDKInitEnv(const TCHAR *pWorkDir,
|
|||
|
||||
StringCbPrintf(g_globalConfig.cfgPath, MAX_PATH, TEXT("%s\\%s"), g_globalConfig.workDirectory, CONFIG_FILE_NAME);
|
||||
|
||||
if ((ret = InitializeWireGuardLibrary()) == ERR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (FindWireguardExe(nullptr, 0) != ERR_SUCCESS) {
|
||||
SPDLOG_ERROR(TEXT("WireGuard not found, Please install WireGuard first or set the WireGuard Path."));
|
||||
|
@ -169,15 +176,40 @@ int TunnelSDKInitEnv(const TCHAR *pWorkDir,
|
|||
void TunnelSDKUnInit() {
|
||||
RemoteWireGuardControl(false);
|
||||
LocalWireGuardControl(false, false);
|
||||
UnInitializeWireGuardLibrary();
|
||||
CoFreeUnusedLibraries();
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
void EnableSCGProxy(bool isEnable) {
|
||||
g_globalConfig.usedSCGProxy = isEnable;
|
||||
int EnableSCGProxy(bool isEnable, const TCHAR *pSCGIpAddr, int scgPort) {
|
||||
|
||||
if (pSCGIpAddr == nullptr || lstrlen(pSCGIpAddr) == 0 || lstrlen(pSCGIpAddr) >= MAX_IP_LEN) {
|
||||
SPDLOG_ERROR(TEXT("Input pInterfaceName params error: {0}"), pSCGIpAddr);
|
||||
return -ERR_INPUT_PARAMS;
|
||||
}
|
||||
|
||||
memset(g_globalConfig.scgProxy.scgIpAddr, 0, MAX_IP_LEN);
|
||||
|
||||
if (isEnable) {
|
||||
IP_INFO ipInfo;
|
||||
int ret;
|
||||
if ((ret = GetIpV4InfoFromHostname(AF_INET, pSCGIpAddr, &ipInfo)) != ERR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
StringCbCopy(g_globalConfig.scgProxy.scgIpAddr, MAX_IP_LEN, ipInfo.hostip);
|
||||
g_globalConfig.scgProxy.scgGwPort = static_cast<UINT16>(scgPort);
|
||||
CreateUDPProxyServer();
|
||||
} else {
|
||||
StopUDPProxyServer();
|
||||
g_globalConfig.scgProxy.scgGwPort = 0;
|
||||
}
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
bool GetSCGProxyStatus() {
|
||||
return g_globalConfig.usedSCGProxy;
|
||||
bool UsedSCGProxy() {
|
||||
return (g_globalConfig.scgProxy.scgGwPort > 0);
|
||||
}
|
||||
|
||||
void TunnelLogEnable(bool enLog) {
|
|
@ -9,8 +9,6 @@
|
|||
#include "misc.h"
|
||||
#include "network.h"
|
||||
|
||||
#define USED_EMBEDDED_WG (1)
|
||||
|
||||
#pragma comment(lib, "Shlwapi.lib")
|
||||
#pragma comment(lib, "Winmm.lib")
|
||||
|
||||
|
@ -53,38 +51,12 @@ int WireGuardInstallDefaultServerService(bool bInstall) {
|
|||
StringCbCopy(svrName, MAX_PATH, cfgVal);
|
||||
PathStripPath(svrName);
|
||||
PathRemoveExtension(svrName);
|
||||
|
||||
#if USED_EMBEDDED_WG
|
||||
|
||||
if (bInstall) {
|
||||
ret = WireGuardInstallServerService(cfgVal); //CreateWireGuardService(svrName, cfgVal);
|
||||
} else {
|
||||
ret = RemoveGuardService(svrName, true);
|
||||
}
|
||||
#else
|
||||
if (bInstall) {
|
||||
// 安装服务
|
||||
StringCbPrintf(cmdBuf,
|
||||
MAX_PATH,
|
||||
TEXT("\"%s\" /installtunnelservice \"%s\""),
|
||||
GetGlobalCfgInfo()->wireguardCfg.wireguardPath,
|
||||
cfgVal);
|
||||
} else {
|
||||
// 卸载服务
|
||||
|
||||
StringCbPrintf(cmdBuf,
|
||||
MAX_PATH,
|
||||
TEXT("\"%s\" /uninstalltunnelservice %s"),
|
||||
GetGlobalCfgInfo()->wireguardCfg.wireguardPath,
|
||||
svrName);
|
||||
}
|
||||
|
||||
if ((ret = RunCommand(cmdBuf, nullptr, 0, &retCode)) != ERR_SUCCESS) {
|
||||
SPDLOG_ERROR(TEXT("Run command [{0}] error: {1}"), cmdBuf, ret);
|
||||
return -ERR_CALL_SHELL;
|
||||
}
|
||||
|
||||
SPDLOG_DEBUG(TEXT("Run command [{0}]"), cmdBuf);
|
||||
#endif
|
||||
|
||||
if (bInstall && ret == ERR_SUCCESS) {
|
||||
int retry = 10;
|
||||
|
@ -127,22 +99,6 @@ int WireGuardInstallServerService(const TCHAR *pTunnelCfgPath) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
// 安装服务
|
||||
StringCbPrintf(cmdBuf,
|
||||
MAX_PATH,
|
||||
TEXT("\"%s\" /installtunnelservice \"%s\""),
|
||||
GetGlobalCfgInfo()->wireguardCfg.wireguardPath,
|
||||
pTunnelCfgPath);
|
||||
|
||||
if ((ret = RunCommand(cmdBuf, nullptr, 0, &retCode)) != ERR_SUCCESS) {
|
||||
SPDLOG_ERROR(TEXT("Run command [{0}] error: {1}"), cmdBuf, ret);
|
||||
return -ERR_CALL_SHELL;
|
||||
}
|
||||
|
||||
SPDLOG_DEBUG(TEXT("Run command [{0}]"), cmdBuf);
|
||||
#endif
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -154,32 +110,12 @@ int WireGuardUnInstallServerService(const TCHAR *pTunnelName) {
|
|||
SPDLOG_ERROR(TEXT("Input pTunnelName params error"));
|
||||
return -ERR_INPUT_PARAMS;
|
||||
}
|
||||
|
||||
#if 0
|
||||
StringCbCopy(svrName, MAX_PATH, pTunnelName);
|
||||
PathStripPath(svrName);
|
||||
PathRemoveExtension(svrName);
|
||||
#endif
|
||||
|
||||
#if USED_EMBEDDED_WG
|
||||
|
||||
if ((ret = RemoveGuardService(pTunnelName, true)) != ERR_SUCCESS) {
|
||||
SPDLOG_ERROR(TEXT("Stop WireGuard Service Error: {0}"), ret);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
StringCbPrintf(cmdBuf,
|
||||
MAX_PATH,
|
||||
TEXT("\"%s\" /uninstalltunnelservice %s"),
|
||||
GetGlobalCfgInfo()->wireguardCfg.wireguardPath,
|
||||
svrName);
|
||||
|
||||
if ((ret = RunCommand(cmdBuf, nullptr, 0, &retCode)) != ERR_SUCCESS) {
|
||||
SPDLOG_ERROR(TEXT("Run command [{0}] error: {1}"), cmdBuf, ret);
|
||||
return -ERR_CALL_SHELL;
|
||||
}
|
||||
|
||||
SPDLOG_DEBUG(TEXT("Run command [{0}]"), cmdBuf);
|
||||
#endif
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -213,39 +149,7 @@ int IsWireGuardServerInstalled(bool *pIsInstalled) {
|
|||
}
|
||||
|
||||
int IsWireGuardServerRunning(const TCHAR *pIfName, bool *pIsRunning) {
|
||||
#if USED_EMBEDDED_WG
|
||||
return GetWireGuardServiceStatus(pIfName, pIsRunning);
|
||||
#else
|
||||
int ret;
|
||||
PNIC_CONTENT pInfo = nullptr;
|
||||
int size = 0;
|
||||
|
||||
if (pIfName == nullptr || lstrlen(pIfName) == 0) {
|
||||
SPDLOG_ERROR(TEXT("Input pIfName params error"));
|
||||
return -ERR_INPUT_PARAMS;
|
||||
}
|
||||
|
||||
if (pIsRunning == nullptr) {
|
||||
SPDLOG_ERROR(TEXT("Input pIsRunning params error"));
|
||||
return -ERR_INPUT_PARAMS;
|
||||
}
|
||||
|
||||
*pIsRunning = false;
|
||||
|
||||
ret = GetAllNICInfo(&pInfo, &size);
|
||||
if (ret != ERR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (StrNCmp(pInfo[i].NetCardDescription, WG_NIC_DISCRIPT, lstrlen(WG_NIC_DISCRIPT)) == 0 &&
|
||||
StrCmp(pInfo[i].NetCardName, pIfName) == 0) {
|
||||
*pIsRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
int WireGuardCreateClientConfig(const PWGCLIENT_CONFIG pWgConfig) {
|
||||
|
@ -523,9 +427,21 @@ int WireGuardCreateServerConfig(const PWGSERVER_CONFIG pWgConfig) {
|
|||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO: Change implement
|
||||
int GenerateWireguardKeyPairs(TCHAR *pPubKey, int pubkeySize, TCHAR *pPrivKey, int privKeySize) {
|
||||
#if 0
|
||||
|
||||
/**
|
||||
* @brief 创建 WireGuard 密钥对
|
||||
* @param[out] pPubKey 公钥缓冲区
|
||||
* @param[in] pubkeySize 公钥缓冲区大小(字节数)
|
||||
* @param[out] pPrivKey 私钥缓冲区
|
||||
* @param[in] privKeySize 私钥缓冲区大小(字节数)
|
||||
* @return 函数执行结果 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_ITEM_UNEXISTS WireGuard 未配置或未安装
|
||||
* - -ERR_CALL_SHELL 调用操作系统命令行工具失败
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
int GenerateWireguardKeyPairs(TCHAR *pPubKey, int pubkeySize, TCHAR *pPrivKey, int privKeySize) {
|
||||
|
||||
int ret;
|
||||
DWORD retCode;
|
||||
TCHAR cmdBuffer[MAX_PATH];
|
||||
|
@ -565,11 +481,18 @@ int GenerateWireguardKeyPairs(TCHAR *pPubKey, int pubkeySize, TCHAR *pPrivKey, i
|
|||
|
||||
StringCbCopy(pPubKey, pubkeySize, cmdResult);
|
||||
SPDLOG_DEBUG(TEXT("Run command [{0}] resutl \'{1}\'"), cmdBuffer, cmdResult);
|
||||
#endif
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* @brief 设置 wireguard.exe 程序路径
|
||||
* @param[in] pPath wireguard.exe 程序路径
|
||||
* @return 函数执行结果 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_INPUT_PARAMS 输入参数错误
|
||||
* - -ERR_ITEM_UNEXISTS 文件不存在
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
int SetWireguardPath(const TCHAR *pPath) {
|
||||
if (pPath == nullptr) {
|
||||
return -ERR_INPUT_PARAMS;
|
||||
|
@ -599,7 +522,16 @@ int SetWireguardPath(const TCHAR *pPath) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 查找 WireGuard 运行环境
|
||||
* @param[out] pFullPath wireguard.exe 程序路径
|
||||
* @param[in] maxSize pFullPath 缓冲区最大字节数
|
||||
* @return 函数执行结果 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_INPUT_PARAMS 输入参数错误
|
||||
* - -ERR_MALLOC_MEMORY 分配内存失败
|
||||
* - -ERR_FILE_NOT_EXISTS 文件不存在
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
int FindWireguardExe(TCHAR *pFullPath, int maxSize) {
|
||||
TCHAR path[MAX_PATH];
|
||||
TCHAR wireguardPath[MAX_PATH];
|
||||
|
@ -735,6 +667,16 @@ int FindWireguardExe(TCHAR *pFullPath, int maxSize) {
|
|||
return -ERR_FILE_NOT_EXISTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 安装 Windows NAT 自定义 PowerShell 命令
|
||||
* @return 0: 成功, 小于0 失败 @see USER_ERRNO
|
||||
* - -ERR_INPUT_PARAMS 输入参数错误
|
||||
* - -ERR_OPEN_FILE 打开文件失败
|
||||
* - -ERR_MEMORY_STR 字符串处理
|
||||
* - -ERR_ITEM_UNEXISTS 资源不存在
|
||||
* - -ERR_CALL_SHELL 调用系统命令行失败
|
||||
* - ERR_SUCCESS 成功
|
||||
*/
|
||||
int InstallWindowsNATCommand() {
|
||||
TCHAR psCmdPath[MAX_PATH];
|
||||
|
|
@ -1,13 +1,12 @@
|
|||
// NetTunnelSDKTestApp.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
||||
//
|
||||
|
||||
#include "globalcfg.h"
|
||||
|
||||
#include <strsafe.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "tunnel.h"
|
||||
|
||||
#include "globalcfg.h"
|
||||
#include "network.h"
|
||||
#include "user.h"
|
||||
#include "usrerr.h"
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>../NetTunnelSDK;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\NetTunnelSDK\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -137,6 +137,7 @@
|
|||
<ClCompile Include="NetShare.cpp" />
|
||||
<ClCompile Include="NetTunnelSDKTestApp.cpp" />
|
||||
<ClCompile Include="RouteTable.cpp" />
|
||||
<ClCompile Include="WireGurad.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="common.h" />
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
<ClCompile Include="NetNat.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WireGurad.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="common.h">
|
||||
|
|
|
@ -57,7 +57,7 @@ static void LogToSystemEventLog(int wErrorType, int wCustumerCode, const TCHAR *
|
|||
}
|
||||
}
|
||||
|
||||
static HMODULE InitializeWireGuardNT(void) {
|
||||
static HMODULE InitializeTunnelLibrary() {
|
||||
const HMODULE tunnel = LoadLibraryExW(L"tunnel.dll",
|
||||
nullptr,
|
||||
LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
|
@ -85,7 +85,7 @@ int _tmain(int wargc, _TCHAR *wargv[]) {
|
|||
|
||||
if (wargc == 3 && !wcscmp(wargv[1], L"/service")) {
|
||||
BOOL ret;
|
||||
const HMODULE hModule = InitializeWireGuardNT();
|
||||
const HMODULE hModule = InitializeTunnelLibrary();
|
||||
|
||||
if (!hModule || !WireGuardTunnelService) {
|
||||
StringCbPrintf(tMsg, MAX_PATH, TEXT("Init WireGuardTunnelService Service Error: %d\n"), GetLastError());
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#include "pch.h"
|
||||
#include "CppUnitTest.h"
|
||||
#include "../NetTunnelSDK/tunnel.h"
|
||||
#include "../NetTunnelSDK/usrerr.h"
|
||||
#include "../NetTunnelSDK/misc.h"
|
||||
#include "../NetTunnelSDK/globalcfg.h"
|
||||
#include "../NetTunnelSDK/network.h"
|
||||
#include "../NetTunnelSDK/user.h"
|
||||
#include "../NetTunnelSDK/protocol.h"
|
||||
#include "globalcfg.h"
|
||||
#include "tunnel.h"
|
||||
#include "usrerr.h"
|
||||
#include "misc.h"
|
||||
#include "network.h"
|
||||
#include "user.h"
|
||||
|
||||
#include <strsafe.h>
|
||||
|
||||
|
@ -35,7 +34,7 @@ TEST_MODULE_CLEANUP(ModuleCleanup) {
|
|||
TEST_CLASS(TestNetTunnelSDK) {
|
||||
public:
|
||||
const int RET_OK = ERR_SUCCESS;
|
||||
|
||||
|
||||
TEST_METHOD(TestRunPipeCmd) {
|
||||
#if 0
|
||||
TCHAR buf[1024];
|
||||
|
@ -172,21 +171,20 @@ public:
|
|||
|
||||
TEST_METHOD(TestGetInterfaceGUIDByName) {
|
||||
GUID guid;
|
||||
|
||||
|
||||
Assert::AreEqual(RET_OK, GetInterfaceGUIDByName(TEXT("admin"), &guid));
|
||||
Assert::AreNotEqual(0, static_cast<int>(guid.Data1));
|
||||
|
||||
//Assert::AreEqual(RET_OK, ProtoGetUserConfigure("admin", "asfdsafdladf083asldf+="));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestSetNATRule) {
|
||||
Assert::AreEqual(RET_OK, SetNATRule(TEXT("admin"), TEXT("10.10.10.250/24")));
|
||||
TEST_METHOD(TestSetNATRule) {
|
||||
Assert::AreEqual(RET_OK, SetNATRule(TEXT("admin"), TEXT("10.10.10.250/24")));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestRemoveNATRule) {
|
||||
Assert::AreEqual(RET_OK, RemoveNATRule(TEXT("admin")));
|
||||
Assert::AreEqual(RET_OK, RemoveNATRule(TEXT("admin")));
|
||||
}
|
||||
|
||||
|
||||
TEST_METHOD(TestGetInterfaceIfIndexByIpAddr) {
|
||||
ULONG index = -1;
|
||||
|
@ -203,9 +201,23 @@ public:
|
|||
Assert::AreEqual(RET_OK, RemoteWireGuardControl(true));
|
||||
Assert::AreEqual(RET_OK, LocalWireGuardControl(true, true));
|
||||
|
||||
//EnableSCGProxy(true, 10000);
|
||||
|
||||
//Assert::AreEqual(RET_OK, RemoteWireGuardControl(false));
|
||||
//Assert::AreEqual(RET_OK, LocalWireGuardControl(false, false));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestClientProgressFree) {
|
||||
Assert::AreEqual(RET_OK, RemoteWireGuardControl(false));
|
||||
Assert::AreEqual(RET_OK, LocalWireGuardControl(false, false));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestGetWireGuradTunnelInfo) {
|
||||
|
||||
Assert::AreEqual(RET_OK, GetWireGuradTunnelInfo(TEXT("admin")));
|
||||
|
||||
//Assert::AreEqual(RET_OK, RemoteWireGuardControl(false));
|
||||
//Assert::AreEqual(RET_OK, LocalWireGuardControl(false, false));
|
||||
}
|
||||
};
|
||||
}
|
|
@ -92,7 +92,7 @@
|
|||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\NetTunnelSDK\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
|
|
|
@ -21,164 +21,254 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetTunnelSDKTestApp", "NetT
|
|||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A} = {1584BAD4-DBEC-43D2-BC06-08C23F02489A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InstallTunnelSDK", "InstallTunnelSDK\InstallTunnelSDK.vdproj", "{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetTunnelSvr", "NetTunnelSvr\NetTunnelSvr.vcxproj", "{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}"
|
||||
EndProject
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InstallerSDK_amd64", "InstallerSDK_amd64\InstallerSDK_amd64.vdproj", "{709C9DD6-6B42-40A9-AA70-629274A75BAC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug DLL|Any CPU = Debug DLL|Any CPU
|
||||
Debug DLL|ARM = Debug DLL|ARM
|
||||
Debug DLL|ARM64 = Debug DLL|ARM64
|
||||
Debug DLL|x64 = Debug DLL|x64
|
||||
Debug DLL|x86 = Debug DLL|x86
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release DLL|Any CPU = Release DLL|Any CPU
|
||||
Release DLL|ARM = Release DLL|ARM
|
||||
Release DLL|ARM64 = Release DLL|ARM64
|
||||
Release DLL|x64 = Release DLL|x64
|
||||
Release DLL|x86 = Release DLL|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|Any CPU.ActiveCfg = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|Any CPU.Build.0 = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|ARM.ActiveCfg = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|ARM.Build.0 = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|ARM64.ActiveCfg = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|ARM64.Build.0 = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|x64.ActiveCfg = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|x64.Build.0 = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|x86.ActiveCfg = Debug|Win32
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug DLL|x86.Build.0 = Debug|Win32
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|ARM.Build.0 = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|ARM64.ActiveCfg = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|ARM64.Build.0 = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|x64.Build.0 = Debug|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Debug|x86.Build.0 = Debug|Win32
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|Any CPU.ActiveCfg = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|Any CPU.Build.0 = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|ARM.ActiveCfg = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|ARM.Build.0 = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|ARM64.ActiveCfg = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|ARM64.Build.0 = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|x64.ActiveCfg = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|x64.Build.0 = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|x86.ActiveCfg = Release|Win32
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release DLL|x86.Build.0 = Release|Win32
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|Any CPU.Build.0 = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|ARM.ActiveCfg = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|ARM.Build.0 = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|ARM64.ActiveCfg = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|ARM64.Build.0 = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|x64.ActiveCfg = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|x64.Build.0 = Release|x64
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|x86.ActiveCfg = Release|Win32
|
||||
{1584BAD4-DBEC-43D2-BC06-08C23F02489A}.Release|x86.Build.0 = Release|Win32
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|Any CPU.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|ARM.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|ARM.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|ARM64.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|x64.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|x64.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|x86.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug DLL|x86.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|Any CPU.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|ARM.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|ARM.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|ARM64.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|ARM64.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|x64.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|x64.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|x86.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release DLL|x86.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|x64.Build.0 = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{79995848-FD05-46F5-A7FE-46265E540E32}.Release|x86.Build.0 = Release|Any CPU
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|Any CPU.ActiveCfg = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|Any CPU.Build.0 = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|ARM.ActiveCfg = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|ARM.Build.0 = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|ARM64.ActiveCfg = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|ARM64.Build.0 = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|x64.ActiveCfg = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|x64.Build.0 = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|x86.ActiveCfg = Debug|Win32
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug DLL|x86.Build.0 = Debug|Win32
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|ARM.Build.0 = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|ARM64.ActiveCfg = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|ARM64.Build.0 = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|x64.Build.0 = Debug|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|Any CPU.ActiveCfg = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|Any CPU.Build.0 = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|ARM.ActiveCfg = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|ARM.Build.0 = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|ARM64.ActiveCfg = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|ARM64.Build.0 = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|x64.ActiveCfg = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|x64.Build.0 = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|x86.ActiveCfg = Release|Win32
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release DLL|x86.Build.0 = Release|Win32
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|Any CPU.Build.0 = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|ARM.ActiveCfg = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|ARM.Build.0 = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|ARM64.ActiveCfg = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|ARM64.Build.0 = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|x64.ActiveCfg = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|x64.Build.0 = Release|x64
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{61FE87EB-A3BA-4A7E-971C-69CB05F5C81C}.Release|x86.Build.0 = Release|Win32
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|Any CPU.ActiveCfg = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|Any CPU.Build.0 = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|ARM.ActiveCfg = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|ARM.Build.0 = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|ARM64.ActiveCfg = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|ARM64.Build.0 = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|x64.ActiveCfg = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|x64.Build.0 = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|x86.ActiveCfg = Debug|Win32
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug DLL|x86.Build.0 = Debug|Win32
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|ARM.Build.0 = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|ARM64.ActiveCfg = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|ARM64.Build.0 = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|x64.Build.0 = Debug|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|Any CPU.ActiveCfg = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|Any CPU.Build.0 = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|ARM.ActiveCfg = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|ARM.Build.0 = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|ARM64.ActiveCfg = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|ARM64.Build.0 = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|x64.ActiveCfg = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|x64.Build.0 = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|x86.ActiveCfg = Release|Win32
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release DLL|x86.Build.0 = Release|Win32
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|Any CPU.Build.0 = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|ARM.ActiveCfg = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|ARM.Build.0 = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|ARM64.ActiveCfg = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|ARM64.Build.0 = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|x64.ActiveCfg = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|x64.Build.0 = Release|x64
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{9F44F41E-FACF-472D-A382-A40D0A84DB2C}.Release|x86.Build.0 = Release|Win32
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug DLL|Any CPU.ActiveCfg = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug DLL|Any CPU.Build.0 = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug DLL|x64.ActiveCfg = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug DLL|x64.Build.0 = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug DLL|x86.ActiveCfg = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug DLL|x86.Build.0 = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug|Any CPU.ActiveCfg = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug|x64.ActiveCfg = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Debug|x86.ActiveCfg = Debug
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release DLL|Any CPU.ActiveCfg = Release
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release DLL|Any CPU.Build.0 = Release
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release DLL|x64.ActiveCfg = Release
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release DLL|x64.Build.0 = Release
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release DLL|x86.ActiveCfg = Release
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release DLL|x86.Build.0 = Release
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release|Any CPU.ActiveCfg = Release
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release|x64.ActiveCfg = Release
|
||||
{FE91D4D0-29A6-4C58-874F-11F6AC1D50CD}.Release|x86.ActiveCfg = Release
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|Any CPU.ActiveCfg = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|Any CPU.Build.0 = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|ARM.ActiveCfg = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|ARM.Build.0 = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|ARM64.ActiveCfg = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|ARM64.Build.0 = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|x64.ActiveCfg = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|x64.Build.0 = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|x86.ActiveCfg = Debug|Win32
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug DLL|x86.Build.0 = Debug|Win32
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|ARM.Build.0 = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|ARM64.ActiveCfg = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|ARM64.Build.0 = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|x64.Build.0 = Debug|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Debug|x86.Build.0 = Debug|Win32
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|Any CPU.ActiveCfg = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|Any CPU.Build.0 = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|ARM.ActiveCfg = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|ARM.Build.0 = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|ARM64.ActiveCfg = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|ARM64.Build.0 = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|x64.ActiveCfg = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|x64.Build.0 = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|x86.ActiveCfg = Release|Win32
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release DLL|x86.Build.0 = Release|Win32
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|Any CPU.Build.0 = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|ARM.ActiveCfg = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|ARM.Build.0 = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|ARM64.ActiveCfg = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|ARM64.Build.0 = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|x64.ActiveCfg = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|x64.Build.0 = Release|x64
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|x86.ActiveCfg = Release|Win32
|
||||
{0A2EEDAF-F4A8-41E0-A874-2F30D1EEB55E}.Release|x86.Build.0 = Release|Win32
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug DLL|Any CPU.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug DLL|ARM.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug DLL|ARM64.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug DLL|x64.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug DLL|x86.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug|Any CPU.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug|ARM.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug|ARM64.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug|x64.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Debug|x86.ActiveCfg = Debug
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release DLL|Any CPU.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release DLL|ARM.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release DLL|ARM64.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release DLL|x64.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release DLL|x86.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release|Any CPU.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release|ARM.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release|ARM64.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release|x64.ActiveCfg = Release
|
||||
{709C9DD6-6B42-40A9-AA70-629274A75BAC}.Release|x86.ActiveCfg = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
Loading…
Reference in New Issue