diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ed946e31..4a908ffb2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# v4.4.503
+# v4.4.506
### Client
* Update: Android: Show Notification & QuickLaunch Request after connect
* Update: Display AD without VPN
@@ -7,7 +7,10 @@
* Fix: minor issue in disconnect messages
* Deprecate: ServerProtocol Version 2 (451) is deprecated and no longer supported
-# v4.4.500
+### Server
+* Update: Support Flexible Ad
+
+# v4.4.500
### Client
* Update: Retry failed connection if the access token is updated from the server token URL
* Update: Move VpnHood Public Servers to VpnHood Connect App
diff --git a/Pub/PubVersion.json b/Pub/PubVersion.json
index 9fe7e47f8..54dbf9c7a 100644
--- a/Pub/PubVersion.json
+++ b/Pub/PubVersion.json
@@ -1,6 +1,6 @@
{
- "Version": "4.4.503",
- "BumpTime": "2024-05-11T08:27:59.0241406Z",
- "Prerelease": true,
+ "Version": "4.4.506",
+ "BumpTime": "2024-05-11T09:07:36.0577031Z",
+ "Prerelease": false,
"DeprecatedVersion": "4.0.00"
}
diff --git a/Tests/VpnHood.Test/Tests/AdTest.cs b/Tests/VpnHood.Test/Tests/AdTest.cs
index 60528dafd..cd7330cfe 100644
--- a/Tests/VpnHood.Test/Tests/AdTest.cs
+++ b/Tests/VpnHood.Test/Tests/AdTest.cs
@@ -64,7 +64,7 @@ public async Task flexible_ad_should_not_close_session_if_load_ad_failed()
await using var server = TestHelper.CreateServer(testAccessManager);
// create access item
- var accessItem = fileAccessManager.AccessItem_Create(displayAd: DisplayAd.Flexible);
+ var accessItem = fileAccessManager.AccessItem_Create(adShow: AdShow.Flexible);
accessItem.Token.ToAccessKey();
// create client app
@@ -89,7 +89,7 @@ public async Task flexible_ad_should_close_session_if_display_ad_failed()
await using var server = TestHelper.CreateServer(testAccessManager);
// create access item
- var accessItem = fileAccessManager.AccessItem_Create(displayAd: DisplayAd.Flexible);
+ var accessItem = fileAccessManager.AccessItem_Create(adShow: AdShow.Flexible);
accessItem.Token.ToAccessKey();
// create client app
@@ -115,7 +115,7 @@ public async Task Session_must_be_closed_after_few_minutes_if_ad_is_not_accepted
await using var server = TestHelper.CreateServer(testAccessManager);
// create access item
- var accessItem = fileAccessManager.AccessItem_Create(displayAd: DisplayAd.Required);
+ var accessItem = fileAccessManager.AccessItem_Create(adShow: AdShow.Required);
accessItem.Token.ToAccessKey();
// create client app
@@ -141,7 +141,7 @@ public async Task Session_expiration_must_increase_by_ad()
await using var server = TestHelper.CreateServer(testAccessManager);
// create access item
- var accessItem = fileAccessManager.AccessItem_Create(displayAd: DisplayAd.Required);
+ var accessItem = fileAccessManager.AccessItem_Create(adShow: AdShow.Required);
accessItem.Token.ToAccessKey();
// create client app
@@ -167,7 +167,7 @@ public async Task Session_exception_should_be_short_if_ad_is_not_accepted()
await using var server = TestHelper.CreateServer(testAccessManager);
// create access item
- var accessItem = fileAccessManager.AccessItem_Create(displayAd: DisplayAd.Required);
+ var accessItem = fileAccessManager.AccessItem_Create(adShow: AdShow.Required);
accessItem.Token.ToAccessKey();
fileAccessManager.RejectAllAds = true; // server will reject all ads
diff --git a/VpnHood.Client.App.Android.Common/VpnHood.Client.App.Android.Common.csproj b/VpnHood.Client.App.Android.Common/VpnHood.Client.App.Android.Common.csproj
index 97997c9f4..5d6286ac4 100644
--- a/VpnHood.Client.App.Android.Common/VpnHood.Client.App.Android.Common.csproj
+++ b/VpnHood.Client.App.Android.Common/VpnHood.Client.App.Android.Common.csproj
@@ -21,7 +21,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.Android.GooglePlay.Core/VpnHood.Client.App.Android.GooglePlay.Core.csproj b/VpnHood.Client.App.Android.GooglePlay.Core/VpnHood.Client.App.Android.GooglePlay.Core.csproj
index 5a2ce1b9a..34a53bc48 100644
--- a/VpnHood.Client.App.Android.GooglePlay.Core/VpnHood.Client.App.Android.GooglePlay.Core.csproj
+++ b/VpnHood.Client.App.Android.GooglePlay.Core/VpnHood.Client.App.Android.GooglePlay.Core.csproj
@@ -21,7 +21,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.Android.GooglePlay/VpnHood.Client.App.Android.GooglePlay.csproj b/VpnHood.Client.App.Android.GooglePlay/VpnHood.Client.App.Android.GooglePlay.csproj
index 49a64b35e..187189c30 100644
--- a/VpnHood.Client.App.Android.GooglePlay/VpnHood.Client.App.Android.GooglePlay.csproj
+++ b/VpnHood.Client.App.Android.GooglePlay/VpnHood.Client.App.Android.GooglePlay.csproj
@@ -21,7 +21,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.Android/VpnHood.Client.App.Android.csproj b/VpnHood.Client.App.Android/VpnHood.Client.App.Android.csproj
index 64f4c044d..b3adbecc6 100644
--- a/VpnHood.Client.App.Android/VpnHood.Client.App.Android.csproj
+++ b/VpnHood.Client.App.Android/VpnHood.Client.App.Android.csproj
@@ -5,8 +5,8 @@
VpnHood.Client.App.Droid
Exe
com.vpnhood.client.android.web
- 503
- 4.4.503
+ 506
+ 4.4.506
23.0
@@ -30,7 +30,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.Maui.Common/VpnHood.Client.App.Maui.Common.csproj b/VpnHood.Client.App.Maui.Common/VpnHood.Client.App.Maui.Common.csproj
index 218855bf6..4adc66aa1 100644
--- a/VpnHood.Client.App.Maui.Common/VpnHood.Client.App.Maui.Common.csproj
+++ b/VpnHood.Client.App.Maui.Common/VpnHood.Client.App.Maui.Common.csproj
@@ -30,7 +30,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.Resources/VpnHood.Client.App.Resources.csproj b/VpnHood.Client.App.Resources/VpnHood.Client.App.Resources.csproj
index d5a7160d5..adaab76a4 100644
--- a/VpnHood.Client.App.Resources/VpnHood.Client.App.Resources.csproj
+++ b/VpnHood.Client.App.Resources/VpnHood.Client.App.Resources.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.Store/VpnHood.Client.App.Store.csproj b/VpnHood.Client.App.Store/VpnHood.Client.App.Store.csproj
index 9c0457e7d..1277b4800 100644
--- a/VpnHood.Client.App.Store/VpnHood.Client.App.Store.csproj
+++ b/VpnHood.Client.App.Store/VpnHood.Client.App.Store.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.WebServer/VpnHood.Client.App.WebServer.csproj b/VpnHood.Client.App.WebServer/VpnHood.Client.App.WebServer.csproj
index 17da14a2c..4dd80ff2c 100644
--- a/VpnHood.Client.App.WebServer/VpnHood.Client.App.WebServer.csproj
+++ b/VpnHood.Client.App.WebServer/VpnHood.Client.App.WebServer.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.Win.Common/VpnHood.Client.App.Win.Common.csproj b/VpnHood.Client.App.Win.Common/VpnHood.Client.App.Win.Common.csproj
index 319d54600..0d203f792 100644
--- a/VpnHood.Client.App.Win.Common/VpnHood.Client.App.Win.Common.csproj
+++ b/VpnHood.Client.App.Win.Common/VpnHood.Client.App.Win.Common.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj b/VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj
index 242bbd6c8..5a0cff178 100644
--- a/VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj
+++ b/VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj
@@ -27,7 +27,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.App/VpnHood.Client.App.csproj b/VpnHood.Client.App/VpnHood.Client.App.csproj
index c470bf9eb..9d3aae6e4 100644
--- a/VpnHood.Client.App/VpnHood.Client.App.csproj
+++ b/VpnHood.Client.App/VpnHood.Client.App.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.Device.Android/VpnHood.Client.Device.Android.csproj b/VpnHood.Client.Device.Android/VpnHood.Client.Device.Android.csproj
index b72d0fbf8..309b6283d 100644
--- a/VpnHood.Client.Device.Android/VpnHood.Client.Device.Android.csproj
+++ b/VpnHood.Client.Device.Android/VpnHood.Client.Device.Android.csproj
@@ -21,7 +21,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.Device.WinDivert/VpnHood.Client.Device.WinDivert.csproj b/VpnHood.Client.Device.WinDivert/VpnHood.Client.Device.WinDivert.csproj
index 3db7da6fa..b8793e67b 100644
--- a/VpnHood.Client.Device.WinDivert/VpnHood.Client.Device.WinDivert.csproj
+++ b/VpnHood.Client.Device.WinDivert/VpnHood.Client.Device.WinDivert.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client.Device/VpnHood.Client.Device.csproj b/VpnHood.Client.Device/VpnHood.Client.Device.csproj
index 2041e1fb0..4a7db0a91 100644
--- a/VpnHood.Client.Device/VpnHood.Client.Device.csproj
+++ b/VpnHood.Client.Device/VpnHood.Client.Device.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client/VpnHood.Client.csproj b/VpnHood.Client/VpnHood.Client.csproj
index 3f8e52b59..6c8844e48 100644
--- a/VpnHood.Client/VpnHood.Client.csproj
+++ b/VpnHood.Client/VpnHood.Client.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Client/VpnHoodClient.cs b/VpnHood.Client/VpnHoodClient.cs
index f3e0d2c9c..a7229763a 100644
--- a/VpnHood.Client/VpnHoodClient.cs
+++ b/VpnHood.Client/VpnHoodClient.cs
@@ -726,8 +726,8 @@ private async Task ConnectInternal(CancellationToken cancellationToken, bool all
VhLogger.Instance.LogWarning("You suppressed a session of another client!");
// show ad if required
- if (sessionResponse.IsAdRequired || sessionResponse.DisplayAd is not DisplayAd.None)
- await ShowAd(sessionResponse.DisplayAd is DisplayAd.Flexible, cancellationToken);
+ if (sessionResponse.IsAdRequired || sessionResponse.AdShow is not AdShow.None)
+ await ShowAd(sessionResponse.AdShow is AdShow.Flexible, cancellationToken);
// manage datagram channels
await ManageDatagramChannels(cancellationToken);
diff --git a/VpnHood.Common/Messaging/DisplayAd.cs b/VpnHood.Common/Messaging/DisplayAd.cs
deleted file mode 100644
index cc2a6b05c..000000000
--- a/VpnHood.Common/Messaging/DisplayAd.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace VpnHood.Common.Messaging;
-
-[JsonConverter(typeof(JsonStringEnumConverter))]
-public enum DisplayAd
-{
- None,
- Flexible,
- Required
-}
-
-public enum AdShow
-{
- None,
- Flexible,
- Required
-}
diff --git a/VpnHood.Common/VpnHood.Common.csproj b/VpnHood.Common/VpnHood.Common.csproj
index 1a452774a..137c0fea7 100644
--- a/VpnHood.Common/VpnHood.Common.csproj
+++ b/VpnHood.Common/VpnHood.Common.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Server.Access/Managers/File/FileAccessManager.cs b/VpnHood.Server.Access/Managers/File/FileAccessManager.cs
index bf607394a..e682583ce 100644
--- a/VpnHood.Server.Access/Managers/File/FileAccessManager.cs
+++ b/VpnHood.Server.Access/Managers/File/FileAccessManager.cs
@@ -295,7 +295,7 @@ public AccessItem AccessItem_Create(
string? tokenName = null,
int maxTrafficByteCount = 0,
DateTime? expirationTime = null,
- DisplayAd displayAd = DisplayAd.None)
+ AdShow adShow = AdShow.None)
{
// generate key
var aes = Aes.Create();
@@ -308,7 +308,7 @@ public AccessItem AccessItem_Create(
MaxTraffic = maxTrafficByteCount,
MaxClientCount = maxClientCount,
ExpirationTime = expirationTime,
- DisplayAd = displayAd,
+ AdShow = adShow,
Token = new Token
{
IssuedAt = DateTime.UtcNow,
@@ -413,7 +413,7 @@ public class AccessItem
public DateTime? ExpirationTime { get; set; }
public int MaxClientCount { get; set; }
public long MaxTraffic { get; set; }
- public DisplayAd DisplayAd { get; set; }
+ public AdShow AdShow { get; set; }
public required Token Token { get; set; }
[JsonIgnore]
diff --git a/VpnHood.Server.Access/Managers/File/FileAccessManagerSessionController.cs b/VpnHood.Server.Access/Managers/File/FileAccessManagerSessionController.cs
index eeada2f04..af02fd9d3 100644
--- a/VpnHood.Server.Access/Managers/File/FileAccessManagerSessionController.cs
+++ b/VpnHood.Server.Access/Managers/File/FileAccessManagerSessionController.cs
@@ -77,7 +77,7 @@ public SessionResponseEx CreateSession(SessionRequestEx sessionRequestEx,
HostEndPoint = sessionRequestEx.HostEndPoint,
ClientIp = sessionRequestEx.ClientIp,
ExtraData = sessionRequestEx.ExtraData,
- ExpirationTime = accessItem.DisplayAd is DisplayAd.Required ? DateTime.UtcNow + _adRequiredTimeout : null
+ ExpirationTime = accessItem.AdShow is AdShow.Required ? DateTime.UtcNow + _adRequiredTimeout : null
};
//create response
@@ -204,8 +204,8 @@ private SessionResponseEx BuildSessionResponse(Session session, FileAccessManage
ErrorMessage = session.ErrorMessage,
AccessUsage = accessUsage,
RedirectHostEndPoint = null,
- IsAdRequired = accessItem.DisplayAd is DisplayAd.Required,
- DisplayAd = accessItem.DisplayAd
+ IsAdRequired = accessItem.AdShow is AdShow.Required,
+ AdShow = accessItem.AdShow
};
}
diff --git a/VpnHood.Server.Access/Messaging/SessionResponseEx.cs b/VpnHood.Server.Access/Messaging/SessionResponseEx.cs
index 5cd8229cd..eea846e97 100644
--- a/VpnHood.Server.Access/Messaging/SessionResponseEx.cs
+++ b/VpnHood.Server.Access/Messaging/SessionResponseEx.cs
@@ -14,6 +14,6 @@ public class SessionResponseEx : SessionResponse
public ulong SessionId { get; set; }
public byte[] SessionKey { get; set; } = [];
public bool IsAdRequired { get; set; } //todo: deprecated in version 504 or later
- public DisplayAd DisplayAd { get; set; } = DisplayAd.None;
+ public AdShow AdShow { get; set; } = AdShow.None;
}
\ No newline at end of file
diff --git a/VpnHood.Server.Access/VpnHood.Server.Access.csproj b/VpnHood.Server.Access/VpnHood.Server.Access.csproj
index 2fb0304d7..315ba6d3f 100644
--- a/VpnHood.Server.Access/VpnHood.Server.Access.csproj
+++ b/VpnHood.Server.Access/VpnHood.Server.Access.csproj
@@ -20,7 +20,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Server.App.Net/VpnHood.Server.App.Net.csproj b/VpnHood.Server.App.Net/VpnHood.Server.App.Net.csproj
index 0691597f2..7ef494350 100644
--- a/VpnHood.Server.App.Net/VpnHood.Server.App.Net.csproj
+++ b/VpnHood.Server.App.Net/VpnHood.Server.App.Net.csproj
@@ -22,7 +22,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
VpnHoodServer
diff --git a/VpnHood.Server/ServerHost.cs b/VpnHood.Server/ServerHost.cs
index 09acfd202..a4e21f872 100644
--- a/VpnHood.Server/ServerHost.cs
+++ b/VpnHood.Server/ServerHost.cs
@@ -633,7 +633,7 @@ private async Task ProcessHello(IClientStream clientStream, CancellationToken ca
AccessKey = sessionResponse.AccessKey,
DnsServers = DnsServers,
IsAdRequired = sessionResponse.IsAdRequired,
- DisplayAd = sessionResponse.DisplayAd
+ AdShow = sessionResponse.AdShow
};
await StreamUtil.WriteJsonAsync(clientStream.Stream, helloResponse, cancellationToken);
await clientStream.DisposeAsync();
diff --git a/VpnHood.Server/VpnHood.Server.csproj b/VpnHood.Server/VpnHood.Server.csproj
index ab5b3133f..061ebb7f0 100644
--- a/VpnHood.Server/VpnHood.Server.csproj
+++ b/VpnHood.Server/VpnHood.Server.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))
diff --git a/VpnHood.Tunneling/Messaging/HelloResponse.cs b/VpnHood.Tunneling/Messaging/HelloResponse.cs
index 5e2596512..464778df4 100644
--- a/VpnHood.Tunneling/Messaging/HelloResponse.cs
+++ b/VpnHood.Tunneling/Messaging/HelloResponse.cs
@@ -31,5 +31,5 @@ public class HelloResponse : SessionResponse
public string? AccessKey { get; set; }
// todo: deprecated in version 504 or later
public bool IsAdRequired { get; set; }
- public DisplayAd DisplayAd { get; set; } = DisplayAd.None;
+ public AdShow AdShow { get; set; } = AdShow.None;
}
\ No newline at end of file
diff --git a/VpnHood.Tunneling/VpnHood.Tunneling.csproj b/VpnHood.Tunneling/VpnHood.Tunneling.csproj
index adc15d4fe..a96d31c65 100644
--- a/VpnHood.Tunneling/VpnHood.Tunneling.csproj
+++ b/VpnHood.Tunneling/VpnHood.Tunneling.csproj
@@ -19,7 +19,7 @@
VpnHood.png
https://github.com/vpnhood/vpnhood
https://github.com/vpnhood/vpnhood
- 4.4.503
+ 4.4.506
$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))