diff options
author | crupest <crupest@outlook.com> | 2023-09-05 17:18:11 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2023-09-05 17:18:11 +0800 |
commit | a418be478a915d9b0726e5d03e691c74f176fe65 (patch) | |
tree | d1df290107119dedadf094cb7e026554239b683c /tools | |
parent | 4f1862ca278020930631548726477ec1ebb8ecbf (diff) | |
download | crupest-a418be478a915d9b0726e5d03e691c74f176fe65.tar.gz crupest-a418be478a915d9b0726e5d03e691c74f176fe65.tar.bz2 crupest-a418be478a915d9b0726e5d03e691c74f176fe65.zip |
Continue to develop mysterious tool.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Crupest.V2ray/.gitignore | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/.gitignore (renamed from tools/V2rayConfigGen/V2rayConfigGen/.gitignore) | 0 | ||||
-rw-r--r-- | tools/Crupest.V2ray/Crupest.V2ray/ConfigGenerationWatcher.cs | 55 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/Crupest.V2ray.csproj (renamed from tools/V2rayConfigGen/V2rayConfigGen/V2rayConfigGen.csproj) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/FileUtility.cs (renamed from tools/V2rayConfigGen/V2rayConfigGen/FileUtility.cs) | 0 | ||||
-rw-r--r-- | tools/Crupest.V2ray/Crupest.V2ray/GeoDataDownloader.cs | 42 | ||||
-rw-r--r-- | tools/Crupest.V2ray/Crupest.V2ray/Program.cs | 45 | ||||
-rw-r--r-- | tools/Crupest.V2ray/Crupest.V2ray/Properties/PublishProfiles/FolderProfile.pubxml | 13 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/V2rayConfig.cs (renamed from tools/V2rayConfigGen/V2rayConfigGen/V2rayConfig.cs) | 3 | ||||
-rw-r--r-- | tools/Crupest.V2ray/Crupest.V2ray/V2rayController.cs | 88 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/V2rayRouting.cs (renamed from tools/V2rayConfigGen/V2rayConfigGen/V2rayRouting.cs) | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/V2rayRoutingRule.cs (renamed from tools/V2rayConfigGen/V2rayConfigGen/V2rayRoutingRule.cs) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/V2rayRoutingRuleMatcher.cs (renamed from tools/V2rayConfigGen/V2rayConfigGen/V2rayRoutingRuleMatcher.cs) | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/V2rayVmessProxy.cs (renamed from tools/V2rayConfigGen/V2rayConfigGen/V2rayVmessProxy.cs) | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/config.json.template (renamed from tools/V2rayConfigGen/V2rayConfigGen/config.json.template) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/Crupest.V2ray/proxy.txt (renamed from tools/V2rayConfigGen/V2rayConfigGen/proxy.txt) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/Crupest.V2ray/CrupestV2ray.sln (renamed from tools/V2rayConfigGen/V2rayConfigGen.sln) | 15 | ||||
-rwxr-xr-x | tools/V2rayConfigGen/.gitignore | 2 | ||||
-rwxr-xr-x | tools/V2rayConfigGen/V2rayConfigGen/Program.cs | 22 |
19 files changed, 271 insertions, 41 deletions
diff --git a/tools/Crupest.V2ray/.gitignore b/tools/Crupest.V2ray/.gitignore new file mode 100644 index 0000000..15db15d --- /dev/null +++ b/tools/Crupest.V2ray/.gitignore @@ -0,0 +1,5 @@ +.vs +bin +obj +*.pubxml.user +*.csproj.user diff --git a/tools/V2rayConfigGen/V2rayConfigGen/.gitignore b/tools/Crupest.V2ray/Crupest.V2ray/.gitignore index c936492..c936492 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/.gitignore +++ b/tools/Crupest.V2ray/Crupest.V2ray/.gitignore diff --git a/tools/Crupest.V2ray/Crupest.V2ray/ConfigGenerationWatcher.cs b/tools/Crupest.V2ray/Crupest.V2ray/ConfigGenerationWatcher.cs new file mode 100644 index 0000000..9ca5741 --- /dev/null +++ b/tools/Crupest.V2ray/Crupest.V2ray/ConfigGenerationWatcher.cs @@ -0,0 +1,55 @@ +namespace Crupest.V2ray; + +public class ConfigGenerationWatcher +{ + public ConfigGenerationWatcher() : this(Program.ExeDir, Program.ConfigTemplateFileName, Program.VmessConfigFileName, Program.ProxyConfigFileName, Path.Combine(Program.ExeDir, Program.ConfigOutputFileName), new List<string>()) + { + + } + + public ConfigGenerationWatcher(string directory, string configTemplateFileName, string vmessConfigFileName, string proxyConfigFileName, string configOutputPath, List<string> otherWatchFiles) + { + Directory = directory; + ConfigTemplateFileName = configTemplateFileName; + VmessConfigFileName = vmessConfigFileName; + ProxyConfigFileName = proxyConfigFileName; + ConfigOutputPath = configOutputPath; + OtherWatchFiles = otherWatchFiles; + } + + public string Directory { get; set; } + public string ConfigTemplateFileName { get; set; } + public string VmessConfigFileName { get; set; } + public string ProxyConfigFileName { get; set; } + public List<string> OtherWatchFiles { get; set; } + public string ConfigOutputPath { get; set; } + + public string ConfigTemplateFilePath => Path.Combine(Directory, ConfigTemplateFileName); + public string VmessConfigFilePath => Path.Combine(Directory, VmessConfigFileName); + public string ProxyConfigFilePath => Path.Combine(Directory, ProxyConfigFileName); + + public delegate void OnConfigChangedHandler(); + + public void Generate() + { + var config = V2rayConfig.FromFiles(ConfigTemplateFilePath, VmessConfigFilePath, ProxyConfigFilePath); + + File.WriteAllText(ConfigOutputPath, config.ToJson()); + } + + public void Run(OnConfigChangedHandler onChanged) + { + var sourceWatcher = new FileSystemWatcher(Directory); + sourceWatcher.Filters.Add(ConfigTemplateFileName); + sourceWatcher.Filters.Add(VmessConfigFileName); + sourceWatcher.Filters.Add(ProxyConfigFileName); + OtherWatchFiles.ForEach((f) => sourceWatcher.Filters.Add(f)); + sourceWatcher.NotifyFilter = NotifyFilters.LastWrite; + + while (true) + { + var result = sourceWatcher.WaitForChanged(WatcherChangeTypes.Changed); + onChanged(); + } + } +} diff --git a/tools/V2rayConfigGen/V2rayConfigGen/V2rayConfigGen.csproj b/tools/Crupest.V2ray/Crupest.V2ray/Crupest.V2ray.csproj index 38f0937..38f0937 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/V2rayConfigGen.csproj +++ b/tools/Crupest.V2ray/Crupest.V2ray/Crupest.V2ray.csproj diff --git a/tools/V2rayConfigGen/V2rayConfigGen/FileUtility.cs b/tools/Crupest.V2ray/Crupest.V2ray/FileUtility.cs index 08de673..08de673 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/FileUtility.cs +++ b/tools/Crupest.V2ray/Crupest.V2ray/FileUtility.cs diff --git a/tools/Crupest.V2ray/Crupest.V2ray/GeoDataDownloader.cs b/tools/Crupest.V2ray/Crupest.V2ray/GeoDataDownloader.cs new file mode 100644 index 0000000..d3efc1f --- /dev/null +++ b/tools/Crupest.V2ray/Crupest.V2ray/GeoDataDownloader.cs @@ -0,0 +1,42 @@ +namespace Crupest.V2ray; + +public class GeoDataDownloader +{ + public record GithubReleaseAsset(string ResourceName, string User, string Repo, string AssetName, string Output); + + public GeoDataDownloader() + { + Resources = new() + { + new("geosite", "v2fly", "domain-list-community", "dlc.dat", "geosite.dat"), + new("geoip", "v2fly", "geoip", "geoip.dat", "geoip.dat"), + new("geosite", "v2fly", "geoip", "geoip-only-cn-private.dat", "geoip-only-cn-private.dat") + }; + } + + public List<GithubReleaseAsset> Resources { get; set; } + + public static string GetReleaseFileUrl(string user, string repo, string assetName) + { + return $"https://github.com/{user}/{repo}/releases/latest/download/{assetName}"; + } + + public static void GithubDownload(HttpClient httpClient, string user, string repo, string assetName, string outputPath) + { + using var responseStream = httpClient.GetStreamAsync(GetReleaseFileUrl(user, repo, assetName)).Result; + using var outputFileStream = File.OpenWrite(outputPath); + responseStream.CopyTo(outputFileStream); + } + + public void Download(string outputDir) + { + using var httpClient = new HttpClient(); + + foreach (var resource in Resources) + { + Console.WriteLine($"Downloading {resource.ResourceName}..."); + GithubDownload(httpClient, resource.User, resource.Repo, resource.AssetName, Path.Combine(outputDir, resource.Output)); + Console.WriteLine($"Downloaded {resource.ResourceName}!"); + } + } +} diff --git a/tools/Crupest.V2ray/Crupest.V2ray/Program.cs b/tools/Crupest.V2ray/Crupest.V2ray/Program.cs new file mode 100644 index 0000000..793f6e7 --- /dev/null +++ b/tools/Crupest.V2ray/Crupest.V2ray/Program.cs @@ -0,0 +1,45 @@ +using System.Diagnostics; +using System.Reflection; + +namespace Crupest.V2ray; + +public static class Program +{ + public const string ConfigTemplateFileName = "config.json.template"; + public const string VmessConfigFileName = "vmess.txt"; + public const string ProxyConfigFileName = "proxy.txt"; + public const string ConfigOutputFileName = "config.json"; + + public static string ExeDir { get; } = Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? throw new Exception("Can't get the path of exe.")); + + + public static void Main(string[] args) + { + if (args.Length != 0) + { + if (args.Length != 1) + { + throw new Exception("Invalid command line arguments."); + } + var verb = args[0].ToLower(); + if (verb == "download-geodata" || verb == "dg") + { + var geoDataDonwloader = new GeoDataDownloader(); + geoDataDonwloader.Download(ExeDir); + return; + } + } + + var v2rayController = new V2rayController(); + var configGenerationWatcher = new ConfigGenerationWatcher(); + + configGenerationWatcher.Generate(); + v2rayController.Start(); + + configGenerationWatcher.Run(() => + { + configGenerationWatcher.Generate(); + v2rayController.Restart(); + }); + } +} diff --git a/tools/Crupest.V2ray/Crupest.V2ray/Properties/PublishProfiles/FolderProfile.pubxml b/tools/Crupest.V2ray/Crupest.V2ray/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..bbdd2ad --- /dev/null +++ b/tools/Crupest.V2ray/Crupest.V2ray/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +https://go.microsoft.com/fwlink/?LinkID=208121. +--> +<Project> + <PropertyGroup> + <Configuration>Release</Configuration> + <Platform>Any CPU</Platform> + <PublishDir>bin\Release\net7.0\publish\</PublishDir> + <PublishProtocol>FileSystem</PublishProtocol> + <_TargetId>Folder</_TargetId> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tools/V2rayConfigGen/V2rayConfigGen/V2rayConfig.cs b/tools/Crupest.V2ray/Crupest.V2ray/V2rayConfig.cs index 0d8b0bb..82dc11c 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/V2rayConfig.cs +++ b/tools/Crupest.V2ray/Crupest.V2ray/V2rayConfig.cs @@ -7,7 +7,8 @@ public class V2rayConfig private const string VmessAnchor = "VMESS_PROXY_ANCHOR"; private const string RoutingAnchor = "ROUTING_ANCHOR"; - public V2rayConfig(string template, V2rayVmessProxy vmess, V2rayRouting router) { + public V2rayConfig(string template, V2rayVmessProxy vmess, V2rayRouting router) + { Template = template; Vmess = vmess; Routing = router; diff --git a/tools/Crupest.V2ray/Crupest.V2ray/V2rayController.cs b/tools/Crupest.V2ray/Crupest.V2ray/V2rayController.cs new file mode 100644 index 0000000..5b8fcac --- /dev/null +++ b/tools/Crupest.V2ray/Crupest.V2ray/V2rayController.cs @@ -0,0 +1,88 @@ +using System.Diagnostics; + +namespace Crupest.V2ray; + +public class V2rayController +{ + public const string V2RayAssetLocationEnvironmentVariableName = "V2RAY_LOCATION_ASSET"; + public const string V2RayConfigLocationEnvironmentVariableName = "V2RAY_LOCATION_CONFIG"; + + public V2rayController(string v2rayExePath = "v2ray") : this(v2rayExePath, Program.ExeDir, Program.ExeDir) + { + + } + + public V2rayController(string v2rayExePath, string configDirPath, string assetDirPath) + { + V2rayExePath = v2rayExePath; + ConfigDirPath = configDirPath; + AssetDirPath = assetDirPath; + } + + public string V2rayExePath { get; } + public string ConfigDirPath { get; } + public string AssetDirPath { get; } + public Process? CurrentProcess { get; private set; } + + private Process CreateProcess() + { + var process = new Process(); + + var startInfo = new ProcessStartInfo + { + FileName = V2rayExePath, + }; + startInfo.EnvironmentVariables[V2RayConfigLocationEnvironmentVariableName] = ConfigDirPath; + startInfo.EnvironmentVariables[V2RayAssetLocationEnvironmentVariableName] = AssetDirPath; + + process.StartInfo = startInfo; + process.OutputDataReceived += (_, args) => + { + Console.Out.Write(args.Data); + }; + process.ErrorDataReceived += (_, args) => + { + Console.Error.WriteLine(args.Data); + }; + + return process; + } + + public void Stop() + { + if (CurrentProcess is not null) + { + CurrentProcess.Kill(); + CurrentProcess.Dispose(); + CurrentProcess = null; + Console.WriteLine("V2ray stopped."); + } + } + + public void Start(bool stopOld = false) + { + if (stopOld) Stop(); + + if (CurrentProcess is null) + { + CurrentProcess = CreateProcess(); + CurrentProcess.EnableRaisingEvents = true; + CurrentProcess.Exited += (_, _) => + { + if (CurrentProcess.ExitCode != 0) + { + const string message = "V2ray exits with error."; + Console.Error.WriteLine(message); + throw new Exception(message); + } + }; + CurrentProcess.Start(); + Console.WriteLine("V2ray started."); + } + } + + public void Restart() + { + Start(true); + } +} diff --git a/tools/V2rayConfigGen/V2rayConfigGen/V2rayRouting.cs b/tools/Crupest.V2ray/Crupest.V2ray/V2rayRouting.cs index fe59491..7265b09 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/V2rayRouting.cs +++ b/tools/Crupest.V2ray/Crupest.V2ray/V2rayRouting.cs @@ -17,7 +17,7 @@ public record V2rayRouting(List<V2rayRoutingRule> Rules, string DomainStrategy = { var ruleJsonObjects = new List<object>(); - foreach (var(outBoundTag, proxyRules) in V2rayRoutingRule.GroupByOutboundTag(Rules)) + foreach (var (outBoundTag, proxyRules) in V2rayRoutingRule.GroupByOutboundTag(Rules)) { foreach (var (matchByKind, rules) in V2rayRoutingRule.GroupByMatchByKind(proxyRules)) { @@ -32,7 +32,7 @@ public record V2rayRouting(List<V2rayRoutingRule> Rules, string DomainStrategy = } } - return new RoutingJsonObject(DomainStrategy ,ruleJsonObjects); + return new RoutingJsonObject(DomainStrategy, ruleJsonObjects); } public static V2rayRouting FromStringList(List<string> list, string outboundTag = "proxy") diff --git a/tools/V2rayConfigGen/V2rayConfigGen/V2rayRoutingRule.cs b/tools/Crupest.V2ray/Crupest.V2ray/V2rayRoutingRule.cs index 23c08e7..0218183 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/V2rayRoutingRule.cs +++ b/tools/Crupest.V2ray/Crupest.V2ray/V2rayRoutingRule.cs @@ -1,5 +1,3 @@ -using System.Linq; - namespace Crupest.V2ray; public record V2rayRoutingRule(V2rayRoutingRuleMatcher Matcher, string OutboundTag) diff --git a/tools/V2rayConfigGen/V2rayConfigGen/V2rayRoutingRuleMatcher.cs b/tools/Crupest.V2ray/Crupest.V2ray/V2rayRoutingRuleMatcher.cs index be27231..a13237c 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/V2rayRoutingRuleMatcher.cs +++ b/tools/Crupest.V2ray/Crupest.V2ray/V2rayRoutingRuleMatcher.cs @@ -43,8 +43,10 @@ public record V2rayRoutingRuleMatcher(V2rayRoutingRuleMatcher.MatchKind Kind, st var kind = MatchKind.DomainSuffix; - foreach (var name in Enum.GetNames<MatchKind>()) { - if (line.StartsWith(name)) { + foreach (var name in Enum.GetNames<MatchKind>()) + { + if (line.StartsWith(name)) + { kind = Enum.Parse<MatchKind>(name); line = line[name.Length..]; line = line.Trim(); diff --git a/tools/V2rayConfigGen/V2rayConfigGen/V2rayVmessProxy.cs b/tools/Crupest.V2ray/Crupest.V2ray/V2rayVmessProxy.cs index 25d466e..e701463 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/V2rayVmessProxy.cs +++ b/tools/Crupest.V2ray/Crupest.V2ray/V2rayVmessProxy.cs @@ -7,7 +7,7 @@ public class V2rayVmessProxy public static VmessOutboundJsonObject ByWs(string address, int port, string uuid, string tag, string path) { return new VmessOutboundJsonObject("vmess", new SettingsJsonObject( - new List<VnextJsonObject>{ new VnextJsonObject(address, port, new List<VnextUserJsonObject> { new VnextUserJsonObject(uuid) }) } + new List<VnextJsonObject> { new VnextJsonObject(address, port, new List<VnextUserJsonObject> { new VnextUserJsonObject(uuid) }) } ), tag, StreamSettingsJsonObject.Ws(path)); } } @@ -18,7 +18,8 @@ public class V2rayVmessProxy public record VnextUserJsonObject(string Id, int AlterId = 0, string Security = "auto", int Level = 0); - public record StreamSettingsJsonObject(string Network, string Security, WsSettingsJsonObject WsSettings) { + public record StreamSettingsJsonObject(string Network, string Security, WsSettingsJsonObject WsSettings) + { public static StreamSettingsJsonObject Ws(string path) { return new StreamSettingsJsonObject("ws", "tls", new WsSettingsJsonObject(path, new())); @@ -33,7 +34,8 @@ public class V2rayVmessProxy public string UserId { get; set; } - public V2rayVmessProxy(string host, int port, string userId, string path) { + public V2rayVmessProxy(string host, int port, string userId, string path) + { Host = host; Port = port; UserId = userId; diff --git a/tools/V2rayConfigGen/V2rayConfigGen/config.json.template b/tools/Crupest.V2ray/Crupest.V2ray/config.json.template index 9ba8af6..47187bb 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/config.json.template +++ b/tools/Crupest.V2ray/Crupest.V2ray/config.json.template @@ -1,6 +1,6 @@ { "log": { - "loglevel": "warning" + "loglevel": "info" }, "inbounds": [ { diff --git a/tools/V2rayConfigGen/V2rayConfigGen/proxy.txt b/tools/Crupest.V2ray/Crupest.V2ray/proxy.txt index 4e9d3e8..4e9d3e8 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen/proxy.txt +++ b/tools/Crupest.V2ray/Crupest.V2ray/proxy.txt diff --git a/tools/V2rayConfigGen/V2rayConfigGen.sln b/tools/Crupest.V2ray/CrupestV2ray.sln index e864a06..3045b4e 100755..100644 --- a/tools/V2rayConfigGen/V2rayConfigGen.sln +++ b/tools/Crupest.V2ray/CrupestV2ray.sln @@ -3,27 +3,30 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.7.34024.191 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "V2rayConfigGen", "V2rayConfigGen\V2rayConfigGen.csproj", "{05719320-C91F-4D2A-82A5-1D0247DDB389}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F4C2CE80-CDF8-4B08-8912-D1F0F14196AD}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crupest.V2ray", "Crupest.V2ray\Crupest.V2ray.csproj", "{154D49F2-242E-4384-8D34-73774231AA75}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {05719320-C91F-4D2A-82A5-1D0247DDB389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {05719320-C91F-4D2A-82A5-1D0247DDB389}.Debug|Any CPU.Build.0 = Debug|Any CPU - {05719320-C91F-4D2A-82A5-1D0247DDB389}.Release|Any CPU.ActiveCfg = Release|Any CPU - {05719320-C91F-4D2A-82A5-1D0247DDB389}.Release|Any CPU.Build.0 = Release|Any CPU + {154D49F2-242E-4384-8D34-73774231AA75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {154D49F2-242E-4384-8D34-73774231AA75}.Debug|Any CPU.Build.0 = Debug|Any CPU + {154D49F2-242E-4384-8D34-73774231AA75}.Release|Any CPU.ActiveCfg = Release|Any CPU + {154D49F2-242E-4384-8D34-73774231AA75}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {154D49F2-242E-4384-8D34-73774231AA75} = {F4C2CE80-CDF8-4B08-8912-D1F0F14196AD} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B1E8FD9C-9157-4F4E-8265-4B37F30EEC5E} EndGlobalSection diff --git a/tools/V2rayConfigGen/.gitignore b/tools/V2rayConfigGen/.gitignore deleted file mode 100755 index 1746e32..0000000 --- a/tools/V2rayConfigGen/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin -obj diff --git a/tools/V2rayConfigGen/V2rayConfigGen/Program.cs b/tools/V2rayConfigGen/V2rayConfigGen/Program.cs deleted file mode 100755 index bebdc7a..0000000 --- a/tools/V2rayConfigGen/V2rayConfigGen/Program.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; - -namespace Crupest.V2ray; - -public static class Program -{ - public const string ConfigTemplateFile = "config.json.template"; - public const string VmessConfigFile = "vmess.txt"; - public const string ProxyGeoSitesFile = "proxy.txt"; - - public static void Main(string[] args) - { - var exeLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - var config = V2rayConfig.FromFiles( - Path.Combine(exeLocation, ConfigTemplateFile), - Path.Combine(exeLocation, VmessConfigFile), - Path.Combine(exeLocation, ProxyGeoSitesFile) - ); - - Console.Write(config.ToJson()); - } -} |