mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-04 11:35:02 +03:00
The first letter of the guiconfig attribute must be capitalized.
This commit is contained in:
@@ -83,12 +83,12 @@
|
||||
//socks-port
|
||||
fileContent["socks-port"] = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
|
||||
//log-level
|
||||
fileContent["log-level"] = GetLogLevel(_config.coreBasicItem.loglevel);
|
||||
fileContent["log-level"] = GetLogLevel(_config.CoreBasicItem.Loglevel);
|
||||
|
||||
//external-controller
|
||||
fileContent["external-controller"] = $"{Global.Loopback}:{AppHandler.Instance.StatePort2}";
|
||||
//allow-lan
|
||||
if (_config.inbound[0].allowLANConn)
|
||||
if (_config.Inbound[0].AllowLANConn)
|
||||
{
|
||||
fileContent["allow-lan"] = "true";
|
||||
fileContent["bind-address"] = "*";
|
||||
@@ -99,7 +99,7 @@
|
||||
}
|
||||
|
||||
//ipv6
|
||||
fileContent["ipv6"] = _config.clashUIItem.enableIPv6;
|
||||
fileContent["ipv6"] = _config.ClashUIItem.EnableIPv6;
|
||||
|
||||
//mode
|
||||
if (!fileContent.ContainsKey("mode"))
|
||||
@@ -108,14 +108,14 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_config.clashUIItem.ruleMode != ERuleMode.Unchanged)
|
||||
if (_config.ClashUIItem.RuleMode != ERuleMode.Unchanged)
|
||||
{
|
||||
fileContent["mode"] = _config.clashUIItem.ruleMode.ToString().ToLower();
|
||||
fileContent["mode"] = _config.ClashUIItem.RuleMode.ToString().ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
//enable tun mode
|
||||
if (_config.tunModeItem.enableTun)
|
||||
if (_config.TunModeItem.EnableTun)
|
||||
{
|
||||
string tun = Utils.GetEmbedText(Global.ClashTunYaml);
|
||||
if (Utils.IsNotEmpty(tun))
|
||||
@@ -181,7 +181,7 @@
|
||||
}
|
||||
foreach (var item in mixinContent)
|
||||
{
|
||||
if (!_config.tunModeItem.enableTun && item.Key == "tun")
|
||||
if (!_config.TunModeItem.EnableTun && item.Key == "tun")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -444,12 +444,12 @@ namespace ServiceLib.Services.CoreConfig
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (_config.coreBasicItem.loglevel)
|
||||
switch (_config.CoreBasicItem.Loglevel)
|
||||
{
|
||||
case "debug":
|
||||
case "info":
|
||||
case "error":
|
||||
singboxConfig.log.level = _config.coreBasicItem.loglevel;
|
||||
singboxConfig.log.level = _config.CoreBasicItem.Loglevel;
|
||||
break;
|
||||
|
||||
case "warning":
|
||||
@@ -459,11 +459,11 @@ namespace ServiceLib.Services.CoreConfig
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (_config.coreBasicItem.loglevel == Global.None)
|
||||
if (_config.CoreBasicItem.Loglevel == Global.None)
|
||||
{
|
||||
singboxConfig.log.disabled = true;
|
||||
}
|
||||
if (_config.coreBasicItem.logEnabled)
|
||||
if (_config.CoreBasicItem.LogEnabled)
|
||||
{
|
||||
var dtNow = DateTime.Now;
|
||||
singboxConfig.log.output = Utils.GetLogPath($"sbox_{dtNow:yyyy-MM-dd}.txt");
|
||||
@@ -483,8 +483,8 @@ namespace ServiceLib.Services.CoreConfig
|
||||
var listen = "::";
|
||||
singboxConfig.inbounds = [];
|
||||
|
||||
if (!_config.tunModeItem.enableTun
|
||||
|| _config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound && _config.runningCoreType == ECoreType.sing_box)
|
||||
if (!_config.TunModeItem.EnableTun
|
||||
|| _config.TunModeItem.EnableTun && _config.TunModeItem.EnableExInbound && _config.RunningCoreType == ECoreType.sing_box)
|
||||
{
|
||||
var inbound = new Inbound4Sbox()
|
||||
{
|
||||
@@ -495,11 +495,11 @@ namespace ServiceLib.Services.CoreConfig
|
||||
singboxConfig.inbounds.Add(inbound);
|
||||
|
||||
inbound.listen_port = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
|
||||
inbound.sniff = _config.inbound[0].sniffingEnabled;
|
||||
inbound.sniff_override_destination = _config.inbound[0].routeOnly ? false : _config.inbound[0].sniffingEnabled;
|
||||
inbound.domain_strategy = Utils.IsNullOrEmpty(_config.routingBasicItem.domainStrategy4Singbox) ? null : _config.routingBasicItem.domainStrategy4Singbox;
|
||||
inbound.sniff = _config.Inbound[0].SniffingEnabled;
|
||||
inbound.sniff_override_destination = _config.Inbound[0].RouteOnly ? false : _config.Inbound[0].SniffingEnabled;
|
||||
inbound.domain_strategy = Utils.IsNullOrEmpty(_config.RoutingBasicItem.DomainStrategy4Singbox) ? null : _config.RoutingBasicItem.DomainStrategy4Singbox;
|
||||
|
||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||
if (_config.RoutingBasicItem.EnableRoutingAdvanced)
|
||||
{
|
||||
var routing = await ConfigHandler.GetDefaultRouting(_config);
|
||||
if (Utils.IsNotEmpty(routing.domainStrategy4Singbox))
|
||||
@@ -512,9 +512,9 @@ namespace ServiceLib.Services.CoreConfig
|
||||
var inbound2 = GetInbound(inbound, EInboundProtocol.http, false);
|
||||
singboxConfig.inbounds.Add(inbound2);
|
||||
|
||||
if (_config.inbound[0].allowLANConn)
|
||||
if (_config.Inbound[0].AllowLANConn)
|
||||
{
|
||||
if (_config.inbound[0].newPort4LAN)
|
||||
if (_config.Inbound[0].NewPort4LAN)
|
||||
{
|
||||
var inbound3 = GetInbound(inbound, EInboundProtocol.socks2, true);
|
||||
inbound3.listen = listen;
|
||||
@@ -525,10 +525,10 @@ namespace ServiceLib.Services.CoreConfig
|
||||
singboxConfig.inbounds.Add(inbound4);
|
||||
|
||||
//auth
|
||||
if (Utils.IsNotEmpty(_config.inbound[0].user) && Utils.IsNotEmpty(_config.inbound[0].pass))
|
||||
if (Utils.IsNotEmpty(_config.Inbound[0].User) && Utils.IsNotEmpty(_config.Inbound[0].Pass))
|
||||
{
|
||||
inbound3.users = new() { new() { username = _config.inbound[0].user, password = _config.inbound[0].pass } };
|
||||
inbound4.users = new() { new() { username = _config.inbound[0].user, password = _config.inbound[0].pass } };
|
||||
inbound3.users = new() { new() { username = _config.Inbound[0].User, password = _config.Inbound[0].Pass } };
|
||||
inbound4.users = new() { new() { username = _config.Inbound[0].User, password = _config.Inbound[0].Pass } };
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -539,24 +539,24 @@ namespace ServiceLib.Services.CoreConfig
|
||||
}
|
||||
}
|
||||
|
||||
if (_config.tunModeItem.enableTun)
|
||||
if (_config.TunModeItem.EnableTun)
|
||||
{
|
||||
if (_config.tunModeItem.mtu <= 0)
|
||||
if (_config.TunModeItem.Mtu <= 0)
|
||||
{
|
||||
_config.tunModeItem.mtu = Utils.ToInt(Global.TunMtus[0]);
|
||||
_config.TunModeItem.Mtu = Utils.ToInt(Global.TunMtus[0]);
|
||||
}
|
||||
if (Utils.IsNullOrEmpty(_config.tunModeItem.stack))
|
||||
if (Utils.IsNullOrEmpty(_config.TunModeItem.Stack))
|
||||
{
|
||||
_config.tunModeItem.stack = Global.TunStacks[0];
|
||||
_config.TunModeItem.Stack = Global.TunStacks[0];
|
||||
}
|
||||
|
||||
var tunInbound = JsonUtils.Deserialize<Inbound4Sbox>(Utils.GetEmbedText(Global.TunSingboxInboundFileName)) ?? new Inbound4Sbox { };
|
||||
tunInbound.mtu = _config.tunModeItem.mtu;
|
||||
tunInbound.strict_route = _config.tunModeItem.strictRoute;
|
||||
tunInbound.stack = _config.tunModeItem.stack;
|
||||
tunInbound.sniff = _config.inbound[0].sniffingEnabled;
|
||||
tunInbound.mtu = _config.TunModeItem.Mtu;
|
||||
tunInbound.strict_route = _config.TunModeItem.StrictRoute;
|
||||
tunInbound.stack = _config.TunModeItem.Stack;
|
||||
tunInbound.sniff = _config.Inbound[0].SniffingEnabled;
|
||||
//tunInbound.sniff_override_destination = _config.inbound[0].routeOnly ? false : _config.inbound[0].sniffingEnabled;
|
||||
if (_config.tunModeItem.enableIPv6Address == false)
|
||||
if (_config.TunModeItem.EnableIPv6Address == false)
|
||||
{
|
||||
tunInbound.inet6_address = null;
|
||||
}
|
||||
@@ -671,8 +671,8 @@ namespace ServiceLib.Services.CoreConfig
|
||||
};
|
||||
}
|
||||
|
||||
outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null;
|
||||
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;
|
||||
outbound.up_mbps = _config.HysteriaItem.UpMbps > 0 ? _config.HysteriaItem.UpMbps : null;
|
||||
outbound.down_mbps = _config.HysteriaItem.DownMbps > 0 ? _config.HysteriaItem.DownMbps : null;
|
||||
break;
|
||||
}
|
||||
case EConfigType.TUIC:
|
||||
@@ -708,14 +708,14 @@ namespace ServiceLib.Services.CoreConfig
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_config.coreBasicItem.muxEnabled && Utils.IsNotEmpty(_config.mux4SboxItem.protocol))
|
||||
if (_config.CoreBasicItem.MuxEnabled && Utils.IsNotEmpty(_config.Mux4SboxItem.Protocol))
|
||||
{
|
||||
var mux = new Multiplex4Sbox()
|
||||
{
|
||||
enabled = true,
|
||||
protocol = _config.mux4SboxItem.protocol,
|
||||
max_connections = _config.mux4SboxItem.max_connections,
|
||||
padding = _config.mux4SboxItem.padding,
|
||||
protocol = _config.Mux4SboxItem.Protocol,
|
||||
max_connections = _config.Mux4SboxItem.MaxConnections,
|
||||
padding = _config.Mux4SboxItem.Padding,
|
||||
};
|
||||
outbound.multiplex = mux;
|
||||
}
|
||||
@@ -746,7 +746,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
{
|
||||
enabled = true,
|
||||
server_name = server_name,
|
||||
insecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure),
|
||||
insecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : node.allowInsecure),
|
||||
alpn = node.GetAlpn(),
|
||||
};
|
||||
if (Utils.IsNotEmpty(node.fingerprint))
|
||||
@@ -754,7 +754,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
tls.utls = new Utls4Sbox()
|
||||
{
|
||||
enabled = true,
|
||||
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.coreBasicItem.defFingerprint : node.fingerprint
|
||||
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.CoreBasicItem.DefFingerprint : node.fingerprint
|
||||
};
|
||||
}
|
||||
if (node.streamSecurity == Global.StreamSecurityReality)
|
||||
@@ -834,9 +834,9 @@ namespace ServiceLib.Services.CoreConfig
|
||||
case nameof(ETransport.grpc):
|
||||
transport.type = nameof(ETransport.grpc);
|
||||
transport.service_name = node.path;
|
||||
transport.idle_timeout = _config.grpcItem.idle_timeout.ToString("##s");
|
||||
transport.ping_timeout = _config.grpcItem.health_check_timeout.ToString("##s");
|
||||
transport.permit_without_stream = _config.grpcItem.permit_without_stream;
|
||||
transport.idle_timeout = _config.GrpcItem.IdleTimeout.ToString("##s");
|
||||
transport.ping_timeout = _config.GrpcItem.HealthCheckTimeout.ToString("##s");
|
||||
transport.permit_without_stream = _config.GrpcItem.PermitWithoutStream;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -912,7 +912,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
try
|
||||
{
|
||||
var dnsOutbound = "dns_out";
|
||||
if (!_config.inbound[0].sniffingEnabled)
|
||||
if (!_config.Inbound[0].SniffingEnabled)
|
||||
{
|
||||
singboxConfig.route.rules.Add(new()
|
||||
{
|
||||
@@ -933,7 +933,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
clash_mode = ERuleMode.Global.ToString()
|
||||
});
|
||||
|
||||
if (_config.tunModeItem.enableTun)
|
||||
if (_config.TunModeItem.EnableTun)
|
||||
{
|
||||
singboxConfig.route.auto_detect_interface = true;
|
||||
|
||||
@@ -958,7 +958,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
});
|
||||
}
|
||||
|
||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||
if (_config.RoutingBasicItem.EnableRoutingAdvanced)
|
||||
{
|
||||
var routing = await ConfigHandler.GetDefaultRouting(_config);
|
||||
if (routing != null)
|
||||
@@ -1089,7 +1089,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
}
|
||||
}
|
||||
|
||||
if (_config.tunModeItem.enableTun && item.process?.Count > 0)
|
||||
if (_config.TunModeItem.EnableTun && item.process?.Count > 0)
|
||||
{
|
||||
rule3.process_name = item.process;
|
||||
rules.Add(rule3);
|
||||
@@ -1183,7 +1183,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
{
|
||||
var item = await AppHandler.Instance.GetDNSItem(ECoreType.sing_box);
|
||||
var strDNS = string.Empty;
|
||||
if (_config.tunModeItem.enableTun)
|
||||
if (_config.TunModeItem.EnableTun)
|
||||
{
|
||||
strDNS = Utils.IsNullOrEmpty(item?.tunDNS) ? Utils.GetEmbedText(Global.TunSingboxDNSFileName) : item?.tunDNS;
|
||||
}
|
||||
@@ -1248,7 +1248,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
}
|
||||
|
||||
//Tun2SocksAddress
|
||||
if (_config.tunModeItem.enableTun && node?.configType == EConfigType.SOCKS && Utils.IsDomain(node?.sni))
|
||||
if (_config.TunModeItem.EnableTun && node?.configType == EConfigType.SOCKS && Utils.IsDomain(node?.sni))
|
||||
{
|
||||
dns4Sbox.rules.Insert(0, new()
|
||||
{
|
||||
@@ -1272,7 +1272,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
};
|
||||
}
|
||||
|
||||
if (_config.coreBasicItem.enableCacheFile4Sbox)
|
||||
if (_config.CoreBasicItem.EnableCacheFile4Sbox)
|
||||
{
|
||||
singboxConfig.experimental ??= new Experimental4Sbox();
|
||||
singboxConfig.experimental.cache_file = new CacheFile4Sbox()
|
||||
@@ -1334,7 +1334,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
|
||||
//load custom ruleset file
|
||||
List<Ruleset4Sbox> customRulesets = [];
|
||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||
if (_config.RoutingBasicItem.EnableRoutingAdvanced)
|
||||
{
|
||||
var routing = await ConfigHandler.GetDefaultRouting(_config);
|
||||
if (Utils.IsNotEmpty(routing.customRulesetPath4Singbox))
|
||||
@@ -1375,9 +1375,9 @@ namespace ServiceLib.Services.CoreConfig
|
||||
}
|
||||
else
|
||||
{
|
||||
var srsUrl = string.IsNullOrEmpty(_config.constItem.srsSourceUrl)
|
||||
var srsUrl = string.IsNullOrEmpty(_config.ConstItem.SrsSourceUrl)
|
||||
? Global.SingboxRulesetUrl
|
||||
: _config.constItem.srsSourceUrl;
|
||||
: _config.ConstItem.SrsSourceUrl;
|
||||
|
||||
customRuleset = new()
|
||||
{
|
||||
|
||||
@@ -356,16 +356,16 @@ namespace ServiceLib.Services.CoreConfig
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_config.coreBasicItem.logEnabled)
|
||||
if (_config.CoreBasicItem.LogEnabled)
|
||||
{
|
||||
var dtNow = DateTime.Now;
|
||||
v2rayConfig.log.loglevel = _config.coreBasicItem.loglevel;
|
||||
v2rayConfig.log.loglevel = _config.CoreBasicItem.Loglevel;
|
||||
v2rayConfig.log.access = Utils.GetLogPath($"Vaccess_{dtNow:yyyy-MM-dd}.txt");
|
||||
v2rayConfig.log.error = Utils.GetLogPath($"Verror_{dtNow:yyyy-MM-dd}.txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
v2rayConfig.log.loglevel = _config.coreBasicItem.loglevel;
|
||||
v2rayConfig.log.loglevel = _config.CoreBasicItem.Loglevel;
|
||||
v2rayConfig.log.access = "";
|
||||
v2rayConfig.log.error = "";
|
||||
}
|
||||
@@ -384,33 +384,33 @@ namespace ServiceLib.Services.CoreConfig
|
||||
var listen = "0.0.0.0";
|
||||
v2rayConfig.inbounds = [];
|
||||
|
||||
Inbounds4Ray? inbound = GetInbound(_config.inbound[0], EInboundProtocol.socks, true);
|
||||
Inbounds4Ray? inbound = GetInbound(_config.Inbound[0], EInboundProtocol.socks, true);
|
||||
v2rayConfig.inbounds.Add(inbound);
|
||||
|
||||
//http
|
||||
Inbounds4Ray? inbound2 = GetInbound(_config.inbound[0], EInboundProtocol.http, false);
|
||||
Inbounds4Ray? inbound2 = GetInbound(_config.Inbound[0], EInboundProtocol.http, false);
|
||||
v2rayConfig.inbounds.Add(inbound2);
|
||||
|
||||
if (_config.inbound[0].allowLANConn)
|
||||
if (_config.Inbound[0].AllowLANConn)
|
||||
{
|
||||
if (_config.inbound[0].newPort4LAN)
|
||||
if (_config.Inbound[0].NewPort4LAN)
|
||||
{
|
||||
var inbound3 = GetInbound(_config.inbound[0], EInboundProtocol.socks2, true);
|
||||
var inbound3 = GetInbound(_config.Inbound[0], EInboundProtocol.socks2, true);
|
||||
inbound3.listen = listen;
|
||||
v2rayConfig.inbounds.Add(inbound3);
|
||||
|
||||
var inbound4 = GetInbound(_config.inbound[0], EInboundProtocol.http2, false);
|
||||
var inbound4 = GetInbound(_config.Inbound[0], EInboundProtocol.http2, false);
|
||||
inbound4.listen = listen;
|
||||
v2rayConfig.inbounds.Add(inbound4);
|
||||
|
||||
//auth
|
||||
if (Utils.IsNotEmpty(_config.inbound[0].user) && Utils.IsNotEmpty(_config.inbound[0].pass))
|
||||
if (Utils.IsNotEmpty(_config.Inbound[0].User) && Utils.IsNotEmpty(_config.Inbound[0].Pass))
|
||||
{
|
||||
inbound3.settings.auth = "password";
|
||||
inbound3.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.inbound[0].user, pass = _config.inbound[0].pass } };
|
||||
inbound3.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.Inbound[0].User, pass = _config.Inbound[0].Pass } };
|
||||
|
||||
inbound4.settings.auth = "password";
|
||||
inbound4.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.inbound[0].user, pass = _config.inbound[0].pass } };
|
||||
inbound4.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.Inbound[0].User, pass = _config.Inbound[0].Pass } };
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -441,12 +441,12 @@ namespace ServiceLib.Services.CoreConfig
|
||||
return new();
|
||||
}
|
||||
inbound.tag = protocol.ToString();
|
||||
inbound.port = inItem.localPort + (int)protocol;
|
||||
inbound.port = inItem.LocalPort + (int)protocol;
|
||||
inbound.protocol = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
|
||||
inbound.settings.udp = inItem.udpEnabled;
|
||||
inbound.sniffing.enabled = inItem.sniffingEnabled;
|
||||
inbound.sniffing.destOverride = inItem.destOverride;
|
||||
inbound.sniffing.routeOnly = inItem.routeOnly;
|
||||
inbound.settings.udp = inItem.UdpEnabled;
|
||||
inbound.sniffing.enabled = inItem.SniffingEnabled;
|
||||
inbound.sniffing.destOverride = inItem.DestOverride;
|
||||
inbound.sniffing.routeOnly = inItem.RouteOnly;
|
||||
|
||||
return inbound;
|
||||
}
|
||||
@@ -457,10 +457,10 @@ namespace ServiceLib.Services.CoreConfig
|
||||
{
|
||||
if (v2rayConfig.routing?.rules != null)
|
||||
{
|
||||
v2rayConfig.routing.domainStrategy = _config.routingBasicItem.domainStrategy;
|
||||
v2rayConfig.routing.domainMatcher = Utils.IsNullOrEmpty(_config.routingBasicItem.domainMatcher) ? null : _config.routingBasicItem.domainMatcher;
|
||||
v2rayConfig.routing.domainStrategy = _config.RoutingBasicItem.DomainStrategy;
|
||||
v2rayConfig.routing.domainMatcher = Utils.IsNullOrEmpty(_config.RoutingBasicItem.DomainMatcher) ? null : _config.RoutingBasicItem.DomainMatcher;
|
||||
|
||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||
if (_config.RoutingBasicItem.EnableRoutingAdvanced)
|
||||
{
|
||||
var routing = await ConfigHandler.GetDefaultRouting(_config);
|
||||
if (routing != null)
|
||||
@@ -624,7 +624,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
usersItem.security = Global.DefaultSecurity;
|
||||
}
|
||||
|
||||
await GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled);
|
||||
|
||||
outbound.settings.servers = null;
|
||||
break;
|
||||
@@ -719,7 +719,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
usersItem.email = Global.UserEMail;
|
||||
usersItem.encryption = node.security;
|
||||
|
||||
await GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled);
|
||||
|
||||
if (node.streamSecurity == Global.StreamSecurityReality
|
||||
|| node.streamSecurity == Global.StreamSecurity)
|
||||
@@ -733,7 +733,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
}
|
||||
if (node.streamSecurity == Global.StreamSecurityReality && Utils.IsNullOrEmpty(node.flow))
|
||||
{
|
||||
await GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled);
|
||||
}
|
||||
|
||||
outbound.settings.servers = null;
|
||||
@@ -782,9 +782,9 @@ namespace ServiceLib.Services.CoreConfig
|
||||
if (enabled)
|
||||
{
|
||||
outbound.mux.enabled = true;
|
||||
outbound.mux.concurrency = _config.mux4RayItem.concurrency;
|
||||
outbound.mux.xudpConcurrency = _config.mux4RayItem.xudpConcurrency;
|
||||
outbound.mux.xudpProxyUDP443 = _config.mux4RayItem.xudpProxyUDP443;
|
||||
outbound.mux.concurrency = _config.Mux4RayItem.Concurrency;
|
||||
outbound.mux.xudpConcurrency = _config.Mux4RayItem.XudpConcurrency;
|
||||
outbound.mux.xudpProxyUDP443 = _config.Mux4RayItem.XudpProxyUDP443;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -807,15 +807,15 @@ namespace ServiceLib.Services.CoreConfig
|
||||
string host = node.requestHost.TrimEx();
|
||||
string sni = node.sni;
|
||||
string useragent = "";
|
||||
if (!_config.coreBasicItem.defUserAgent.IsNullOrEmpty())
|
||||
if (!_config.CoreBasicItem.DefUserAgent.IsNullOrEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
useragent = Global.UserAgentTexts[_config.coreBasicItem.defUserAgent];
|
||||
useragent = Global.UserAgentTexts[_config.CoreBasicItem.DefUserAgent];
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
useragent = _config.coreBasicItem.defUserAgent;
|
||||
useragent = _config.CoreBasicItem.DefUserAgent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -826,9 +826,9 @@ namespace ServiceLib.Services.CoreConfig
|
||||
|
||||
TlsSettings4Ray tlsSettings = new()
|
||||
{
|
||||
allowInsecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure),
|
||||
allowInsecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : node.allowInsecure),
|
||||
alpn = node.GetAlpn(),
|
||||
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.coreBasicItem.defFingerprint : node.fingerprint
|
||||
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.CoreBasicItem.DefFingerprint : node.fingerprint
|
||||
};
|
||||
if (Utils.IsNotEmpty(sni))
|
||||
{
|
||||
@@ -848,7 +848,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
|
||||
TlsSettings4Ray realitySettings = new()
|
||||
{
|
||||
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.coreBasicItem.defFingerprint : node.fingerprint,
|
||||
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.CoreBasicItem.DefFingerprint : node.fingerprint,
|
||||
serverName = sni,
|
||||
publicKey = node.publicKey,
|
||||
shortId = node.shortId,
|
||||
@@ -865,16 +865,16 @@ namespace ServiceLib.Services.CoreConfig
|
||||
case nameof(ETransport.kcp):
|
||||
KcpSettings4Ray kcpSettings = new()
|
||||
{
|
||||
mtu = _config.kcpItem.mtu,
|
||||
tti = _config.kcpItem.tti
|
||||
mtu = _config.KcpItem.Mtu,
|
||||
tti = _config.KcpItem.Tti
|
||||
};
|
||||
|
||||
kcpSettings.uplinkCapacity = _config.kcpItem.uplinkCapacity;
|
||||
kcpSettings.downlinkCapacity = _config.kcpItem.downlinkCapacity;
|
||||
kcpSettings.uplinkCapacity = _config.KcpItem.UplinkCapacity;
|
||||
kcpSettings.downlinkCapacity = _config.KcpItem.DownlinkCapacity;
|
||||
|
||||
kcpSettings.congestion = _config.kcpItem.congestion;
|
||||
kcpSettings.readBufferSize = _config.kcpItem.readBufferSize;
|
||||
kcpSettings.writeBufferSize = _config.kcpItem.writeBufferSize;
|
||||
kcpSettings.congestion = _config.KcpItem.Congestion;
|
||||
kcpSettings.readBufferSize = _config.KcpItem.ReadBufferSize;
|
||||
kcpSettings.writeBufferSize = _config.KcpItem.WriteBufferSize;
|
||||
kcpSettings.header = new Header4Ray
|
||||
{
|
||||
type = node.headerType
|
||||
@@ -983,10 +983,10 @@ namespace ServiceLib.Services.CoreConfig
|
||||
authority = Utils.IsNullOrEmpty(host) ? null : host,
|
||||
serviceName = node.path,
|
||||
multiMode = node.headerType == Global.GrpcMultiMode,
|
||||
idle_timeout = _config.grpcItem.idle_timeout,
|
||||
health_check_timeout = _config.grpcItem.health_check_timeout,
|
||||
permit_without_stream = _config.grpcItem.permit_without_stream,
|
||||
initial_windows_size = _config.grpcItem.initial_windows_size,
|
||||
idle_timeout = _config.GrpcItem.IdleTimeout,
|
||||
health_check_timeout = _config.GrpcItem.HealthCheckTimeout,
|
||||
permit_without_stream = _config.GrpcItem.PermitWithoutStream,
|
||||
initial_windows_size = _config.GrpcItem.InitialWindowsSize,
|
||||
};
|
||||
streamSettings.grpcSettings = grpcSettings;
|
||||
break;
|
||||
@@ -1117,7 +1117,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
|
||||
public async Task<int> GenStatistic(V2rayConfig v2rayConfig)
|
||||
{
|
||||
if (_config.guiItem.enableStatistics)
|
||||
if (_config.GuiItem.EnableStatistics)
|
||||
{
|
||||
string tag = EInboundProtocol.api.ToString();
|
||||
API4Ray apiObj = new();
|
||||
@@ -1168,7 +1168,7 @@ namespace ServiceLib.Services.CoreConfig
|
||||
private async Task<int> GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig)
|
||||
{
|
||||
//fragment proxy
|
||||
if (_config.coreBasicItem.enableFragment
|
||||
if (_config.CoreBasicItem.EnableFragment
|
||||
&& Utils.IsNotEmpty(v2rayConfig.outbounds[0].streamSettings?.security))
|
||||
{
|
||||
var fragmentOutbound = new Outbounds4Ray
|
||||
|
||||
Reference in New Issue
Block a user