forked from Stormancer/netproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
27 lines (25 loc) · 839 Bytes
/
Program.cs
File metadata and controls
27 lines (25 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using NetProxy.Core;
namespace NetProxy.Console
{
internal class Program
{
static void Main(string[] args)
{
try
{
var configJson = System.IO.File.ReadAllText("config.json");
Dictionary<string, ProxyConfig>? configs = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, ProxyConfig>>(configJson);
if (configs == null)
{
throw new Exception("configs is null");
}
var tasks = configs.Select(c => ProxyFactory.ProxyFromConfig(c.Value, c.Key));
Task.WhenAll(tasks).Wait();
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"An error occurred : {ex}");
}
}
}
}