mirror of https://github.com/2dust/v2rayN
Added global constants such as IPIfNonMatch
parent
dcc9c9fa14
commit
89d6af8fc9
|
@ -57,6 +57,9 @@ public class Global
|
||||||
public const string HttpsProtocol = "https://";
|
public const string HttpsProtocol = "https://";
|
||||||
public const string SocksProtocol = "socks://";
|
public const string SocksProtocol = "socks://";
|
||||||
public const string Socks5Protocol = "socks5://";
|
public const string Socks5Protocol = "socks5://";
|
||||||
|
public const string AsIs = "AsIs";
|
||||||
|
public const string IPIfNonMatch = "IPIfNonMatch";
|
||||||
|
public const string IPOnDemand = "IPOnDemand";
|
||||||
|
|
||||||
public const string UserEMail = "t@t.tt";
|
public const string UserEMail = "t@t.tt";
|
||||||
public const string AutoRunRegPath = @"Software\Microsoft\Windows\CurrentVersion\Run";
|
public const string AutoRunRegPath = @"Software\Microsoft\Windows\CurrentVersion\Run";
|
||||||
|
@ -288,9 +291,9 @@ public class Global
|
||||||
|
|
||||||
public static readonly List<string> DomainStrategies =
|
public static readonly List<string> DomainStrategies =
|
||||||
[
|
[
|
||||||
"AsIs",
|
AsIs,
|
||||||
"IPIfNonMatch",
|
IPIfNonMatch,
|
||||||
"IPOnDemand"
|
IPOnDemand
|
||||||
];
|
];
|
||||||
|
|
||||||
public static readonly List<string> DomainStrategies4Singbox =
|
public static readonly List<string> DomainStrategies4Singbox =
|
||||||
|
|
|
@ -2262,6 +2262,7 @@ public class ConfigHandler
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<int> SaveFullConfigTemplate(Config config, FullConfigTemplateItem item)
|
public static async Task<int> SaveFullConfigTemplate(Config config, FullConfigTemplateItem item)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ public class CoreConfigSingboxService
|
||||||
action = "resolve",
|
action = "resolve",
|
||||||
strategy = domainStrategy
|
strategy = domainStrategy
|
||||||
};
|
};
|
||||||
if (_config.RoutingBasicItem.DomainStrategy == "IPOnDemand")
|
if (_config.RoutingBasicItem.DomainStrategy == Global.IPOnDemand)
|
||||||
{
|
{
|
||||||
singboxConfig.route.rules.Add(resolveRule);
|
singboxConfig.route.rules.Add(resolveRule);
|
||||||
}
|
}
|
||||||
|
@ -1351,7 +1351,7 @@ public class CoreConfigSingboxService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_config.RoutingBasicItem.DomainStrategy == "IPIfNonMatch")
|
if (_config.RoutingBasicItem.DomainStrategy == Global.IPIfNonMatch)
|
||||||
{
|
{
|
||||||
singboxConfig.route.rules.Add(resolveRule);
|
singboxConfig.route.rules.Add(resolveRule);
|
||||||
foreach (var item2 in ipRules)
|
foreach (var item2 in ipRules)
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class CoreConfigV2rayService
|
||||||
rule.balancerTag = balancer.tag;
|
rule.balancerTag = balancer.tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (v2rayConfig.routing.domainStrategy == "IPIfNonMatch")
|
if (v2rayConfig.routing.domainStrategy == Global.IPIfNonMatch)
|
||||||
{
|
{
|
||||||
v2rayConfig.routing.rules.Add(new()
|
v2rayConfig.routing.rules.Add(new()
|
||||||
{
|
{
|
||||||
|
@ -1145,7 +1145,7 @@ public class CoreConfigV2rayService
|
||||||
{
|
{
|
||||||
var result = await GenDnsCompatible(node, v2rayConfig);
|
var result = await GenDnsCompatible(node, v2rayConfig);
|
||||||
|
|
||||||
if (v2rayConfig.routing.domainStrategy == "IPIfNonMatch")
|
if (v2rayConfig.routing.domainStrategy == Global.IPIfNonMatch)
|
||||||
{
|
{
|
||||||
// DNS routing
|
// DNS routing
|
||||||
v2rayConfig.dns.tag = Global.DnsTag;
|
v2rayConfig.dns.tag = Global.DnsTag;
|
||||||
|
@ -1179,7 +1179,7 @@ public class CoreConfigV2rayService
|
||||||
await GenDnsServers(node, v2rayConfig, simpleDNSItem);
|
await GenDnsServers(node, v2rayConfig, simpleDNSItem);
|
||||||
await GenDnsHosts(v2rayConfig, simpleDNSItem);
|
await GenDnsHosts(v2rayConfig, simpleDNSItem);
|
||||||
|
|
||||||
if (v2rayConfig.routing.domainStrategy == "IPIfNonMatch")
|
if (v2rayConfig.routing.domainStrategy == Global.IPIfNonMatch)
|
||||||
{
|
{
|
||||||
// DNS routing
|
// DNS routing
|
||||||
v2rayConfig.dns.tag = Global.DnsTag;
|
v2rayConfig.dns.tag = Global.DnsTag;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using DynamicData.Binding;
|
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using ReactiveUI.Fody.Helpers;
|
using ReactiveUI.Fody.Helpers;
|
||||||
|
|
||||||
namespace ServiceLib.ViewModels;
|
namespace ServiceLib.ViewModels;
|
||||||
|
|
||||||
public class FullConfigTemplateViewModel : MyReactiveObject
|
public class FullConfigTemplateViewModel : MyReactiveObject
|
||||||
{
|
{
|
||||||
#region Reactive
|
#region Reactive
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool EnableFullConfigTemplate4Ray { get; set; }
|
public bool EnableFullConfigTemplate4Ray { get; set; }
|
||||||
|
|
||||||
|
@ -35,6 +36,7 @@ public class FullConfigTemplateViewModel : MyReactiveObject
|
||||||
public string ProxyDetour4Singbox { get; set; }
|
public string ProxyDetour4Singbox { get; set; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
|
|
||||||
#endregion Reactive
|
#endregion Reactive
|
||||||
|
|
||||||
public FullConfigTemplateViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
public FullConfigTemplateViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||||
|
@ -48,6 +50,7 @@ public class FullConfigTemplateViewModel : MyReactiveObject
|
||||||
|
|
||||||
_ = Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
{
|
{
|
||||||
var item = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
|
var item = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
|
||||||
|
|
|
@ -1246,4 +1246,3 @@
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</base:WindowBase>
|
</base:WindowBase>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue