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, 2023
2 parents 706a901 + 125f24f commit 0d64b20
Show file tree
Hide file tree
Showing 39 changed files with 575 additions and 471 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# v2.6.332
# v2.6.336
### Client
* Update: Optimizing UDP Processing
* Update: Improving Grabage Colelctor
Expand All @@ -10,6 +10,7 @@
* Feature: Allow disabling LogAnonymizer in server config
* Feature: NetScanner protector
* Feature: Access ServerConfig overwrite
* Feature: UdpProxyPoolEx
* Update: Optimizing UDP Processing
* Update: Reporting improved; prevent too many duplicate errors
* Update: Windows updater write its log
Expand Down
4 changes: 2 additions & 2 deletions Pub/Version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Major": 2,
"Minor": 6,
"Build": 333,
"BumpTime": "2023-01-14T21:04:19.9181035Z",
"Build": 336,
"BumpTime": "2023-01-18T03:49:03.7437603Z",
"Prerelease": false
}
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="333" package="com.vpnhood.client.android" android:installLocation="auto" android:versionName="2.6.333">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="336" package="com.vpnhood.client.android" android:installLocation="auto" android:versionName="2.6.336">
<uses-sdk android:minSdkVersion="22" android:targetSdkVersion="33" />
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
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.6.333</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<Version>2.6.336</Version>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<PackageIcon>VpnHood.png</PackageIcon>
<PackageId>VpnHood.Client.App.Win</PackageId>
<StartupObject></StartupObject>
<Version>2.6.333</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<Version>2.6.336</Version>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
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.6.333</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<Version>2.6.336</Version>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</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.6.333</Version>
<Version>2.6.336</Version>
<PackageId>VpnHood.Client.Device.WinDivert</PackageId>
<Version>1.1.226</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</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.6.333</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<Version>2.6.336</Version>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
10 changes: 7 additions & 3 deletions VpnHood.Client/ClientProxyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Threading.Tasks;
using PacketDotNet;
using VpnHood.Client.Device;
using VpnHood.Common.Logging;
using VpnHood.Tunneling;
using VpnHood.Tunneling.Factory;

Expand All @@ -15,14 +16,17 @@ internal class ClientProxyManager : ProxyManager
// PacketCapture can not protect Ping so PingProxy does not work
protected override bool IsPingSupported => false;

public ClientProxyManager(IPacketCapture packetCapture, ISocketFactory socketFactory)
: base(new ProtectedSocketFactory(packetCapture, socketFactory))
public ClientProxyManager(IPacketCapture packetCapture, ISocketFactory socketFactory, ProxyManagerOptions options)
: base(new ProtectedSocketFactory(packetCapture, socketFactory), options)
{
_packetCapture = packetCapture ?? throw new ArgumentNullException(nameof(packetCapture));
}

protected override Task OnPacketReceived(IPPacket ipPacket)
public override Task OnPacketReceived(IPPacket ipPacket)
{
if (VhLogger.IsDiagnoseMode)
PacketUtil.LogPacket(ipPacket, "Delegating packet to host via proxy.");

_packetCapture.SendPacketToInbound(ipPacket);
return Task.FromResult(0);
}
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>2022 VpnHood</Copyright>
<PackageId>VpnHood.Client</PackageId>
<PackageTags>VPN VpnClient Proxy</PackageTags>
<Version>2.6.333</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<Version>2.6.336</Version>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion VpnHood.Client/VpnHoodClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public VpnHoodClient(IPacketCapture packetCapture, Guid clientId, Token token, C
ProtocolVersion = 2;
_autoDisposePacketCapture = options.AutoDisposePacketCapture;
_maxDatagramChannelCount = options.MaxDatagramChannelCount;
_proxyManager = new ClientProxyManager(packetCapture, options.SocketFactory);
_proxyManager = new ClientProxyManager(packetCapture, options.SocketFactory, new ProxyManagerOptions());
_ipFilter = options.IpFilter;
ClientId = clientId;
SessionTimeout = options.SessionTimeout;
Expand Down
2 changes: 1 addition & 1 deletion VpnHood.Common/JobController/JobSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class JobSection

public TimeSpan Elapsed => FastDateTime.Now - LastDoneTime;
public TimeSpan Interval { get; set; } = TimeSpan.FromSeconds(30);
public DateTime LastDoneTime { get; private set; }
public DateTime LastDoneTime { get; private set; } = FastDateTime.Now;

public JobSection()
{
Expand Down
19 changes: 16 additions & 3 deletions VpnHood.Common/Utils/EventReporter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using VpnHood.Common.JobController;
Expand All @@ -17,6 +19,7 @@ public class EventReporter : IDisposable, IJob
public int TotalEventCount { get; private set; }
public int LastReportEventCount { get; private set; }
public DateTime LastReportEventTime { get; private set; } = FastDateTime.Now;
public List<Tuple<string, object?>> Data { get; set; } = new();
public static bool IsDiagnosticMode { get; set; }

public EventReporter(ILogger logger, string message, EventId eventId = new())
Expand Down Expand Up @@ -44,7 +47,7 @@ private void ReportInternal()
lock (_lockObject)
{
//nothing to log
if (TotalEventCount - LastReportEventCount == 0)
if (TotalEventCount - LastReportEventCount == 0)
return;

Report();
Expand All @@ -56,8 +59,18 @@ private void ReportInternal()

protected virtual void Report()
{
_logger.LogInformation(_eventId, _message + " Duration: {Duration}, Count: {Count}, TotalCount: {Total}",
JobSection.Elapsed.ToString(@"hh\:mm\:ss"), TotalEventCount - LastReportEventCount, TotalEventCount);
var args = new[]
{
Tuple.Create("Duration", (object?)JobSection.Elapsed.ToString(@"hh\:mm\:ss")),
Tuple.Create("Count", (object?)(TotalEventCount - LastReportEventCount)),
Tuple.Create("Total", (object?)TotalEventCount)
};

if (Data.Count > 0)
args = args.Concat(Data).ToArray();

var log = _message + " " + string.Join(", ", args.Select(x => $"{x.Item1}: {{{x.Item1}}}"));
_logger.LogInformation(_eventId, log, args.Select(x => x.Item2).ToArray());
}

public Task RunJob()
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.6.333</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<Version>2.6.336</Version>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions VpnHood.Server.Access/SessionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ public class SessionOptions
public int MaxTcpChannelCount { get; set; } = 1000;
public int? NetScanLimit { get; set; }
public TimeSpan? NetScanTimeout { get; set; }
public bool UseUdpProxy2 { get; set; }
}
3 changes: 3 additions & 0 deletions VpnHood.Server.Access/TrackingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ public class TrackingOptions
public bool TrackLocalPort { get; set; }
public bool TrackDestinationIp { get; set; }
public bool TrackDestinationPort { get; set; }
public bool TrackUdp { get; set; } = true;
public bool TrackTcp { get; set; } = true;
public bool TrackIcmp { get; set; } = true;

public bool IsEnabled() => TrackClientIp || TrackLocalPort || TrackDestinationIp || TrackDestinationPort;
}
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.6.333</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<Version>2.6.336</Version>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
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 @@ -12,9 +12,9 @@
<RepositoryUrl>https://github.com/vpnhood/vpnhood</RepositoryUrl>
<PackageLicenseExpression>LGPL-2.1-only</PackageLicenseExpression>
<PackageIcon>VpnHood.png</PackageIcon>
<Version>2.6.333</Version>
<AssemblyVersion>2.6.333</AssemblyVersion>
<FileVersion>2.6.333</FileVersion>
<Version>2.6.336</Version>
<AssemblyVersion>2.6.336</AssemblyVersion>
<FileVersion>2.6.336</FileVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand Down
Loading

0 comments on commit 0d64b20

Please sign in to comment.