Skip to content

Commit

Permalink
Allow disabling LogAnonymizer in server config
Browse files Browse the repository at this point in the history
  • Loading branch information
trudyhood committed Jan 10, 2023
1 parent d949207 commit 6d5e723
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Update: Optimizing UDP Processing
* Update: Reporting improved; prevent too many duplicate errors
* Fix: File Access Server throw access voliatile randomly
* Feature: Allow disabling LogAnonymizer in server config

# v2.6.331
### Client
Expand Down
4 changes: 2 additions & 2 deletions VpnHood.Server.Access/ServerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public class ServerConfig

[JsonPropertyName("Session")]
public SessionOptions SessionOptions { get; set; } = new();

public string ConfigCode { get; set; } = string.Empty;

[JsonConverter(typeof(ArrayConverter<IPEndPoint, IPEndPointConverter>))]
public IPEndPoint[] TcpEndPoints { get; set; } = new IPEndPoint[] { new(IPAddress.Any, 443), new(IPAddress.IPv6Any, 443) };
public IPEndPoint[] TcpEndPoints { get; set; } = { new(IPAddress.Any, 443), new(IPAddress.IPv6Any, 443) };

[JsonConverter(typeof(TimeSpanConverter))]
public TimeSpan UpdateStatusInterval { get; set; } = TimeSpan.FromSeconds(120);
public int? MinCompletionPortThreads { get; set; }
public int? MaxCompletionPortThreads { get; set; }
public bool LogAnonymizer { get; set; } = true;
}
3 changes: 3 additions & 0 deletions VpnHood.Server.App.Net/ServerApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ private void StartServer(CommandLineApplication cmdApp)
cmdApp.Description = "Run the server (default command)";
cmdApp.OnExecuteAsync(async (cancellationToken) =>
{
// LogAnonymizer is on by default
VhLogger.IsAnonymousMode = AppSettings.ServerConfig?.LogAnonymizer ?? true;

// find listener port
if (IsAnotherInstanceRunning())
throw new AnotherInstanceIsRunning();
Expand Down
3 changes: 2 additions & 1 deletion VpnHood.Server/VpnHoodServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static void ConfigMinIoThreads(int? minCompletionPortThreads)
if (minCompletionPortThreads != 0) newMinCompletionPortThreads = minCompletionPortThreads.Value;
ThreadPool.SetMinThreads(minWorkerThreads, newMinCompletionPortThreads);
VhLogger.Instance.LogInformation(
"MinWorkerThreads: {MinWorkerThreads}, MinCompletionPortThreads: {newMinCompletionPortThreads}",
"MinWorkerThreads: {MinWorkerThreads}, MinCompletionPortThreads: {newMinCompletionPortThreads}",
minWorkerThreads, newMinCompletionPortThreads);
}

Expand Down Expand Up @@ -158,6 +158,7 @@ private async Task Configure()
_lastConfigCode = serverConfig.ConfigCode;
ConfigMinIoThreads(serverConfig.MinCompletionPortThreads);
ConfigMaxIoThreads(serverConfig.MaxCompletionPortThreads);
VhLogger.IsAnonymousMode = serverConfig.LogAnonymizer;

// starting the listeners
var verb = _tcpHost.IsStarted ? "Restarting" : "Starting";
Expand Down
1 change: 1 addition & 0 deletions VpnHood.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Analytics/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=anony/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Anonymize/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Anonymizer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Argb/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cryptor/@EntryIndexedValue">True</s:Boolean>
Expand Down

0 comments on commit 6d5e723

Please sign in to comment.