mirror of https://github.com/2dust/v2rayN
Add sing-box srs custom url support for fix TUN (#5835)
Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>pull/5840/head
parent
e96c9abd69
commit
eebb6735aa
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -365,6 +365,7 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
@ -624,6 +625,19 @@
|
|||
Grid.Column="1"
|
||||
Width="300"
|
||||
Classes="Margin8" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="23"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Classes="Margin8"
|
||||
Text="{x:Static resx:ResUI.TbSettingsSrsFilesSource}" />
|
||||
<ComboBox
|
||||
x:Name="cmbSrsFilesSourceUrl"
|
||||
Grid.Row="23"
|
||||
Grid.Column="1"
|
||||
Width="300"
|
||||
Classes="Margin8" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
|
|
@ -87,6 +87,10 @@ namespace v2rayN.Desktop.Views
|
|||
{
|
||||
cmbGetFilesSourceUrl.Items.Add(it);
|
||||
});
|
||||
Global.SingboxRulesetSources.ForEach(it =>
|
||||
{
|
||||
cmbSrsFilesSourceUrl.Items.Add(it);
|
||||
});
|
||||
foreach (EGirdOrientation it in Enum.GetValues(typeof(EGirdOrientation)))
|
||||
{
|
||||
cmbMainGirdOrientation.Items.Add(it.ToString());
|
||||
|
@ -137,6 +141,7 @@ namespace v2rayN.Desktop.Views
|
|||
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.MainGirdOrientation, v => v.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.GeoFileSourceUrl, v => v.cmbGetFilesSourceUrl.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SrsFileSourceUrl, v => v.cmbSrsFilesSourceUrl.SelectedValue).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.notProxyLocalAddress, v => v.tognotProxyLocalAddress.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.SelectedValue).DisposeWith(disposables);
|
||||
|
|
|
@ -529,6 +529,7 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
@ -862,6 +863,22 @@
|
|||
Margin="{StaticResource Margin8}"
|
||||
IsEditable="True"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="23"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource Margin8}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsSrsFilesSource}" />
|
||||
<ComboBox
|
||||
x:Name="cmbSrsFilesSourceUrl"
|
||||
Grid.Row="23"
|
||||
Grid.Column="1"
|
||||
Width="300"
|
||||
Margin="{StaticResource Margin8}"
|
||||
IsEditable="True"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
|
|
@ -89,6 +89,10 @@ namespace v2rayN.Views
|
|||
{
|
||||
cmbGetFilesSourceUrl.Items.Add(it);
|
||||
});
|
||||
Global.SingboxRulesetSources.ForEach(it =>
|
||||
{
|
||||
cmbSrsFilesSourceUrl.Items.Add(it);
|
||||
});
|
||||
foreach (EGirdOrientation it in Enum.GetValues(typeof(EGirdOrientation)))
|
||||
{
|
||||
cmbMainGirdOrientation.Items.Add(it.ToString());
|
||||
|
@ -150,6 +154,7 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.MainGirdOrientation, v => v.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.GeoFileSourceUrl, v => v.cmbGetFilesSourceUrl.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SrsFileSourceUrl, v => v.cmbSrsFilesSourceUrl.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.notProxyLocalAddress, v => v.tognotProxyLocalAddress.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.Text).DisposeWith(disposables);
|
||||
|
|
Loading…
Reference in New Issue