mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-18 08:13:02 +00:00
Add process to routing domains
https://github.com/2dust/v2rayN/issues/8757
This commit is contained in:
parent
fdb733fa72
commit
bceebc1661
6 changed files with 19 additions and 11 deletions
|
|
@ -1086,7 +1086,19 @@ public class Utils
|
|||
|
||||
public static string GetExeName(string name)
|
||||
{
|
||||
return IsWindows() ? $"{name}.exe" : name;
|
||||
if (name.IsNullOrEmpty() || IsNonWindows())
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
if (name.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"{name}.exe";
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsAdministrator()
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
}
|
||||
|
||||
if (_config.TunModeItem.EnableTun && item.Process?.Count > 0)
|
||||
if (item.Process?.Count > 0)
|
||||
{
|
||||
var ruleProcName = JsonUtils.DeepCopy(rule3);
|
||||
ruleProcName.process_name ??= [];
|
||||
|
|
@ -304,11 +304,7 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
|
||||
// sing-box strictly matches the exe suffix on Windows
|
||||
var procName = process;
|
||||
if (Utils.IsWindows() && !procName.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
procName += ".exe";
|
||||
}
|
||||
var procName = Utils.GetExeName(process);
|
||||
|
||||
ruleProcName.process_name.Add(procName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public partial class CoreConfigV2rayService
|
|||
v2rayConfig.routing.rules.Add(it);
|
||||
hasDomainIp = true;
|
||||
}
|
||||
if (_config.TunModeItem.EnableTun && rule.process?.Count > 0)
|
||||
if (rule.process?.Count > 0)
|
||||
{
|
||||
var it = JsonUtils.DeepCopy(rule);
|
||||
it.domain = null;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public class RoutingRuleSettingViewModel : MyReactiveObject
|
|||
Network = item.Network,
|
||||
Protocols = Utils.List2String(item.Protocol),
|
||||
InboundTags = Utils.List2String(item.InboundTag),
|
||||
Domains = Utils.List2String((item.Domain ?? []).Concat(item.Ip ?? []).ToList()),
|
||||
Domains = Utils.List2String((item.Domain ?? []).Concat(item.Ip ?? []).ToList().Concat(item.Process ?? []).ToList()),
|
||||
Enabled = item.Enabled,
|
||||
Remarks = item.Remarks,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@
|
|||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding Domains}"
|
||||
Header="domain / ip" />
|
||||
Header="domain / ip / process" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@
|
|||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding Domains}"
|
||||
Header="domain / ip" />
|
||||
Header="domain / ip / process" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
|
|
|
|||
Loading…
Reference in a new issue