Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
trudyhood committed Jan 18, 2024
2 parents 6185101 + 2a87d82 commit eb95dc8
Show file tree
Hide file tree
Showing 132 changed files with 4,386 additions and 1,586 deletions.
74 changes: 47 additions & 27 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,64 @@
# v3.3.454
### Client
* Update: New Access Token format
* Update: Use OS encryption for TLS
* Feature: Enable updating server endpoints by Url
* Feature: Display token expiration if it exists
* Feature: Update server token URL from the server
* Feature: Android: Prompt for the update by Google Play if possible
* Feature: Android: Support opening (KEY) as VpnHood Key file
* Fix: Windows: Freeze network after auto-reconnect with muti-server
* Deprecate: Server ProtocolVersion 3 is deprecated and no longer supported

### Server
* Feature: Generate encrypted server token to client update server endpoint from a URL
* Update: Move some File Access Manager options from the gen command to config
* Update: Return 401 instead of 400 for invalid request
* Update: Use OS encryption for TLS
* Update: Redact more data in server logs
* Deprecate: Server ProtocolVersion 3 is deprecated and no longer supported

# v3.2.439
### Client
Update: Improve Performance
Feature: Add the initializing state to the connection state
Feature: Android Set the navigation button background color
* Update: Improve Performance
* Feature: Add the initializing state to the connection state
* Feature: Android Set the navigation button background color

### Server
Update: Improve Performance
Update: Improve error reporting to access manager
Update: Improve reporting state to access manager
Fix: Server doesn't start when there is no local IpV6
Fix: Server freezes when default UDP port is not available
Fix: Send status even if server configuration is not successful
Security: Updating AccessManaget token
* Update: Improve Performance
* Update: Improve error reporting to access manager
* Update: Improve reporting state to access manager
* Fix: Server doesn't start when there is no local IpV6
* Fix: Server freezes when default UDP port is not available
* Fix: Send status even if server configuration is not successful
* Security: Updating AccessManaget token

### Developer
Upgrade to .NET 8
Android: Migrate from Xamarin to .NET Android Application
Android: Upgrade to Android API 34
* Upgrade to .NET 8
* Android: Migrate from Xamarin to .NET Android Application
* Android: Upgrade to Android API 34

# v3.1.436
### Client
Update: Improve UI
Fix: Android: Keyboard cover input fields in the UI
Fix: Android: Frequently asking to add the system tile
* Update: Improve UI
* Fix: Android: Keyboard cover input fields in the UI
* Fix: Android: Frequently asking to add the system tile

# v3.1.430
### Client
Update: Improve UI
Update: Windows: Remove from the taskbar on minimize
Update: Android: Ask for notification permission
Update: Android: Add compatibility to Android 6 & 14
Feature: Android: Register vh and vhkey intent for importing access key
Feature: Android: Add quick settings tile
Fix: Android: Requesting permission for notification
Fix: Windows: Restore Windows state to normal when user clicks on the system tray icon
Fix: Improve disconnecting speed
* Update: Improve UI
* Update: Windows: Remove from the taskbar on minimize
* Update: Android: Ask for notification permission
* Update: Android: Add compatibility to Android 6 & 14
* Feature: Android: Register vh and vhkey intent for importing access key
* Feature: Android: Add quick settings tile
* Fix: Android: Requesting permission for notification
* Fix: Windows: Restore Windows state to normal when user clicks on the system tray icon
* Fix: Improve disconnecting speed

### Developement
Client: Update SPA to VUE 3 and TypeScript
Client: Create Api.ts generated for TypeScript by nswag
* Client: Update SPA to VUE 3 and TypeScript
* Client: Create Api.ts generated for TypeScript by nswag

# v3.0.429
### Client
Expand Down
7 changes: 4 additions & 3 deletions Pub/Android.GooglePlay/_publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ $module_packageFileName = $(Split-Path "$module_packageFile" -leaf);

# publish info
$json = @{
Version = $versionParam;
UpdateInfoUrl = "https://github.com/vpnhood/VpnHood/releases/latest/download/$module_infoFileName";
PackageUrl = "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$module_packageFileName";
Version = $versionParam;
UpdateInfoUrl = "https://github.com/vpnhood/VpnHood/releases/latest/download/$module_infoFileName";
PackageUrl = "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$module_packageFileName";
InstallationPageUrl = "https://github.com/vpnhood/VpnHood/wiki/Install-VpnHood-Client";
GooglePlayUrl = "https://play.google.com/store/apps/details?id=com.vpnhood.client.android";
ReleaseDate = "$releaseDate";
DeprecatedVersion = "$deprecatedVersion";
NotificationDelay = "14.00:00:00";
Expand Down
2 changes: 1 addition & 1 deletion Pub/Core/Common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $nugetApiKey = $credentials.NugetApiKey;
$msverbosity = "minimal";

# Version
$versionFile = "$pubDir/version.json";
$versionFile = "$pubDir/PubVersion.json";
$versionJson = (Get-Content $versionFile | Out-String | ConvertFrom-Json);
$bumpTime = [datetime]::Parse($versionJson.BumpTime);
$version = [version]::Parse($versionJson.Version);
Expand Down
71 changes: 38 additions & 33 deletions Pub/Core/PublishAndroidApp.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
param(
[Parameter(Mandatory=$true)] [String]$projectDir,
[Parameter(Mandatory=$true)] [String]$packageFileTitle)
[Parameter(Mandatory=$true)] [String]$packageFileTitle,
[switch]$apk)

. "$PSScriptRoot/Common.ps1"

Expand All @@ -25,11 +26,12 @@ $module_infoFileName = $(Split-Path "$module_infoFile" -leaf);
$module_packageFileName = $(Split-Path "$module_packageFile" -leaf);

# android
$keystore = Join-Path "$solutionDir/../.user/" $credentials.Android.KeyStoreFile
$keystorePass = $credentials.Android.KeyStorePass
$keystoreAlias = $credentials.Android.KeyStoreAlias
$nodeName = "Android.$packageFileTitle";
$keystore = Join-Path "$solutionDir/../.user/" $credentials.$nodeName.KeyStoreFile
$keystorePass = $credentials.$nodeName.KeyStorePass
$keystoreAlias = $credentials.$nodeName.KeyStoreAlias
$manifestFile = Join-Path $projectDir "Properties/AndroidManifest.xml";
$appIconXml = Join-Path $projectDir "Resources\mipmap-anydpi-v26\appicon.xml";
$appIconXml = Join-Path $projectDir "Resources/mipmap-anydpi-v26/appicon.xml";
$appIconXmlDoc = [xml](Get-Content $appIconXml);
$appIconXmlNode = $appIconXmlDoc.selectSingleNode("adaptive-icon/background");
$packageId = ([xml](Get-Content $projectFile)).SelectSingleNode("Project/PropertyGroup/ApplicationId").InnerText;
Expand All @@ -39,35 +41,38 @@ $appIconXmlNode.SetAttribute("android:drawable", "@mipmap/appicon_background_dev
$appIconXmlDoc.save($appIconXml);

# apk
Write-Host;
Write-Host "*** Creating Android APK ..." -BackgroundColor Blue -ForegroundColor White;

$outputPath = Join-Path $projectDir "bin/ReleaseApk/";
$signedPacakgeFile = Join-Path $outputPath "$packageId-Signed.apk"

# todo
if (-not $noclean) { & $msbuild $projectFile /p:Configuration=Release /t:Clean /p:OutputPath=$outputPath /verbosity:$msverbosity; }
& $msbuild $projectFile /p:Configuration=Release /t:SignAndroidPackage /p:Version=$versionParam /p:OutputPath=$outputPath /p:AndroidPackageFormat="apk" /verbosity:$msverbosity `
/p:AndroidSigningKeyStore=$keystore /p:AndroidSigningKeyAlias=$keystoreAlias /p:AndroidSigningStorePass=$keystorePass `
/p:ApplicationId=$packageId `
/p:JarsignerTimestampAuthorityUrl="https://freetsa.org/tsr";

# publish info
$json = @{
Version = $versionParam;
UpdateInfoUrl = "https://github.com/vpnhood/VpnHood/releases/latest/download/$module_infoFileName";
PackageUrl = "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$module_packageFileName";
InstallationPageUrl = "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$module_packageFileName";
ReleaseDate = "$releaseDate";
DeprecatedVersion = "$deprecatedVersion";
NotificationDelay = "03.00:00:00";
};
$json | ConvertTo-Json | Out-File "$module_infoFile" -Encoding ASCII;

Copy-Item -path $signedPacakgeFile -Destination "$moduleDir/$module_packageFileName" -Force
if ($isLatest)
if ($apk)
{
Copy-Item -path "$moduleDir/*" -Destination "$moduleDirLatest/" -Force -Recurse;
Write-Host;
Write-Host "*** Creating Android APK ..." -BackgroundColor Blue -ForegroundColor White;

$outputPath = Join-Path $projectDir "bin/ReleaseApk/";
$signedPacakgeFile = Join-Path $outputPath "$packageId-Signed.apk"

if (-not $noclean) { & $msbuild $projectFile /p:Configuration=Release /t:Clean /p:OutputPath=$outputPath /verbosity:$msverbosity; }
& $msbuild $projectFile /p:Configuration=Release /t:SignAndroidPackage /p:Version=$versionParam /p:OutputPath=$outputPath /p:AndroidPackageFormat="apk" /verbosity:$msverbosity `
/p:AndroidSigningKeyStore=$keystore /p:AndroidSigningKeyAlias=$keystoreAlias /p:AndroidSigningStorePass=$keystorePass `
/p:ApplicationId=$packageId `
/p:JarsignerTimestampAuthorityUrl="https://freetsa.org/tsr";

# publish info
$json = @{
Version = $versionParam;
UpdateInfoUrl = "https://github.com/vpnhood/VpnHood/releases/latest/download/$module_infoFileName";
PackageUrl = "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$module_packageFileName";
InstallationPageUrl = "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$module_packageFileName";
GooglePlayUrl = "https://play.google.com/store/apps/details?id=$packageId";
ReleaseDate = "$releaseDate";
DeprecatedVersion = "$deprecatedVersion";
NotificationDelay = "03.00:00:00";
};
$json | ConvertTo-Json | Out-File "$module_infoFile" -Encoding ASCII;

Copy-Item -path $signedPacakgeFile -Destination "$moduleDir/$module_packageFileName" -Force
if ($isLatest)
{
Copy-Item -path "$moduleDir/*" -Destination "$moduleDirLatest/" -Force -Recurse;
}
}

# ------------- aab
Expand Down
6 changes: 6 additions & 0 deletions Pub/PubVersion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"Version": "3.3.454",
"BumpTime": "2024-01-18T10:59:43.8825171Z",
"Prerelease": false,
"DeprecatedVersion": "3.0.416"
}
4 changes: 2 additions & 2 deletions Pub/PublishApps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ if ($server)
# publish android
if ($android)
{
& "$solutionDir/VpnHood.Client.App.Android/_publish.ps1";
& "$solutionDir/VpnHood.Client.App.Android/_publish.ps1" -apk;
}

# publish android
if ($androidConnect)
{
& "$solutionDir/VpnHood.Client.App.Android.connect/_publish.ps1";
& "$solutionDir/VpnHood.Client.App.Android.connect/_publish.ps1" -apk;
}


Expand Down
10 changes: 8 additions & 2 deletions Pub/PublishToGitHub.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

# update CHANGELOG
$text = Get-Content "$solutionDir/CHANGELOG.md" -Raw;
# if ( $text.IndexOf("# Upcoming") -eq -1) { throw "Could not find # Upcoming phrase in CHANGELOG" };
$changeLog = $text -replace "# Upcoming", "# v$versionParam";

# find top version
$vStart = $text.IndexOf("#");
$vEnd = $text.IndexOf("`n", $vStart) - 1;
$topVersion = $text.SubString($vStart, $vEnd - $vStart);

# change top version
$changeLog = $text -replace $topVersion, "# v$versionParam";
$changeLog | Out-File -FilePath "$solutionDir/CHANGELOG.md" -Encoding utf8 -Force -NoNewline;

# create release note
Expand Down
6 changes: 0 additions & 6 deletions Pub/Version.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="VpnHood.Client" Version="3.2.438-prerelease" />
<PackageReference Include="VpnHood.Client.Device.WinDivert" Version="3.2.438-prerelease" />
<PackageReference Include="VpnHood.Client" Version="3.2.448" />
<PackageReference Include="VpnHood.Client.Device.WinDivert" Version="3.2.448" />
</ItemGroup>

</Project>
23 changes: 11 additions & 12 deletions Tests/VpnHood.Test/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,10 @@ public static IPAddress[] TestIpAddresses
}
}

public static Token CreateAccessToken(FileAccessManager fileAccessManager, IPEndPoint[]? hostEndPoints = null,
public static Token CreateAccessToken(FileAccessManager fileAccessManager,
int maxClientCount = 1, int maxTrafficByteCount = 0, DateTime? expirationTime = null)
{
return fileAccessManager.AccessItem_Create(
hostEndPoints ?? fileAccessManager.ServerConfig.TcpEndPointsValue,
tokenName: $"Test Server {++_accessItemIndex}",
maxClientCount: maxClientCount,
maxTrafficByteCount: maxTrafficByteCount,
Expand All @@ -227,7 +226,7 @@ public static Token CreateAccessToken(VpnHoodServer server,
{
var testAccessManager = (TestAccessManager)server.AccessManager;
var fileAccessManager = (FileAccessManager)testAccessManager.BaseAccessManager;
return CreateAccessToken(fileAccessManager, null, maxClientCount, maxTrafficByteCount, expirationTime);
return CreateAccessToken(fileAccessManager, maxClientCount, maxTrafficByteCount, expirationTime);
}

public static FileAccessManager CreateFileAccessManager(FileAccessManagerOptions? options = null, string? storagePath = null)
Expand All @@ -241,8 +240,9 @@ public static FileAccessManagerOptions CreateFileAccessManagerOptions()
{
var options = new FileAccessManagerOptions
{
TcpEndPoints = new[] { VhUtil.GetFreeTcpEndPoint(IPAddress.Loopback) },
UdpEndPoints = new[] { new IPEndPoint(IPAddress.Loopback, 0) },
PublicEndPoints = null, // use TcpEndPoints
TcpEndPoints = [VhUtil.GetFreeTcpEndPoint(IPAddress.Loopback)],
UdpEndPoints = [new IPEndPoint(IPAddress.Loopback, 0)],
TrackingOptions = new TrackingOptions
{
TrackClientIp = true,
Expand All @@ -255,7 +255,7 @@ public static FileAccessManagerOptions CreateFileAccessManagerOptions()
SyncCacheSize = 50,
SyncInterval = TimeSpan.FromMilliseconds(100)
},
LogAnonymizer = false
LogAnonymizer = false,
};
return options;
}
Expand Down Expand Up @@ -426,11 +426,11 @@ public static SessionRequestEx CreateSessionRequestEx(Token token, Guid? clientI
return new SessionRequestEx("access:" + Guid.NewGuid(),
token.TokenId,
new ClientInfo { ClientId = clientId.Value },
hostEndPoint: token.HostEndPoints!.First(),
hostEndPoint: token.ServerToken.HostEndPoints!.First(),
encryptedClientId: VhUtil.EncryptClientId(clientId.Value, token.Secret));
}

public static bool IgnoreCertificateValidationCallback(object sender,
public static bool IgnoreCertificateValidationCallback(object sender,
X509Certificate? certificate, X509Chain? chain, SslPolicyErrors sslPolicyErrors)
{
_ = sender;
Expand All @@ -453,8 +453,7 @@ internal static void Init()
VhLogger.IsAnonymousMode = false;
WebServer = TestWebServer.Create();
NetFilter = new TestNetFilter();
NetFilter.Init(new[]
{
NetFilter.Init([
Tuple.Create(ProtocolType.Tcp, TEST_TcpEndPoint1, WebServer.HttpV4EndPoint1),
Tuple.Create(ProtocolType.Tcp, TEST_TcpEndPoint2, WebServer.HttpV4EndPoint2),
Tuple.Create(ProtocolType.Tcp, TEST_HttpsEndPoint1, WebServer.HttpsV4EndPoint1),
Expand All @@ -465,8 +464,8 @@ internal static void Init()
Tuple.Create(ProtocolType.Udp, TEST_UdpV6EndPoint2, WebServer.UdpV6EndPoint2),
Tuple.Create(ProtocolType.Icmp, new IPEndPoint(TEST_PingV4Address1, 0), IPEndPoint.Parse("127.0.0.1:0")),
Tuple.Create(ProtocolType.Icmp, new IPEndPoint(TEST_PingV4Address2, 0), IPEndPoint.Parse("127.0.0.2:0")),
Tuple.Create(ProtocolType.IcmpV6, new IPEndPoint(TEST_PingV6Address1, 0), IPEndPoint.Parse("[::1]:0")),
});
Tuple.Create(ProtocolType.IcmpV6, new IPEndPoint(TEST_PingV6Address1, 0), IPEndPoint.Parse("[::1]:0"))
]);
FastDateTime.Precision = TimeSpan.FromMilliseconds(1);
JobRunner.Default.Interval = TimeSpan.FromMilliseconds(200);
JobSection.DefaultInterval = TimeSpan.FromMilliseconds(200);
Expand Down
22 changes: 12 additions & 10 deletions Tests/VpnHood.Test/TestWebServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,31 @@ namespace VpnHood.Test;
public class TestWebServer : IDisposable
{
private readonly WebServer _webServer;
public IPEndPoint[] HttpsV4EndPoints { get; } = {
public IPEndPoint[] HttpsV4EndPoints { get; } =
[
IPEndPoint.Parse("127.10.1.1:15001"),
IPEndPoint.Parse("127.10.1.1:15002"),
IPEndPoint.Parse("127.10.1.1:15003"),
IPEndPoint.Parse("127.10.1.1:15004"),
};
IPEndPoint.Parse("127.10.1.1:15004")
];

public IPEndPoint[] HttpV4EndPoints { get; } = {
public IPEndPoint[] HttpV4EndPoints { get; } =
[
IPEndPoint.Parse("127.10.1.1:15005"),
IPEndPoint.Parse("127.10.1.1:15006"),
IPEndPoint.Parse("127.10.1.1:15007"),
IPEndPoint.Parse("127.10.1.1:15008"),
};
IPEndPoint.Parse("127.10.1.1:15008")
];

public IPEndPoint[] UdpEndPoints { get; } =
{
public IPEndPoint[] UdpEndPoints { get; } =
[
IPEndPoint.Parse("127.10.1.1:20101"),
IPEndPoint.Parse("127.10.1.1:20102"),
IPEndPoint.Parse("127.10.1.1:20103"),
IPEndPoint.Parse("[::1]:20101"),
IPEndPoint.Parse("[::1]:20102"),
IPEndPoint.Parse("[::1]:20103")
};
];

public IPEndPoint HttpsV4EndPoint1 => HttpsV4EndPoints[0];
public IPEndPoint HttpsV4EndPoint2 => HttpsV4EndPoints[1];
Expand Down Expand Up @@ -106,7 +108,7 @@ private void StartUdpEchoServer()
{
foreach (var udpClient in UdpClients)
{
udpClient.Client.IOControl(-1744830452, new byte[] { 0 }, new byte[] { 0 });
udpClient.Client.IOControl(-1744830452, [0], [0]);
_ = StartUdpEchoServer(udpClient);
}
}
Expand Down
Loading

0 comments on commit eb95dc8

Please sign in to comment.