change wireguard vpn protocol implementation on Windows from wg.exe to wireguard windows embeddable-dll-service
This commit is contained in:
parent
d553d7f772
commit
6042317552
13 changed files with 243 additions and 3 deletions
31
service/wireguard-service/main.cpp
Normal file
31
service/wireguard-service/main.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "wireguardtunnelservice.h"
|
||||
#include <strsafe.h>
|
||||
#include <Windows.h>
|
||||
|
||||
int wmain(int argc, wchar_t** argv)
|
||||
{
|
||||
if (argc != 3) {
|
||||
debug_log(L"Wrong argument provided");
|
||||
return 1;
|
||||
}
|
||||
TCHAR option[20];
|
||||
TCHAR configFile[5000];
|
||||
|
||||
StringCchCopy(option, 20, argv[1]);
|
||||
StringCchCopy(configFile, 5000, argv[2]);
|
||||
|
||||
WireguardTunnelService tunnel(configFile);
|
||||
|
||||
if (lstrcmpi(option, TEXT("--run")) == 0) {
|
||||
debug_log(L"start tunnel");
|
||||
tunnel.startTunnel();
|
||||
} else if (lstrcmpi(option, TEXT("--add")) == 0) {
|
||||
tunnel.addService();
|
||||
} else if (lstrcmpi(option, TEXT("--remove")) == 0) {
|
||||
tunnel.removeService();
|
||||
} else {
|
||||
debug_log(L"Wrong argument provided");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue