OCT 1. 更新端口映射隧道网络配置
This commit is contained in:
parent
933c653a18
commit
7f2f686228
|
@ -45,7 +45,7 @@ public partial class MainForm : Form
|
|||
var path = Environment.CurrentDirectory + "\\tunnelsdk_" +
|
||||
string.Format("{0:yyyyMMdd}", DateTime.Now) + ".log";
|
||||
//NetTunnelLib.InitTunnelSDKLog(path, LogLevel.LOG_DEBUG);
|
||||
NetTunnelLib.TunnelSDKInitEnv(Environment.CurrentDirectory, "http://172.21.40.39:32549", path, LogLevel.LOG_TRACE, menuSetModeServer.Checked);
|
||||
NetTunnelLib.TunnelSDKInitEnv(Environment.CurrentDirectory, "http://xajhuang.com:9276", path, LogLevel.LOG_TRACE, menuSetModeServer.Checked);
|
||||
//NetTunnelLib.EnableSCGProxy(true, "efc.xajhuang.com", 10001);
|
||||
GetCurrentNetCard();
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ int RemoteCtrlSvrCfgUserTunnel(int vmId, const TCHAR *pCliNetwork) {
|
|||
req.msgContent.cliPublicKey = pUserCfg->cliPublicKey;
|
||||
req.msgContent.cliNetwork = pCliNetwork;
|
||||
GetIpV4InfoFromCIDR(pUserCfg->cliAddress, &ipInfo);
|
||||
req.msgContent.cliTunnelAddr = ipInfo.ip;
|
||||
req.msgContent.cliTunnelAddr = std::string(ipInfo.network) + "/" + std::to_string(ipInfo.prefix);
|
||||
|
||||
GetGlobalCfgInfo()->curConnVmId = vmId;
|
||||
SPDLOG_DEBUG(TEXT("Current VMID: {0}"), vmId);
|
||||
|
@ -376,11 +376,16 @@ int SetTunnelConfigure(const TCHAR *pCliPrivateKey,
|
|||
StringCbCopy(cliCfg.PrivateKey, 64, pCliPrivateKey);
|
||||
StringCbCopy(cliCfg.Address, 32, pCliNetwork);
|
||||
StringCbCopy(cliCfg.SvrPubKey, 64, pSvrPublicKey);
|
||||
|
||||
#if USED_PORTMAP_TUNNEL
|
||||
StringCbCopy(cliCfg.ServerURL, 256, pSvrEndPoint);
|
||||
#else
|
||||
if (UsedSCGProxy()) {
|
||||
StringCbPrintf(cliCfg.ServerURL, 256, TEXT("127.0.0.1:%d"), GetGlobalCfgInfo()->scgProxy.proxyPort);
|
||||
} else {
|
||||
StringCbCopy(cliCfg.ServerURL, 256, pSvrEndPoint);
|
||||
}
|
||||
#endif
|
||||
|
||||
StringCbPrintf(cliCfg.AllowNet,
|
||||
256,
|
||||
|
@ -602,8 +607,6 @@ int GetUserClientConfigure(const TCHAR *pUserName, const TCHAR *pToken, PUSER_CL
|
|||
StringCbPrintf(pVm->scgTunnelGw, MAX_PATH, TEXT("%s:%d"), vm.portMapIp.c_str(), vm.portMapPort);
|
||||
#else
|
||||
StringCbPrintf(pVm->scgTunnelGw, MAX_PATH, TEXT("%s:%d"), vm.scgIp.c_str(), vm.scgPort - 1);
|
||||
#endif
|
||||
#if USED_PORTMAP_TUNNEL
|
||||
#endif
|
||||
pVm++;
|
||||
}
|
||||
|
|
|
@ -34,12 +34,12 @@ public:
|
|||
class VitrualMathineInfo {
|
||||
public:
|
||||
VitrualMathineInfo() {
|
||||
this->vmId = 0;
|
||||
this->scgPort = 0;
|
||||
this->vmName = TEXT("");
|
||||
this->scgIp = TEXT("");
|
||||
this->vmNetwork = TEXT("");
|
||||
this->svrPubKey = TEXT("");
|
||||
this->vmId = 0;
|
||||
this->scgPort = 0;
|
||||
this->vmName = TEXT("");
|
||||
this->scgIp = TEXT("");
|
||||
this->vmNetwork = TEXT("");
|
||||
this->svrPubKey = TEXT("");
|
||||
#if USED_PORTMAP_TUNNEL
|
||||
this->portMapIp = TEXT("");
|
||||
this->portMapPort = 0;
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
std::string cliHost;
|
||||
std::list<VitrualMathineInfo> vmInfoList;
|
||||
|
||||
AIGC_JSON_HELPER(scgCtrlAppId, scgTunnelAppId, cliPriKey, cliPubKey, vmInfoList, cliHost)
|
||||
AIGC_JSON_HELPER(cliPriKey, cliPubKey, vmInfoList, cliHost)
|
||||
};
|
||||
|
||||
class PlatformRspServerCfgParams {
|
||||
|
|
|
@ -14,15 +14,14 @@ namespace TestNetTunnelSDK {
|
|||
TEST_MODULE_INITIALIZE(ModuleInitialize) {
|
||||
const TCHAR *path = TEXT(
|
||||
"C:\\Users\\HuangXin\\Documents\\development\\visual_studio\\tunnel_windows\\NetTunnelApp\\bin\\Debug");
|
||||
//const TCHAR* pSvrUsr = TEXT("https://112.17.28.201:1443");
|
||||
const TCHAR *pSvrUsr = TEXT("https://112.17.28.200:1443");
|
||||
//const TCHAR* pSvrUsr = TEXT("http://xajhuang.com:9276");
|
||||
|
||||
Logger::WriteMessage("In Module Initialize:\n");
|
||||
Assert::AreEqual(0,
|
||||
TunnelSDKInitEnv(path,
|
||||
"http://172.21.40.194:32549",
|
||||
TEXT("./test/utest.log"),
|
||||
LOG_TRACE,
|
||||
false));
|
||||
//Assert::AreEqual(0, EnableVerifySignature(TEXT("123"), TEXT("123456")));
|
||||
Assert::AreEqual(0, TunnelSDKInitEnv(path, pSvrUsr, TEXT("./test/utest.log"), LOG_TRACE, false));
|
||||
|
||||
Assert::AreEqual(0, EnableVerifySignature(TEXT("sc-winvdisdk-efa9v12xwtz5eppr"), TEXT("lh5r8sw6m9m416nm")));
|
||||
//Assert::AreEqual(0, EnableSCGProxy(true, TEXT("efc.xajhuang.com"), 10001));
|
||||
}
|
||||
|
||||
|
@ -221,15 +220,18 @@ public:
|
|||
GetUserClientConfigure(
|
||||
TEXT("admin"),
|
||||
TEXT("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9."
|
||||
"eyJ1c2VyX25hbWUiOiIxNjg5MTAyMjczNzEzMTg0NzY4Iiwic2NvcGUiOlsiYWxsIl0sInVzZXJUeXBlIjoidXNlciIsImV4c"
|
||||
"CI6MTY5NDg1NDM0MSwiYXV0aG9yaXRpZXMiOlsiUk9MRV9SRVRBSU58MCJdLCJqdGkiOiJDOG5HNFdFSWRIdGRDWDJ3X084a2"
|
||||
"xORlpYNVUiLCJhY2NvdW50IjoiY2hl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WQW0YPByS1Gt0SAsX4apB_k5xTDUNC-"
|
||||
"GwHfaGpICv8CAAIlyzXtQSVwC7QSFmLtuctg"),
|
||||
&pCfg));
|
||||
|
||||
//Assert::AreEqual(RET_OK, LocalWireGuardControl(true, true));
|
||||
//Assert::AreEqual(RET_OK, LocalWireGuardControl(false, false));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestClientProgress) {
|
||||
|
@ -237,7 +239,7 @@ public:
|
|||
Assert::AreEqual(RET_OK, GetUserClientConfigure(TEXT("admin"), TEXT("1323245235"), &pCfg));
|
||||
Assert::IsNotNull(pCfg);
|
||||
|
||||
Assert::AreEqual(RET_OK, RemoteCtrlSvrCfgUserTunnel(2, TEXT("172.18.2.0/24")));
|
||||
Assert::AreEqual(RET_OK, RemoteCtrlSvrCfgUserTunnel(347, TEXT("172.18.2.0/24")));
|
||||
Assert::AreEqual(RET_OK, RemoteWireGuardControl(true));
|
||||
Assert::AreEqual(RET_OK, LocalWireGuardControl(true, true));
|
||||
|
||||
|
@ -249,8 +251,41 @@ public:
|
|||
}
|
||||
|
||||
TEST_METHOD(TestClientProgressFree) {
|
||||
PUSER_CLIENT_CONFIG pCfg = nullptr;
|
||||
#if 0
|
||||
Assert::AreEqual(
|
||||
RET_OK,
|
||||
GetUserClientConfigure(
|
||||
TEXT("huangxin"),
|
||||
TEXT("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9."
|
||||
"eyJ1c2VyX25hbWUiOiIxNjk2NDA1MDY5MzQ1OTY4MTI4Iiwic2NvcGUiOlsiYWxsIl0sInVzZXJUeXBlIjoidXNlciIsImV4c"
|
||||
"CI6MTY5NTg4OTk4MywiYXV0aG9yaXRpZXMiOlsiUk9MRV9SRVRBSU58MCJdLCJqdGkiOiJmTGlSaDMzTFI1b2stU01wcEFNdX"
|
||||
"E2VV9nQjAiLCJhY2NvdW50IjoiaHVhbmd4aW4iLCJjbGllbnRfaWQiOiJzYy13aW52ZGlzZGstZWZhOXYxMnh3dHo1ZXBwciJ"
|
||||
"9.nDJ1hbukk-mGj-gD64WGAWogR4UWgvuw7B-2GKDHCVL4uylA-NRp2aqgJAriluwPGYub4-RWpKyLTRGi-GtsduuHp_"
|
||||
"hYKcjbzsxMx040-qkoG6trCbtV_UWr6tIKFTePRLBcsSSiH7D9nHxSgmbJiVay2_"
|
||||
"Q85ddUurF3jfdZ3AnkfWCC2Y1tfqEInkwqWRFqb17hDjpKNr__ZPmB3aOpR3jjOGbz4HI4s0nevQgzYW9MEscW-"
|
||||
"jtMws4i00jsHpS-dwfiybNB91JUsZT_g1BWQW0YPByS1Gt0SAsX4apB_k5xTDUNC-"
|
||||
"GwHfaGpICv8CAAIlyzXtQSVwC7QSFmLtuctg"),
|
||||
&pCfg));
|
||||
#else
|
||||
Assert::AreEqual(
|
||||
RET_OK,
|
||||
GetUserClientConfigure(
|
||||
TEXT("huangxin"),
|
||||
TEXT("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9."
|
||||
"eyJ1c2VyX25hbWUiOiIxNjk2NDA1MDY5MzQ1OTY4MTI4Iiwic2NvcGUiOlsiYWxsIl0sInVzZXJUeXBlIjoidXNlciIsImV4c"
|
||||
"CI6MTY5NjEyNzIwNiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9SRVRBSU58MCJdLCJqdGkiOiJxX1J0Y2lzWVVwMTJUalhCTW5DUH"
|
||||
"E0NjBwMVkiLCJhY2NvdW50IjoiaHVhbmd4aW4iLCJjbGllbnRfaWQiOiJzYy13aW52ZGlzZGstZWZhOXYxMnh3dHo1ZXBwciJ"
|
||||
"9.CC3oTE4XFKXN_URENXBPD4bWGDfsvb3yvnT7adaiP0kpjOc6Q7XfOQQO68fRg5RwaPdtBbLWywby0ZhiUyh4LDh-"
|
||||
"oDMyKaovyrX3ht7yHlLXpkgg8mdWWt_tTV9_DqPD_"
|
||||
"dSWJLzjWLkCxvW9nWyfXtJflXN3TljuUBaXaUB8FR5dDqcxPJytIDM0pq0RsmYpK8O-kkdyaOGblTmb_"
|
||||
"usj9yU8ZdMUQuMvywhl72_WaONiYeMwNtGvLvCdi0oRxGFwaOMDn4X29lZjvbsmEU12DwyuXPvX_"
|
||||
"JHkj9Sg3O7k9DYMU0W1ucfw9Jlnxt-9oZ6inOM9shVlAPG1LbgP0WDGaA"),
|
||||
&pCfg));
|
||||
#endif
|
||||
Assert::IsNotNull(pCfg);
|
||||
Assert::AreEqual(RET_OK, LocalWireGuardControl(false, false));
|
||||
Assert::AreEqual(RET_OK, RemoteWireGuardControl(false));
|
||||
//Assert::AreEqual(RET_OK, RemoteWireGuardControl(false));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestGetSDKErrorMessage) {
|
||||
|
|
Loading…
Reference in New Issue