mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-30 20:28:50 +00:00
Add destOverride
This commit is contained in:
parent
315d4b75b2
commit
d748e6eff4
7 changed files with 34 additions and 6 deletions
|
@ -175,6 +175,7 @@ namespace v2rayN
|
||||||
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
||||||
public static readonly List<string> InboundTags = new() { "socks", "http", "socks2", "http2" };
|
public static readonly List<string> InboundTags = new() { "socks", "http", "socks2", "http2" };
|
||||||
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
|
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
|
||||||
|
public static readonly List<string> destOverrideProtocols = ["http", "tls", "quic", "fakedns", "fakedns+others"];
|
||||||
public static readonly List<string> TunMtus = new() { "1280", "1408", "1500", "9000" };
|
public static readonly List<string> TunMtus = new() { "1280", "1408", "1500", "9000" };
|
||||||
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
|
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
|
||||||
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
||||||
|
|
|
@ -162,6 +162,7 @@ namespace v2rayN.Handler
|
||||||
inbound.protocol = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
|
inbound.protocol = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
|
||||||
inbound.settings.udp = inItem.udpEnabled;
|
inbound.settings.udp = inItem.udpEnabled;
|
||||||
inbound.sniffing.enabled = inItem.sniffingEnabled;
|
inbound.sniffing.enabled = inItem.sniffingEnabled;
|
||||||
|
inbound.sniffing.destOverride = inItem.destOverride;
|
||||||
inbound.sniffing.routeOnly = inItem.routeOnly;
|
inbound.sniffing.routeOnly = inItem.routeOnly;
|
||||||
|
|
||||||
return inbound;
|
return inbound;
|
||||||
|
|
|
@ -47,8 +47,8 @@ namespace v2rayN.Models
|
||||||
public bool udpEnabled { get; set; }
|
public bool udpEnabled { get; set; }
|
||||||
|
|
||||||
public bool sniffingEnabled { get; set; } = true;
|
public bool sniffingEnabled { get; set; } = true;
|
||||||
|
public List<string>? destOverride { get; set; } = ["http", "tls"];
|
||||||
public bool routeOnly { get; set; }
|
public bool routeOnly { get; set; }
|
||||||
|
|
||||||
public bool allowLANConn { get; set; }
|
public bool allowLANConn { get; set; }
|
||||||
|
|
||||||
public bool newPort4LAN { get; set; }
|
public bool newPort4LAN { get; set; }
|
||||||
|
|
|
@ -195,7 +195,7 @@ namespace v2rayN.Models
|
||||||
public class Sniffing4Ray
|
public class Sniffing4Ray
|
||||||
{
|
{
|
||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
public List<string> destOverride { get; set; }
|
public List<string>? destOverride { get; set; }
|
||||||
public bool routeOnly { get; set; }
|
public bool routeOnly { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace v2rayN.ViewModels
|
||||||
[Reactive] public int localPort { get; set; }
|
[Reactive] public int localPort { get; set; }
|
||||||
[Reactive] public bool udpEnabled { get; set; }
|
[Reactive] public bool udpEnabled { get; set; }
|
||||||
[Reactive] public bool sniffingEnabled { get; set; }
|
[Reactive] public bool sniffingEnabled { get; set; }
|
||||||
|
public IList<string> destOverride { get; set; }
|
||||||
[Reactive] public bool routeOnly { get; set; }
|
[Reactive] public bool routeOnly { get; set; }
|
||||||
[Reactive] public bool allowLANConn { get; set; }
|
[Reactive] public bool allowLANConn { get; set; }
|
||||||
[Reactive] public bool newPort4LAN { get; set; }
|
[Reactive] public bool newPort4LAN { get; set; }
|
||||||
|
@ -279,6 +280,7 @@ namespace v2rayN.ViewModels
|
||||||
_config.inbound[0].localPort = localPort;
|
_config.inbound[0].localPort = localPort;
|
||||||
_config.inbound[0].udpEnabled = udpEnabled;
|
_config.inbound[0].udpEnabled = udpEnabled;
|
||||||
_config.inbound[0].sniffingEnabled = sniffingEnabled;
|
_config.inbound[0].sniffingEnabled = sniffingEnabled;
|
||||||
|
_config.inbound[0].destOverride = destOverride?.ToList();
|
||||||
_config.inbound[0].routeOnly = routeOnly;
|
_config.inbound[0].routeOnly = routeOnly;
|
||||||
_config.inbound[0].allowLANConn = allowLANConn;
|
_config.inbound[0].allowLANConn = allowLANConn;
|
||||||
_config.inbound[0].newPort4LAN = newPort4LAN;
|
_config.inbound[0].newPort4LAN = newPort4LAN;
|
||||||
|
|
|
@ -119,12 +119,22 @@
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsSniffingEnabled}" />
|
Text="{x:Static resx:ResUI.TbSettingsSniffingEnabled}" />
|
||||||
<ToggleButton
|
<StackPanel
|
||||||
x:Name="togsniffingEnabled"
|
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<ToggleButton
|
||||||
|
x:Name="togsniffingEnabled"
|
||||||
Margin="{StaticResource SettingItemMargin}"
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
|
<ListBox
|
||||||
|
x:Name="clbdestOverride"
|
||||||
|
Margin="4"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
FontSize="{DynamicResource StdFontSize}"
|
||||||
|
Style="{StaticResource MaterialDesignFilterChipPrimaryListBox}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
|
|
|
@ -34,6 +34,15 @@ namespace v2rayN.Views
|
||||||
|
|
||||||
ViewModel = new OptionSettingViewModel(this);
|
ViewModel = new OptionSettingViewModel(this);
|
||||||
|
|
||||||
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
|
Global.destOverrideProtocols.ForEach(it =>
|
||||||
|
{
|
||||||
|
clbdestOverride.Items.Add(it);
|
||||||
|
});
|
||||||
|
_config.inbound[0].destOverride?.ForEach(it =>
|
||||||
|
{
|
||||||
|
clbdestOverride.SelectedItems.Add(it);
|
||||||
|
});
|
||||||
Global.IEProxyProtocols.ForEach(it =>
|
Global.IEProxyProtocols.ForEach(it =>
|
||||||
{
|
{
|
||||||
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
||||||
|
@ -213,5 +222,10 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
return lstFonts;
|
return lstFonts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClbdestOverride_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ViewModel.destOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue