From 9e84de8e76863cce199f860d243a0f2722a2deda Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:30:03 +0800 Subject: [PATCH] Migrating the sing-box configuration to 1.10.0 https://sing-box.sagernet.org/migration/#tun-address-fields-are-merged --- v2rayN/ServiceLib/Models/SingboxConfig.cs | 3 +-- v2rayN/ServiceLib/Sample/tun_singbox_inbound | 6 ++++-- .../Services/CoreConfig/CoreConfigSingboxService.cs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/v2rayN/ServiceLib/Models/SingboxConfig.cs b/v2rayN/ServiceLib/Models/SingboxConfig.cs index 5eba73e1..41eee042 100644 --- a/v2rayN/ServiceLib/Models/SingboxConfig.cs +++ b/v2rayN/ServiceLib/Models/SingboxConfig.cs @@ -78,8 +78,7 @@ public int? listen_port { get; set; } public string? domain_strategy { get; set; } public string interface_name { get; set; } - public string inet4_address { get; set; } - public string? inet6_address { get; set; } + public List? address { get; set; } public int? mtu { get; set; } public bool? auto_route { get; set; } public bool? strict_route { get; set; } diff --git a/v2rayN/ServiceLib/Sample/tun_singbox_inbound b/v2rayN/ServiceLib/Sample/tun_singbox_inbound index b4856dd3..db5b0b32 100644 --- a/v2rayN/ServiceLib/Sample/tun_singbox_inbound +++ b/v2rayN/ServiceLib/Sample/tun_singbox_inbound @@ -2,8 +2,10 @@ "type": "tun", "tag": "tun-in", "interface_name": "singbox_tun", - "inet4_address": "172.19.0.1/30", - "inet6_address": "fdfe:dcba:9876::1/126", + "address": [ + "172.18.0.1/30", + "fdfe:dcba:9876::1/126" + ], "mtu": 9000, "auto_route": true, "strict_route": false, diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index 58f913e5..986168d0 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -558,7 +558,7 @@ namespace ServiceLib.Services.CoreConfig //tunInbound.sniff_override_destination = _config.inbound[0].routeOnly ? false : _config.inbound[0].sniffingEnabled; if (_config.TunModeItem.EnableIPv6Address == false) { - tunInbound.inet6_address = null; + tunInbound.address = ["172.18.0.1/30"]; } singboxConfig.inbounds.Add(tunInbound);