aboutsummaryrefslogtreecommitdiff
path: root/tools/Crupest.V2ray/Crupest.V2ray/Program.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-09-17 23:59:44 +0800
committercrupest <crupest@outlook.com>2024-10-03 01:22:38 +0800
commitfb9cbc7d9c1dffc45360536c3ec543a275accf89 (patch)
treecee500837fb1fbc2e10d03af04d087a099fc11b8 /tools/Crupest.V2ray/Crupest.V2ray/Program.cs
parentb610b87deaae8ed029793049c6f75dcc87353424 (diff)
downloadcrupest-fb9cbc7d9c1dffc45360536c3ec543a275accf89.tar.gz
crupest-fb9cbc7d9c1dffc45360536c3ec543a275accf89.tar.bz2
crupest-fb9cbc7d9c1dffc45360536c3ec543a275accf89.zip
feat(secret): add surge rule set generation.
TODO: 1. Remove ruby tools. 2. Rename v2ray.
Diffstat (limited to 'tools/Crupest.V2ray/Crupest.V2ray/Program.cs')
-rw-r--r--tools/Crupest.V2ray/Crupest.V2ray/Program.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/Crupest.V2ray/Crupest.V2ray/Program.cs b/tools/Crupest.V2ray/Crupest.V2ray/Program.cs
index a40aa21..0e98861 100644
--- a/tools/Crupest.V2ray/Crupest.V2ray/Program.cs
+++ b/tools/Crupest.V2ray/Crupest.V2ray/Program.cs
@@ -12,6 +12,8 @@ public static class Program
Assembly.GetExecutingAssembly().Location) ?? throw new Exception("Can't get the path of Crupest.V2ray."));
private const string ConfigOutputFileName = "config.json";
+ private const string SurgeRuleSetChinaOutputFileName = "ChinaRuleSet.txt";
+ private const string SurgeRuleSetGlobalOutputFileName = "GlobalRuleSet.txt";
public static void RunV2rayAndWatchConfigChange()
{
@@ -68,6 +70,16 @@ public static class Program
GeoDataManager.Instance.Download(CrupestV2rayDirectory, false);
return;
}
+ else if (verb == "generate-surge-rule-set" || verb == "gs")
+ {
+ SurgeConfigGenerator.GenerateTo(
+ Path.Join(CrupestV2rayDirectory, "proxy.txt"),
+ Path.Join(CrupestV2rayDirectory, SurgeRuleSetChinaOutputFileName),
+ Path.Join(CrupestV2rayDirectory, SurgeRuleSetGlobalOutputFileName),
+ true, false
+ );
+ return;
+ }
else if (verb == "generate" || verb == "g")
{
var config = V2rayConfig.FromDirectory(CrupestV2rayDirectory);