Adjust the experimental and mux of sing-box

pull/5045/head
2dust 7 months ago
parent 855fd4f0b7
commit 9d7c7e3225

@ -51,7 +51,6 @@ namespace v2rayN.Handler
logEnabled = false, logEnabled = false,
loglevel = "warning", loglevel = "warning",
muxEnabled = false, muxEnabled = false,
enableCacheFile4Sbox = false,
}; };
} }
@ -180,7 +179,7 @@ namespace v2rayN.Handler
config.mux4SboxItem = new() config.mux4SboxItem = new()
{ {
protocol = Global.SingboxMuxs[0], protocol = Global.SingboxMuxs[0],
max_connections = 4 max_connections = 8
}; };
} }
@ -305,7 +304,6 @@ namespace v2rayN.Handler
logEnabled = configOld.logEnabled, logEnabled = configOld.logEnabled,
loglevel = configOld.loglevel, loglevel = configOld.loglevel,
muxEnabled = configOld.muxEnabled, muxEnabled = configOld.muxEnabled,
enableCacheFile4Sbox = false,
}; };
} }

@ -337,16 +337,16 @@ namespace v2rayN.Handler
{ {
try try
{ {
//if (_config.coreBasicItem.muxEnabled) if (_config.coreBasicItem.muxEnabled && !Utils.IsNullOrEmpty(_config.mux4SboxItem.protocol))
//{ {
// var mux = new Multiplex4Sbox() var mux = new Multiplex4Sbox()
// { {
// enabled = true, enabled = true,
// protocol = _config.mux4SboxItem.protocol, protocol = _config.mux4SboxItem.protocol,
// max_connections = _config.mux4SboxItem.max_connections, max_connections = _config.mux4SboxItem.max_connections,
// }; };
// outbound.multiplex = mux; outbound.multiplex = mux;
//} }
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -822,7 +822,7 @@ namespace v2rayN.Handler
return 0; return 0;
} }
private int GenExperimentalStatistic(SingboxConfig singboxConfig) private int GenExperimental(SingboxConfig singboxConfig)
{ {
if (_config.guiItem.enableStatistics) if (_config.guiItem.enableStatistics)
{ {
@ -831,39 +831,8 @@ namespace v2rayN.Handler
{ {
external_controller = $"{Global.Loopback}:{LazyConfig.Instance.StatePort}", external_controller = $"{Global.Loopback}:{LazyConfig.Instance.StatePort}",
}; };
// singboxConfig.experimental.v2ray_api = new V2ray_Api4Sbox()
// {
// listen = $"{Global.Loopback}:{Global.StatePort}",
// stats = new Stats4Sbox()
// {
// enabled = true,
// }
// };
// singboxConfig.experimental = new Experimental4Sbox()
// {
// cache_file = new CacheFile4Sbox()
// {
// enabled = true
// },
// //v2ray_api = new V2ray_Api4Sbox()
// //{
// // listen = $"{Global.Loopback}:{Global.StatePort}",
// // stats = new Stats4Sbox()
// // {
// // enabled = true,
// // }
// //},
// clash_api = new Clash_Api4Sbox()
// {
// external_controller = $"{Global.Loopback}:{LazyConfig.Instance.StatePort}",
// }
// };
}
return 0;
} }
private int GenExperimentalCacheFile(SingboxConfig singboxConfig)
{
if (_config.coreBasicItem.enableCacheFile4Sbox) if (_config.coreBasicItem.enableCacheFile4Sbox)
{ {
singboxConfig.experimental ??= new Experimental4Sbox(); singboxConfig.experimental ??= new Experimental4Sbox();
@ -876,15 +845,6 @@ namespace v2rayN.Handler
return 0; return 0;
} }
private int GenExperimental(SingboxConfig singboxConfig)
{
var r = GenExperimentalStatistic(singboxConfig);
if (r != 0) return r;
r = GenExperimentalCacheFile(singboxConfig);
if (r != 0) return r;
return 0;
}
private int ConvertGeo2Ruleset(SingboxConfig singboxConfig) private int ConvertGeo2Ruleset(SingboxConfig singboxConfig)
{ {
var geosite = "geosite"; var geosite = "geosite";

@ -34,7 +34,7 @@ namespace v2rayN.Models
public bool enableFragment { get; set; } public bool enableFragment { get; set; }
public bool enableCacheFile4Sbox { get; set; } public bool enableCacheFile4Sbox { get; set; } = true;
} }
[Serializable] [Serializable]

Loading…
Cancel
Save