mirror of https://github.com/2dust/v2rayN
Enable extra inbound for tun mode
parent
b176ad03aa
commit
2fd21690a5
|
@ -106,30 +106,19 @@ namespace v2rayN.Handler
|
|||
private int inbound(SingboxConfig singboxConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_config.tunModeItem.enableTun)
|
||||
{
|
||||
singboxConfig.inbounds.Clear();
|
||||
|
||||
if (_config.tunModeItem.mtu <= 0)
|
||||
if (!_config.tunModeItem.enableTun || (_config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound))
|
||||
{
|
||||
_config.tunModeItem.mtu = Convert.ToInt32(Global.TunMtus[0]);
|
||||
}
|
||||
if (Utils.IsNullOrEmpty(_config.tunModeItem.stack))
|
||||
var inbound = new Inbound4Sbox()
|
||||
{
|
||||
_config.tunModeItem.stack = Global.TunStacks[0];
|
||||
}
|
||||
type = Global.InboundSocks,
|
||||
tag = Global.InboundSocks,
|
||||
listen = Global.Loopback,
|
||||
};
|
||||
singboxConfig.inbounds.Add(inbound);
|
||||
|
||||
var tunInbound = Utils.FromJson<Inbound4Sbox>(Utils.GetEmbedText(Global.TunSingboxInboundFileName));
|
||||
tunInbound.mtu = _config.tunModeItem.mtu;
|
||||
tunInbound.strict_route = _config.tunModeItem.strictRoute;
|
||||
tunInbound.stack = _config.tunModeItem.stack;
|
||||
|
||||
singboxConfig.inbounds.Add(tunInbound);
|
||||
}
|
||||
else
|
||||
{
|
||||
var inbound = singboxConfig.inbounds[0];
|
||||
inbound.listen_port = LazyConfig.Instance.GetLocalPort(Global.InboundSocks);
|
||||
inbound.sniff = _config.inbound[0].sniffingEnabled;
|
||||
inbound.sniff_override_destination = _config.inbound[0].routeOnly ? false : _config.inbound[0].sniffingEnabled;
|
||||
|
@ -174,6 +163,25 @@ namespace v2rayN.Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_config.tunModeItem.enableTun)
|
||||
{
|
||||
if (_config.tunModeItem.mtu <= 0)
|
||||
{
|
||||
_config.tunModeItem.mtu = Convert.ToInt32(Global.TunMtus[0]);
|
||||
}
|
||||
if (Utils.IsNullOrEmpty(_config.tunModeItem.stack))
|
||||
{
|
||||
_config.tunModeItem.stack = Global.TunStacks[0];
|
||||
}
|
||||
|
||||
var tunInbound = Utils.FromJson<Inbound4Sbox>(Utils.GetEmbedText(Global.TunSingboxInboundFileName));
|
||||
tunInbound.mtu = _config.tunModeItem.mtu;
|
||||
tunInbound.strict_route = _config.tunModeItem.strictRoute;
|
||||
tunInbound.stack = _config.tunModeItem.stack;
|
||||
|
||||
singboxConfig.inbounds.Add(tunInbound);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -163,6 +163,7 @@ namespace v2rayN.Mode
|
|||
public bool strictRoute { get; set; }
|
||||
public string stack { get; set; }
|
||||
public int mtu { get; set; }
|
||||
public bool enableExInbound { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
|
Loading…
Reference in New Issue