@ -57,22 +57,22 @@ namespace v2rayN.Handler
CoreStart ( node ) ;
//In tun mode, do a delay check and restart the core
if ( _config . tunModeItem . enableTun )
{
Observable . Range ( 1 , 1 )
. Delay ( TimeSpan . FromSeconds ( 15 ) )
. Subscribe ( x = >
{
{
if ( _process = = null | | _process . HasExited )
{
CoreStart ( node ) ;
ShowMsg ( false , "Tun mode restart the core once" ) ;
Logging . SaveLog ( "Tun mode restart the core once" ) ;
}
}
} ) ;
}
//if (_config.tunModeItem.enableTun )
// {
// Observable.Range(1, 1)
// .Delay(TimeSpan.FromSeconds(15))
// .Subscribe(x =>
// {
// {
// if (_process == null || _process.HasExited)
// {
// CoreStart(node);
// ShowMsg(false, "Tun mode restart the core once");
// Logging.SaveLog("Tun mode restart the core once");
// }
// }
// });
// }
}
}
@ -186,15 +186,16 @@ namespace v2rayN.Handler
ShowMsg ( false , $"{Environment.OSVersion} - {(Environment.Is64BitOperatingSystem ? 64 : 32)}" ) ;
ShowMsg ( false , string . Format ( ResUI . StartService , DateTime . Now . ToString ( "yyyy/MM/dd HH:mm:ss" ) ) ) ;
ECoreType coreType ;
if ( node . configType ! = EConfigType . Custom & & _config . tunModeItem . enableTun )
{
coreType = ECoreType . sing_box ;
}
else
{
coreType = LazyConfig . Instance . GetCoreType ( node , node . configType ) ;
}
//ECoreType coreType;
//if (node.configType != EConfigType.Custom && _config.tunModeItem.enableTun)
//{
// coreType = ECoreType.sing_box;
//}
//else
//{
// coreType = LazyConfig.Instance.GetCoreType(node, node.configType);
//}
var coreType = LazyConfig . Instance . GetCoreType ( node , node . configType ) ;
_config . runningCoreType = coreType ;
var coreInfo = LazyConfig . Instance . GetCoreInfo ( coreType ) ;
@ -206,13 +207,25 @@ namespace v2rayN.Handler
}
_process = proc ;
//start a socks service
//start a pre service
if ( _process ! = null & & ! _process . HasExited )
{
if ( ( node . configType = = EConfigType . Custom & & node . preSocksPort > 0 ) )
ProfileItem ? itemSocks = null ;
var preCoreType = ECoreType . sing_box ;
if ( node . configType ! = EConfigType . Custom & & coreType ! = ECoreType . sing_box & & _config . tunModeItem . enableTun )
{
var preCoreType = _config . tunModeItem . enableTun ? ECoreType . sing_box : ECoreType . Xray ;
var itemSocks = new ProfileItem ( )
itemSocks = new ProfileItem ( )
{
coreType = preCoreType ,
configType = EConfigType . Socks ,
address = Global . Loopback ,
port = LazyConfig . Instance . GetLocalPort ( EInboundProtocol . socks )
} ;
}
else if ( ( node . configType = = EConfigType . Custom & & node . preSocksPort > 0 ) )
{
preCoreType = _config . tunModeItem . enableTun ? ECoreType . sing_box : ECoreType . Xray ;
itemSocks = new ProfileItem ( )
{
coreType = preCoreType ,
configType = EConfigType . Socks ,
@ -220,6 +233,9 @@ namespace v2rayN.Handler
port = node . preSocksPort
} ;
_config . runningCoreType = preCoreType ;
}
if ( itemSocks ! = null )
{
string fileName2 = Utils . GetConfigPath ( Global . CorePreConfigFileName ) ;
if ( CoreConfigHandler . GenerateClientConfig ( itemSocks , fileName2 , out string msg2 , out string configStr ) = = 0 )
{