Add mieru support (#7828)
This commit is contained in:
@@ -15,5 +15,6 @@ public enum ECoreType
|
|||||||
brook = 27,
|
brook = 27,
|
||||||
overtls = 28,
|
overtls = 28,
|
||||||
shadowquic = 29,
|
shadowquic = 29,
|
||||||
|
mieru = 30,
|
||||||
v2rayN = 99
|
v2rayN = 99
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,6 +560,7 @@ public class Global
|
|||||||
{ ECoreType.brook, "txthinking/brook" },
|
{ ECoreType.brook, "txthinking/brook" },
|
||||||
{ ECoreType.overtls, "ShadowsocksR-Live/overtls" },
|
{ ECoreType.overtls, "ShadowsocksR-Live/overtls" },
|
||||||
{ ECoreType.shadowquic, "spongebob888/shadowquic" },
|
{ ECoreType.shadowquic, "spongebob888/shadowquic" },
|
||||||
|
{ ECoreType.mieru, "enfein/mieru" },
|
||||||
{ ECoreType.v2rayN, "2dust/v2rayN" },
|
{ ECoreType.v2rayN, "2dust/v2rayN" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ public sealed class CoreInfoManager
|
|||||||
Url = GetCoreUrl(ECoreType.v2fly),
|
Url = GetCoreUrl(ECoreType.v2fly),
|
||||||
Match = "V2Ray",
|
Match = "V2Ray",
|
||||||
VersionArg = "-version",
|
VersionArg = "-version",
|
||||||
|
Environment = new Dictionary<string, string?>()
|
||||||
|
{
|
||||||
|
{ Global.V2RayLocalAsset, Utils.GetBinPath("") },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
new CoreInfo
|
new CoreInfo
|
||||||
@@ -90,6 +94,10 @@ public sealed class CoreInfoManager
|
|||||||
Url = GetCoreUrl(ECoreType.v2fly_v5),
|
Url = GetCoreUrl(ECoreType.v2fly_v5),
|
||||||
Match = "V2Ray",
|
Match = "V2Ray",
|
||||||
VersionArg = "version",
|
VersionArg = "version",
|
||||||
|
Environment = new Dictionary<string, string?>()
|
||||||
|
{
|
||||||
|
{ Global.V2RayLocalAsset, Utils.GetBinPath("") },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
new CoreInfo
|
new CoreInfo
|
||||||
@@ -107,6 +115,11 @@ public sealed class CoreInfoManager
|
|||||||
DownloadUrlOSXArm64 = urlXray + "/download/{0}/Xray-macos-arm64-v8a.zip",
|
DownloadUrlOSXArm64 = urlXray + "/download/{0}/Xray-macos-arm64-v8a.zip",
|
||||||
Match = "Xray",
|
Match = "Xray",
|
||||||
VersionArg = "-version",
|
VersionArg = "-version",
|
||||||
|
Environment = new Dictionary<string, string?>()
|
||||||
|
{
|
||||||
|
{ Global.XrayLocalAsset, Utils.GetBinPath("") },
|
||||||
|
{ Global.XrayLocalCert, Utils.GetBinPath("") },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
new CoreInfo
|
new CoreInfo
|
||||||
@@ -205,12 +218,24 @@ public sealed class CoreInfoManager
|
|||||||
new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.shadowquic,
|
CoreType = ECoreType.shadowquic,
|
||||||
CoreExes = [ "shadowquic", "shadowquic"],
|
CoreExes = [ "shadowquic" ],
|
||||||
Arguments = "-c {0}",
|
Arguments = "-c {0}",
|
||||||
Url = GetCoreUrl(ECoreType.shadowquic),
|
Url = GetCoreUrl(ECoreType.shadowquic),
|
||||||
AbsolutePath = false,
|
AbsolutePath = false,
|
||||||
}
|
},
|
||||||
|
|
||||||
|
new CoreInfo
|
||||||
|
{
|
||||||
|
CoreType = ECoreType.mieru,
|
||||||
|
CoreExes = [ "mieru" ],
|
||||||
|
Arguments = "run",
|
||||||
|
Url = GetCoreUrl(ECoreType.mieru),
|
||||||
|
AbsolutePath = false,
|
||||||
|
Environment = new Dictionary<string, string?>()
|
||||||
|
{
|
||||||
|
{ "MIERU_CONFIG_JSON_FILE", "{0}" },
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ public class CoreManager
|
|||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
||||||
Environment.SetEnvironmentVariable(Global.V2RayLocalAsset, Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
|
||||||
Environment.SetEnvironmentVariable(Global.XrayLocalAsset, Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
|
||||||
Environment.SetEnvironmentVariable(Global.XrayLocalCert, Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
|
||||||
|
|
||||||
//Copy the bin folder to the storage location (for init)
|
//Copy the bin folder to the storage location (for init)
|
||||||
if (Environment.GetEnvironmentVariable(Global.LocalAppData) == "1")
|
if (Environment.GetEnvironmentVariable(Global.LocalAppData) == "1")
|
||||||
{
|
{
|
||||||
@@ -277,6 +273,10 @@ public class CoreManager
|
|||||||
StandardErrorEncoding = displayLog ? Encoding.UTF8 : null,
|
StandardErrorEncoding = displayLog ? Encoding.UTF8 : null,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
foreach (var kv in coreInfo.Environment)
|
||||||
|
{
|
||||||
|
proc.StartInfo.Environment[kv.Key] = string.Format(kv.Value, coreInfo.AbsolutePath ? Utils.GetBinConfigPath(configPath).AppendQuotes() : configPath);
|
||||||
|
}
|
||||||
|
|
||||||
if (displayLog)
|
if (displayLog)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ public class CoreInfo
|
|||||||
public string? Match { get; set; }
|
public string? Match { get; set; }
|
||||||
public string? VersionArg { get; set; }
|
public string? VersionArg { get; set; }
|
||||||
public bool AbsolutePath { get; set; }
|
public bool AbsolutePath { get; set; }
|
||||||
|
public IDictionary<string, string?> Environment { get; set; } = new Dictionary<string, string?>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user