mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-12 17:18:21 +03:00
Add sing-box srs custom url support for fix TUN (#5835)
Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
@@ -119,6 +119,11 @@
|
||||
@"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/{0}.dat",
|
||||
};
|
||||
|
||||
public static readonly List<string> SingboxRulesetSources = new() {
|
||||
SingboxRulesetUrl,
|
||||
@"https://raw.githubusercontent.com/runetfreedom/russia-v2ray-rules-dat/refs/heads/release/sing-box/rule-set-{0}/{1}.srs",
|
||||
};
|
||||
|
||||
public static readonly Dictionary<string, string> UserAgentTexts = new()
|
||||
{
|
||||
{"chrome","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" },
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
public string defIEProxyExceptions { get; set; }
|
||||
public string subConvertUrl { get; set; } = string.Empty;
|
||||
public string? geoSourceUrl { get; set; }
|
||||
public string? srsSourceUrl { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
Generated
+12
-1
@@ -3012,7 +3012,18 @@ namespace ServiceLib.Resx {
|
||||
return ResourceManager.GetString("TbSettingsGeoFilesSource", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Sing-box srs files source (optional) 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsSrsFilesSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("TbSettingsSrsFilesSource", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 HTTP Port 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -1330,6 +1330,8 @@
|
||||
<data name="TbSettingsGeoFilesSource" xml:space="preserve">
|
||||
<value>Geo files source (optional)</value>
|
||||
</data>
|
||||
<data name="TbSettingsSrsFilesSource" xml:space="preserve">
|
||||
<value>Sing-box srs files source (optional)</value>
|
||||
<data name="UpgradeAppNotExistTip" xml:space="preserve">
|
||||
<value>UpgradeApp does not exist</value>
|
||||
</data>
|
||||
|
||||
@@ -1367,12 +1367,16 @@ namespace ServiceLib.Services.CoreConfig
|
||||
}
|
||||
else
|
||||
{
|
||||
var srsUrl = string.IsNullOrEmpty(_config.constItem.srsSourceUrl)
|
||||
? Global.SingboxRulesetUrl
|
||||
: _config.constItem.srsSourceUrl;
|
||||
|
||||
customRuleset = new()
|
||||
{
|
||||
type = "remote",
|
||||
format = "binary",
|
||||
tag = item,
|
||||
url = string.Format(Global.SingboxRulesetUrl, item.StartsWith(geosite) ? geosite : geoip, item),
|
||||
url = string.Format(srsUrl, item.StartsWith(geosite) ? geosite : geoip, item),
|
||||
download_detour = Global.ProxyTag
|
||||
};
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ namespace ServiceLib.Services
|
||||
var geoUrl = string.IsNullOrEmpty(config?.constItem.geoSourceUrl)
|
||||
? Global.GeoUrl
|
||||
: config.constItem.geoSourceUrl;
|
||||
var url = string.Format(Global.GeoUrl, geoName);
|
||||
var url = string.Format(geoUrl, geoName);
|
||||
var fileName = Utils.GetTempPath(Utils.GetGuid());
|
||||
|
||||
DownloadService downloadHandle = new();
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace ServiceLib.ViewModels
|
||||
[Reactive] public string SubConvertUrl { get; set; }
|
||||
[Reactive] public int MainGirdOrientation { get; set; }
|
||||
[Reactive] public string GeoFileSourceUrl { get; set; }
|
||||
[Reactive] public string SrsFileSourceUrl { get; set; }
|
||||
|
||||
#endregion UI
|
||||
|
||||
@@ -166,6 +167,7 @@ namespace ServiceLib.ViewModels
|
||||
SubConvertUrl = _config.constItem.subConvertUrl;
|
||||
MainGirdOrientation = (int)_config.uiItem.mainGirdOrientation;
|
||||
GeoFileSourceUrl = _config.constItem.geoSourceUrl;
|
||||
SrsFileSourceUrl = _config.constItem.srsSourceUrl;
|
||||
|
||||
#endregion UI
|
||||
|
||||
@@ -319,6 +321,7 @@ namespace ServiceLib.ViewModels
|
||||
_config.constItem.subConvertUrl = SubConvertUrl;
|
||||
_config.uiItem.mainGirdOrientation = (EGirdOrientation)MainGirdOrientation;
|
||||
_config.constItem.geoSourceUrl = GeoFileSourceUrl;
|
||||
_config.constItem.srsSourceUrl = SrsFileSourceUrl;
|
||||
|
||||
//systemProxy
|
||||
_config.systemProxyItem.systemProxyExceptions = systemProxyExceptions;
|
||||
|
||||
Reference in New Issue
Block a user