-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/vnext' into vnext
# Conflicts: # DragonFruit.OnionFruit.Web.Worker/Generators/OnionDbGenerator.cs
- Loading branch information
Showing
42 changed files
with
627 additions
and
173 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
DragonFruit.OnionFruit.Web.Worker/Database/OnionFruitNodeInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using DragonFruit.OnionFruit.Web.Worker.Sources.Onionoo.Enums; | ||
using Redis.OM.Modeling; | ||
|
||
namespace DragonFruit.OnionFruit.Web.Worker.Database; | ||
|
||
[Document(Prefixes = new[] { "yuna:onionfruit-nodes" }, IndexName = "yuna:onionfruit-nodes-idx", StorageType = StorageType.Json)] | ||
[Document(Prefixes = new[] {"yuna:onionfruit-nodes"}, IndexName = "yuna:onionfruit-nodes-idx", StorageType = StorageType.Json)] | ||
public class OnionFruitNodeInfo | ||
{ | ||
[Indexed] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// OnionFruit Web Copyright DragonFruit Network | ||
// Licensed under the MIT License. Please refer to the LICENSE file at the root of this project for details | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
@@ -8,7 +8,7 @@ | |
using DragonFruit.OnionFruit.Web.Worker.Sources; | ||
using DragonFruit.OnionFruit.Web.Worker.Sources.Onionoo; | ||
using DragonFruit.OnionFruit.Web.Worker.Sources.Onionoo.Enums; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage.Abstractions; | ||
|
||
namespace DragonFruit.OnionFruit.Web.Worker.Generators; | ||
|
||
|
@@ -29,12 +29,12 @@ public async Task GenerateDatabase(IFileSink fileSink) | |
["in"] = CountriesWithFlag(_torInfo.Countries, TorNodeFlags.Guard), | ||
["out"] = CountriesWithFlag(_torInfo.Countries, TorNodeFlags.Exit) | ||
}; | ||
|
||
await fileSink.CreateFile("legacy/countries.json").WriteAsync(JsonSerializer.SerializeToUtf8Bytes(clientData)).ConfigureAwait(false); | ||
} | ||
|
||
private static IEnumerable<string> CountriesWithFlag(IEnumerable<IGrouping<string, TorRelayDetails>> info, TorNodeFlags flag) | ||
{ | ||
return info.Where(x => x.Any(y => y.Flags.HasFlag(flag))).Select(x => x.Key); | ||
} | ||
} | ||
} |
7 changes: 5 additions & 2 deletions
7
DragonFruit.OnionFruit.Web.Worker/Generators/ClientGeoIpFileGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
using System.IO; | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using DragonFruit.OnionFruit.Web.Worker.Sources; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage.Abstractions; | ||
|
||
namespace DragonFruit.OnionFruit.Web.Worker.Generators; | ||
|
||
|
5 changes: 4 additions & 1 deletion
5
DragonFruit.OnionFruit.Web.Worker/Generators/IDatabaseGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System.Threading.Tasks; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage.Abstractions; | ||
using JetBrains.Annotations; | ||
|
||
namespace DragonFruit.OnionFruit.Web.Worker.Generators; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System.Collections.Generic; | ||
using DragonFruit.OnionFruit.Web.Worker.Sources; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage.Abstractions; | ||
using Google.Protobuf; | ||
using NetTools; | ||
|
||
|
@@ -15,11 +18,11 @@ public OnionLiteDbGenerator(OnionooDataSource onionoo, LocationDbSource location | |
: base(onionoo, locationDb) | ||
{ | ||
} | ||
|
||
protected override OnionDb CreateBaseDb() | ||
{ | ||
var baseDb = base.CreateBaseDb(); | ||
|
||
baseDb.ClearGeoLicense(); | ||
baseDb.ClearGeoDirVersion(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using DragonFruit.OnionFruit.Web.Worker.Database; | ||
using DragonFruit.OnionFruit.Web.Worker.Sources; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage.Abstractions; | ||
using Redis.OM.Contracts; | ||
|
||
namespace DragonFruit.OnionFruit.Web.Worker.Generators; | ||
|
@@ -23,7 +26,7 @@ public async Task GenerateDatabase(IFileSink fileSink) | |
{ | ||
var table = _redis.RedisCollection<OnionFruitNodeInfo>(); | ||
var dbVersion = (long)_torDirectory.DataLastModified.Subtract(DateTime.UnixEpoch).TotalSeconds; | ||
|
||
foreach (var relay in _torDirectory.Relays) | ||
{ | ||
// drop the port off the addresses | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
using System.Runtime.InteropServices; | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
namespace DragonFruit.OnionFruit.Web.Worker.Native; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
using System; | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
// ReSharper disable InconsistentNaming | ||
namespace DragonFruit.OnionFruit.Web.Worker.Native; | ||
|
||
[StructLayout(LayoutKind.Sequential, Pack = 1)] | ||
|
@@ -26,8 +30,9 @@ public struct NetworkEntry | |
{ | ||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] | ||
public byte[] network; | ||
|
||
public byte cidr; | ||
|
||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] | ||
public byte[] country_code; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using DnsClient; | ||
using DragonFruit.Data; | ||
using DragonFruit.OnionFruit.Web.Worker.Storage; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
|
@@ -67,7 +69,7 @@ private static void ConfigureServices(HostBuilderContext context, IServiceCollec | |
// redis + redis.om | ||
services.AddSingleton(RedisClientConfigurator.CreateConnectionMultiplexer(context.Configuration, true)); | ||
services.AddSingleton<IRedisConnectionProvider>(s => new RedisConnectionProvider(s.GetRequiredService<IConnectionMultiplexer>())); | ||
|
||
// api | ||
services.AddSingleton<ILookupClient, LookupClient>(); | ||
services.AddSingleton<ApiClient, WorkerApiClient>(); | ||
|
5 changes: 4 additions & 1 deletion
5
...Worker/Storage/RedisClientConfigurator.cs → ...uit.Web.Worker/RedisClientConfigurator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System; | ||
using Microsoft.Extensions.Configuration; | ||
using StackExchange.Redis; | ||
|
||
namespace DragonFruit.OnionFruit.Web.Worker.Storage; | ||
namespace DragonFruit.OnionFruit.Web.Worker; | ||
|
||
public static class RedisClientConfigurator | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
// OnionFruit™ Web Copyright DragonFruit Network <[email protected]> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using JetBrains.Annotations; | ||
|
Oops, something went wrong.