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 22, 2022
2 parents 46e3638 + 5b3e375 commit 738da55
Show file tree
Hide file tree
Showing 32 changed files with 709 additions and 642 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# v2.4.295
### Client
* Update: Tune TCP connections for games
* Fix: Error when setting PacketCapture include filter

### Server
* Feature: Server sends its last config error to access server
* Fix: TcpHost is already Started error
* Fix: Linux installation on some distribution
* Fix: LogLevel.Trace in DiagnoseMode

# v2.4.292
### Client
* Update: Improve stability and memory usage
Expand Down Expand Up @@ -346,3 +357,4 @@




4 changes: 2 additions & 2 deletions Pub/Version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Major": 2,
"Minor": 4,
"Build": 292,
"BumpTime": "2022-01-05T01:25:45.1824407Z"
"Build": 295,
"BumpTime": "2022-01-22T08:17:45.1958192Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="VpnHood.Client">
<Version>2.3.291</Version>
<Version>2.4.292</Version>
</PackageReference>
<PackageReference Include="VpnHood.Client.Device.Android">
<Version>2.3.291</Version>
<Version>2.4.292</Version>
</PackageReference>
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="VpnHood.Client" Version="2.3.291" />
<PackageReference Include="VpnHood.Client.Device.WinDivert" Version="2.3.291" />
<PackageReference Include="VpnHood.Client" Version="2.4.292" />
<PackageReference Include="VpnHood.Client.Device.WinDivert" Version="2.4.292" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions VpnHood.App.Launcher/VpnHood.App.Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<PackageIcon>VpnHood.png</PackageIcon>
<Product>VpnHood.App.Launcher</Product>
<ApplicationIcon>Resources\VpnHood.ico</ApplicationIcon>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion VpnHood.Client.App.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="292" package="com.vpnhood.client.android" android:installLocation="auto" android:versionName="2.4.292">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="295" package="com.vpnhood.client.android" android:installLocation="auto" android:versionName="2.4.295">
<uses-sdk android:minSdkVersion="22" android:targetSdkVersion="31" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
6 changes: 3 additions & 3 deletions VpnHood.Client.App.UI/VpnHood.Client.App.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<PackageIcon>VpnHood.png</PackageIcon>
<Description>Tiny internal webserver to server your single-page application (SPA). You need this only if you want to create a UI for your VpnHood client by single-page application (SPA).</Description>
<PackageId>VpnHood.Client.App.UI</PackageId>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
7 changes: 4 additions & 3 deletions VpnHood.Client.App.Win.Setup/VpnHood.Client.App.Win.Setup.aip
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DOCUMENT Type="Advanced Installer" CreateVersion="17.7" version="19.0" Modules="professional" RootPath="." Language="en" Id="{F5BEDA55-1847-4909-B85B-443D6C887C92}">
<DOCUMENT Type="Advanced Installer" CreateVersion="17.7" version="19.1" Modules="professional" RootPath="." Language="en" Id="{F5BEDA55-1847-4909-B85B-443D6C887C92}">
<COMPONENT cid="caphyon.advinst.msicomp.MsiPropsComponent">
<ROW Property="AI_BITMAP_DISPLAY_MODE" Value="0"/>
<ROW Property="AI_COLOR_DISABLED_TEXT" Value="3026478" MultiBuildValue="DefaultBuild:15461355" MsiKey="AI_COLOR_DISABLED_TEXT"/>
Expand All @@ -22,10 +22,10 @@
<ROW Property="CTRLS" Value="2"/>
<ROW Property="DOTNET" Value="dotnet"/>
<ROW Property="Manufacturer" Value="VpnHood"/>
<ROW Property="ProductCode" Value="1033:{6F3ED7EB-A3EA-449F-8A3C-81905E3792F5} " Type="16"/>
<ROW Property="ProductCode" Value="1033:{7ACA31E0-F0A6-4C96-A95B-E49C57408133} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="VpnHood"/>
<ROW Property="ProductVersion" Value="2.4.292.0" Type="32" TargetFile="VpnHoodClient.dll"/>
<ROW Property="ProductVersion" Value="2.4.295.0" Type="32" TargetFile="VpnHoodClient.dll"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/>
<ROW Property="UpgradeCode" Value="{38FCFAB0-A40C-4840-A9F9-B7A06A5BC552}"/>
<ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
Expand Down Expand Up @@ -178,6 +178,7 @@
<ROW Fragment="SequenceDialogs.aip" Path="&lt;AI_THEMES&gt;surface\fragments\SequenceDialogs.aip"/>
<ROW Fragment="Sequences.aip" Path="&lt;AI_FRAGS&gt;Sequences.aip"/>
<ROW Fragment="StaticUIStrings.aip" Path="&lt;AI_FRAGS&gt;StaticUIStrings.aip"/>
<ROW Fragment="Themes.aip" Path="&lt;AI_FRAGS&gt;Themes.aip"/>
<ROW Fragment="UI.aip" Path="&lt;AI_THEMES&gt;surface\fragments\UI.aip"/>
<ROW Fragment="Validation.aip" Path="&lt;AI_FRAGS&gt;Validation.aip"/>
<ROW Fragment="VerifyRemoveDlg.aip" Path="&lt;AI_THEMES&gt;surface\fragments\VerifyRemoveDlg.aip"/>
Expand Down
8 changes: 4 additions & 4 deletions VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<PackageId>VpnHood.Client.App.Win</PackageId>
<StartupObject></StartupObject>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
Expand Down Expand Up @@ -58,7 +58,7 @@

<ItemGroup>
<PackageReference Include=" " Version="1.0.664.37" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1054.31" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1072.54" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions VpnHood.Client.App/VpnHood.Client.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<RepositoryUrl>https://github.com/vpnhood/vpnhood</RepositoryUrl>
<Description>Readymade Vpn App skeleton for VpnHood clients. You just need to create a UI on it.</Description>
<PackageId>VpnHood.Client.App</PackageId>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<RepositoryUrl>https://github.com/vpnhood/vpnhood</RepositoryUrl>
<PackageIcon>VpnHood.png</PackageIcon>
<Description>VpnHood client device provider for Windows using WinDivert.</Description>
<Version>2.4.292</Version>
<Version>2.4.295</Version>
<PackageId>VpnHood.Client.Device.WinDivert</PackageId>
<Version>1.1.226</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions VpnHood.Client.Device/VpnHood.Client.Device.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<RepositoryType></RepositoryType>
<PackageId>VpnHood.Client.Device</PackageId>
<RootNamespace>VpnHood.Client.Device</RootNamespace>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions VpnHood.Client/Diagnosing/DiagnoseUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ public class DiagnoseUtil
if (pingReply.Status != IPStatus.Success)
throw new Exception($"Status: {pingReply.Status}");

VhLogger.Instance.LogInformation($"PingTest: Succeeded. RemoteAddress: {ipAddress}.");
VhLogger.Instance.LogInformation($"PingTest: Succeeded. RemoteAddress: {VhLogger.Format(ipAddress)}.");
return null;
}
catch (Exception ex)
{
VhLogger.Instance.LogError($"PingTest: Failed! RemoteAddress: {ipAddress}, Message: {ex.Message}.");
VhLogger.Instance.LogError($"PingTest: Failed! RemoteAddress: {VhLogger.Format(ipAddress)}, Message: {ex.Message}.");
return ex;
}
}
Expand Down
8 changes: 3 additions & 5 deletions VpnHood.Client/TcpProxyHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public void Start()
_tcpListenerIpV4 = new TcpListener(IPAddress.Any, 0);
_tcpListenerIpV4.Start();
_localEndpointIpV4 = (IPEndPoint)_tcpListenerIpV4.LocalEndpoint; //it is slow; make sure to cache it
VhLogger.Instance.LogInformation(
$"{VhLogger.FormatTypeName(this)} is listening on {VhLogger.Format(_localEndpointIpV4)}");
VhLogger.Instance.LogInformation($"{VhLogger.FormatTypeName(this)} is listening on {VhLogger.Format(_localEndpointIpV4)}");
_ = AcceptTcpClientLoop(_tcpListenerIpV4);

// IpV6
Expand All @@ -78,6 +77,7 @@ public void Start()
private async Task AcceptTcpClientLoop(TcpListener tcpListener)
{
var cancellationToken = _cancellationTokenSource.Token;
var localEp = (IPEndPoint)tcpListener.LocalEndpoint;

try
{
Expand All @@ -94,7 +94,7 @@ private async Task AcceptTcpClientLoop(TcpListener tcpListener)
}
finally
{
VhLogger.Instance.LogInformation("Listener has been closed.");
VhLogger.Instance.LogInformation($"{VhLogger.FormatTypeName(this)} Listener on {localEp} has been closed.");
}
}

Expand Down Expand Up @@ -185,7 +185,6 @@ private async Task ProcessClient(TcpClient orgTcpClient, CancellationToken cance
try
{
// config tcpOrgClient
// todo: tcpOrgClient.NoDelay = true;
Client.SocketFactory.SetKeepAlive(orgTcpClient.Client, true);

// get original remote from NAT
Expand Down Expand Up @@ -230,7 +229,6 @@ await Client.AddPassthruTcpStream(
tcpProxyClientStream.TcpClient.ReceiveBufferSize = orgTcpClient.ReceiveBufferSize;
tcpProxyClientStream.TcpClient.SendBufferSize = orgTcpClient.SendBufferSize;
tcpProxyClientStream.TcpClient.SendTimeout = orgTcpClient.SendTimeout;
// todo: tcpProxyClientStream.TcpClient.NoDelay = true;
Client.SocketFactory.SetKeepAlive(tcpProxyClientStream.TcpClient.Client, true);

// read the response
Expand Down
6 changes: 3 additions & 3 deletions VpnHood.Client/VpnHood.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<Copyright>2020 VpnHood</Copyright>
<PackageId>VpnHood.Client</PackageId>
<PackageTags>VPN VpnClient Proxy</PackageTags>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
11 changes: 6 additions & 5 deletions VpnHood.Client/VpnHoodClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,12 @@ internal async Task AddPassthruTcpStream(TcpClientStream orgTcpClientStream, IPE
{
// config Tcp
SocketFactory.SetKeepAlive(orgTcpClientStream.TcpClient.Client, true);
//todo: orgTcpClientStream.TcpClient.NoDelay = true;

var tcpClient = SocketFactory.CreateTcpClient(hostEndPoint.AddressFamily);
tcpClient.ReceiveBufferSize = orgTcpClientStream.TcpClient.ReceiveBufferSize;
tcpClient.SendBufferSize = orgTcpClientStream.TcpClient.SendBufferSize;
tcpClient.SendTimeout = orgTcpClientStream.TcpClient.SendTimeout;
SocketFactory.SetKeepAlive(tcpClient.Client, true);
//todo: tcpClient.NoDelay = true;


// connect to host
_packetCapture.ProtectSocket(tcpClient.Client);
Expand Down Expand Up @@ -248,7 +245,12 @@ private void ConfigPacketFilter(IPEndPoint hostEndPoint)
var includeNetworks = new List<IpNetwork>();
if (PacketCaptureIncludeIpRanges?.Length > 0)
{
includeNetworks.AddRange(IpNetwork.FromIpRange(PacketCaptureIncludeIpRanges));
// remove hostEndPoint from include
var exclude = IpRange.Invert(PacketCaptureIncludeIpRanges).ToList();
exclude.Add(new IpRange(hostEndPoint.Address));
var include = IpRange.Invert(exclude.ToArray());

includeNetworks.AddRange(IpNetwork.FromIpRange(include));
}
else
{
Expand Down Expand Up @@ -594,7 +596,6 @@ internal async Task<TcpClientStream> GetSslConnectionToServer(EventId eventId, C
if (HostEndPoint == null)
throw new InvalidOperationException($"{nameof(HostEndPoint)} is not initialized!");
var tcpClient = SocketFactory.CreateTcpClient(HostEndPoint.AddressFamily);
//todo: tcpClient.Client.NoDelay = true;

try
{
Expand Down
1 change: 0 additions & 1 deletion VpnHood.Common/AppBaseNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public abstract class AppBaseNet<T> : IDisposable where T : AppBaseNet<T>
private const string FileNameSettings = "appsettings.json";
private const string FileNameSettingsDebug = "appsettings.Debug.json";
private const string FileNameNLogConfig = "NLog.config";
private const string FileNameNLogXsd = "NLog.xsd";

private static T? _instance;
private readonly string _appCommandFilePath;
Expand Down
6 changes: 3 additions & 3 deletions VpnHood.Common/VpnHood.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<PackageId>VpnHood.Common</PackageId>
<PackageIcon>VpnHood.png</PackageIcon>
<Description>VpnHood Common Library is shared among all other VpnHood modules.</Description>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion VpnHood.Server.Access/AccessServers/RestAccessServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private async Task<string> SendRequest(string api, HttpMethod httpMethod, object
var ret = await streamReader.ReadToEndAsync();

// check maintenance mode
IsMaintenanceMode = response.StatusCode == HttpStatusCode.ServiceUnavailable;
IsMaintenanceMode = response.StatusCode is HttpStatusCode.ServiceUnavailable or HttpStatusCode.NotFound;
if (IsMaintenanceMode)
throw new MaintenanceException();

Expand Down
1 change: 1 addition & 0 deletions VpnHood.Server.Access/ServerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ public ServerInfo(Version version,
public long TotalMemory { get; set; }
public string? MachineName { get; set; }
public Guid? ConfigCode { get; set; }
public string? LastError { get; set; }
}
}
6 changes: 3 additions & 3 deletions VpnHood.Server.Access/VpnHood.Server.Access.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<PackageId>VpnHood.Server.Access</PackageId>
<PackageIcon>VpnHood.png</PackageIcon>
<Description>Stores, and retrieves end users' access and usage. Provides required interfaces and classes to use or create an access server and accounting.</Description>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions VpnHood.Server.App.Net/Install/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ After=network.target
[Service]
Type=simple
ExecStart=sh -c \"dotnet '$destinationPath/launcher/run.dll' -launcher:noLaunchAfterUpdate && sleep 10s\"
ExecStop=sh -c \"dotnet '$destinationPath/launcher/run.dll' stop\"
ExecStart=/bin/sh -c \"dotnet '$destinationPath/launcher/run.dll' -launcher:noLaunchAfterUpdate && sleep 10s\"
ExecStop=/bin/sh -c \"dotnet '$destinationPath/launcher/run.dll' stop\"
TimeoutStartSec=0
Restart=always
RestartSec=2
Expand Down
8 changes: 7 additions & 1 deletion VpnHood.Server.App.Net/ServerApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using VpnHood.Server.AccessServers;
using VpnHood.Server.App.SystemInformation;
using VpnHood.Server.SystemInformation;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;

namespace VpnHood.Server.App
{
Expand All @@ -29,7 +30,12 @@ public ServerApp() : base("VpnHoodServer")
: new AppSettings();

// logger
using var loggerFactory = LoggerFactory.Create(builder => builder.AddNLog(NLogConfigFilePath));
using var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddNLog(NLogConfigFilePath);
if (AppSettings.IsDiagnoseMode)
builder.SetMinimumLevel(LogLevel.Trace);
});
VhLogger.Instance = loggerFactory.CreateLogger("NLog");
VhLogger.IsDiagnoseMode = AppSettings.IsDiagnoseMode;

Expand Down
6 changes: 3 additions & 3 deletions VpnHood.Server.App.Net/VpnHood.Server.App.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<RepositoryUrl>https://github.com/vpnhood/vpnhood</RepositoryUrl>
<PackageLicenseExpression>LGPL-2.1-only</PackageLicenseExpression>
<PackageIcon>VpnHood.png</PackageIcon>
<Version>2.4.292</Version>
<AssemblyVersion>2.4.292</AssemblyVersion>
<FileVersion>2.4.292</FileVersion>
<Version>2.4.295</Version>
<AssemblyVersion>2.4.295</AssemblyVersion>
<FileVersion>2.4.295</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 738da55

Please sign in to comment.