1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-04-03 18:00:08 +03:00

Cedar/SM: Provide limited support for custom VPN Azure service

This commit is contained in:
Yihong Wu 2023-01-06 22:22:14 +09:00
parent a202baf464
commit 7025c36553
11 changed files with 69 additions and 21 deletions

View File

@ -260,6 +260,8 @@ void SmAzureSetStatus(HWND hWnd, SM_AZURE *a)
st.IsEnabled = IsChecked(hWnd, R_ENABLE);
st.UseCustom = a->UseCustom;
if (CALL(hWnd, ScSetAzureStatus(a->s->Rpc, &st)) == false)
{
EndDialog(hWnd, 0);
@ -342,7 +344,9 @@ void SmAzureDlgRefresh(HWND hWnd, SM_AZURE *a)
return;
}
if (CALL(hWnd, ScGetDDnsClientStatus(a->s->Rpc, &ddns)) == false)
a->UseCustom = st.UseCustom;
if (st.UseCustom == false && CALL(hWnd, ScGetDDnsClientStatus(a->s->Rpc, &ddns)) == false)
{
EndDialog(hWnd, 0);
return;
@ -360,21 +364,38 @@ void SmAzureDlgRefresh(HWND hWnd, SM_AZURE *a)
}
SetShow(hWnd, S_HOSTNAME_BORDER, st.IsEnabled);
SetShow(hWnd, S_HOSTNAME_INFO, st.IsEnabled);
SetShow(hWnd, S_HOSTNAME_INFO, st.IsEnabled && st.UseCustom == false);
SetShow(hWnd, S_HOSTNAME_CUSTOM, st.IsEnabled && st.UseCustom);
SetShow(hWnd, B_CHANGE, st.IsEnabled);
SetEnable(hWnd, B_CHANGE, st.IsEnabled && st.UseCustom == false);
if (st.IsEnabled == false || IsEmptyStr(ddns.CurrentHostName))
if (st.IsEnabled)
{
Hide(hWnd, E_HOST);
if (st.UseCustom && IsEmptyStr(st.CurrentHostname) == false)
{
StrCpy(tmp, sizeof(tmp), st.CurrentHostname);
SetTextA(hWnd, E_HOST, tmp);
Show(hWnd, E_HOST);
}
else if (st.UseCustom == false && IsEmptyStr(ddns.CurrentHostName) == false)
{
StrCpy(tmp, sizeof(tmp), ddns.CurrentHostName);
StrCat(tmp, sizeof(tmp), AZURE_DOMAIN_SUFFIX);
SetTextA(hWnd, E_HOST, tmp);
Show(hWnd, E_HOST);
}
else
{
Hide(hWnd, E_HOST);
}
}
else
{
StrCpy(tmp, sizeof(tmp), ddns.CurrentHostName);
StrCat(tmp, sizeof(tmp), AZURE_DOMAIN_SUFFIX);
SetTextA(hWnd, E_HOST, tmp);
Show(hWnd, E_HOST);
Hide(hWnd, E_HOST);
}
}
@ -18309,11 +18330,11 @@ void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p)
{
UniToStr3(s9, sizeof(s9),
e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes +
e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes);
e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes);
UniToStr3(s10, sizeof(s10),
e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount +
e->Traffic.Send.BroadcastCount + e->Traffic.Send.UnicastCount);
UniToStr3(s10, sizeof(s10),
e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount +
e->Traffic.Send.BroadcastCount + e->Traffic.Send.UnicastCount);
}
LvInsertAdd(b,
@ -18334,7 +18355,7 @@ void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p)
if (CALL(hWnd, ScEnumListener(p->Rpc, &t2)))
{
LVB *b = LvInsertStart();
for (i = 0;i < t2.NumPort;i++)
for (i = 0; i < t2.NumPort; i++)
{
wchar_t tmp[MAX_SIZE];
wchar_t *status;
@ -18403,17 +18424,34 @@ void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p)
// VPN Azure client state acquisition
Zero(&sta, sizeof(sta));
if (ScGetAzureStatus(p->Rpc, &sta) == ERR_NO_ERROR && sta.IsEnabled && IsEmptyStr(st.CurrentFqdn) == false)
if (ScGetAzureStatus(p->Rpc, &sta) == ERR_NO_ERROR && sta.IsEnabled)
{
char tmp[MAX_SIZE];
StrCpy(tmp, sizeof(tmp), st.CurrentHostName);
StrCat(tmp, sizeof(tmp), AZURE_DOMAIN_SUFFIX);
if (sta.UseCustom && IsEmptyStr(sta.CurrentHostname) == false)
{
StrCpy(tmp, sizeof(tmp), sta.CurrentHostname);
SetTextA(hWnd, E_AZURE_HOST, tmp);
SetTextA(hWnd, E_AZURE_HOST, tmp);
Show(hWnd, S_AZURE);
Show(hWnd, E_AZURE_HOST);
Show(hWnd, S_AZURE);
Show(hWnd, E_AZURE_HOST);
}
else if (sta.UseCustom == false && IsEmptyStr(st.CurrentFqdn) == false)
{
StrCpy(tmp, sizeof(tmp), st.CurrentHostName);
StrCat(tmp, sizeof(tmp), AZURE_DOMAIN_SUFFIX);
SetTextA(hWnd, E_AZURE_HOST, tmp);
Show(hWnd, S_AZURE);
Show(hWnd, E_AZURE_HOST);
}
else
{
Hide(hWnd, S_AZURE);
Hide(hWnd, E_AZURE_HOST);
}
}
else
{

View File

@ -375,6 +375,7 @@ typedef struct SM_AZURE
{
SM_SERVER *s;
bool OnSetup;
bool UseCustom;
} SM_AZURE;

View File

@ -4498,6 +4498,7 @@ BEGIN
CONTROL "@R_DISABLE",R_DISABLE,"Button",BS_AUTORADIOBUTTON,13,297,101,12
GROUPBOX "@S_HOSTNAME_BORDER",S_HOSTNAME_BORDER,123,264,204,48
LTEXT "@S_HOSTNAME_INFO",S_HOSTNAME_INFO,129,275,191,19
LTEXT "@S_HOSTNAME_CUSTOM",S_HOSTNAME_CUSTOM,129,275,191,19
EDITTEXT E_HOST,129,295,118,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
PUSHBUTTON "@B_CHANGE",B_CHANGE,252,293,67,15
PUSHBUTTON "@B_WEB",B_WEB,332,261,72,30,BS_MULTILINE

View File

@ -1030,6 +1030,7 @@
#define B_NEW 1521
#define R_TRUST_DEFAULT 1521
#define B_CLEAR 1522
#define S_HOSTNAME_CUSTOM 1523
#define B_ONLINE 1655
#define D_NM_CONNECT 1998
#define D_NM_MAIN 1999

View File

@ -4146,6 +4146,7 @@ R_ENABLE 启用 VPN Azure(&E)
R_DISABLE 禁用 VPN Azure(&D)
S_HOSTNAME_BORDER 当前 VPN Azure 主机名
S_HOSTNAME_INFO VPN Azure 主机名与动态 DNS 主机名相同但改变的域名后缀为“vpnazure.net”。
S_HOSTNAME_CUSTOM 自定义 VPN Azure 服务已启用。VPN Azure 主机名只能通过 vpncmd 命令更改。
B_CHANGE 变更主机名(&H)
B_WEB 如何使用 VPN Azure\r\n(访问网络)
IDCANCEL 确定(&O)

View File

@ -4134,6 +4134,7 @@ R_ENABLE &Enable VPN Azure
R_DISABLE &Disable VPN Azure
S_HOSTNAME_BORDER Current VPN Azure Hostname
S_HOSTNAME_INFO The VPN Azure hostname is same to the Dynamic DNS hostname, but altering the domain suffix to "vpnazure.net".
S_HOSTNAME_CUSTOM Custom VPN Azure service is enabled. The VPN Azure hostname can only be changed from the vpncmd command.
B_CHANGE Change &Hostname
B_WEB How to Use VPN Azure\r\n(Visit the Web)
IDCANCEL &OK

View File

@ -4139,6 +4139,7 @@ R_ENABLE VPN Azure を有効にする(&E)
R_DISABLE VPN Azure を無効にする(&D)
S_HOSTNAME_BORDER 現在の VPN Azure ホスト名
S_HOSTNAME_INFO VPN Azure ホスト名はダイナミック DNS サービスのホスト名のドメイン部分を "vpnazure.net" に変更したものが使用されます。
S_HOSTNAME_CUSTOM カスタム VPN Azure サービスが有効になっています。VPN Azure ホスト名は、vpncmd コマンドからのみ変更できます。
B_CHANGE ホスト名の変更(&H)
B_WEB VPN Azure の使い方\r\n(Web サイトを表示)
IDCANCEL &OK

View File

@ -4117,6 +4117,7 @@ R_ENABLE VPN Azure를 사용 (&E)
R_DISABLE VPN Azure를 비활성화 (&D)
S_HOSTNAME_BORDER 현재 VPN Azure 호스트 이름
S_HOSTNAME_INFO VPN Azure 호스트 이름은 동적 DNS 서비스 호스트 이름의 도메인 부분을 "vpnazure.net"로 변경 한 것이 사용됩니다.
S_HOSTNAME_CUSTOM Custom VPN Azure service is enabled. The VPN Azure hostname can only be changed from the vpncmd command.
B_CHANGE 호스트 이름 변경 (&H)
B_WEB VPN Azure 사용 \r\n (Web 사이트보기)
IDCANCEL & OK

View File

@ -3863,6 +3863,7 @@ R_ENABLE &Ativar VPN Azure
R_DISABLE &Desativar VPN Azure
S_HOSTNAME_BORDER Nome do host atual da VPN Azure
S_HOSTNAME_INFO O nome do host da VPN do Azure é igual ao nome do host do DNS dinâmico, mas alterando o sufixo do domínio para "vpnazure.net".
S_HOSTNAME_CUSTOM Custom VPN Azure service is enabled. The VPN Azure hostname can only be changed from the vpncmd command.
B_CHANGE Mudar &Hostname
B_WEB Como usar o VPN Azure\r\n (Visite o site)
IDCANCEL &OK

View File

@ -4133,6 +4133,7 @@ R_ENABLE &Enable VPN Azure
R_DISABLE &Disable VPN Azure
S_HOSTNAME_BORDER Current VPN Azure Hostname
S_HOSTNAME_INFO The VPN Azure hostname is same to the Dynamic DNS hostname, but altering the domain suffix to "vpnazure.net".
S_HOSTNAME_CUSTOM Custom VPN Azure service is enabled. The VPN Azure hostname can only be changed from the vpncmd command.
B_CHANGE Change &Hostname
B_WEB How to Use VPN Azure\r\n(Visit the Web)
IDCANCEL &OK

View File

@ -4146,6 +4146,7 @@ R_ENABLE 啟用 VPN Azure(&E)
R_DISABLE 禁用 VPN Azure(&D)
S_HOSTNAME_BORDER 當前 VPN Azure 主機名稱
S_HOSTNAME_INFO VPN Azure 主機名稱與動態 DNS 主機名稱相同但改變的功能變數名稱尾碼為“vpnazure.net”。
S_HOSTNAME_CUSTOM 自定義 VPN Azure 服務已啟用。VPN Azure 主機名稱只能通過 vpncmd 命令更改。
B_CHANGE 變更主機名稱(&H)
B_WEB 如何使用 VPN Azure\r\n(訪問網路)
IDCANCEL 確定(&O)