mirror of
				https://github.com/2dust/v2rayN.git
				synced 2025-10-26 10:14:42 +00:00 
			
		
		
		
	Compare commits
	
		
			3 commits
		
	
	
		
			5f093a9b01
			...
			cba8a49d5c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | cba8a49d5c | ||
|   | c88bf796f4 | ||
|   | faff8e4ea2 | 
					 3 changed files with 48 additions and 7 deletions
				
			
		|  | @ -1253,12 +1253,49 @@ public static class ConfigHandler | |||
|         ProfileItem? itemSocks = null; | ||||
|         if (node.ConfigType != EConfigType.Custom && coreType != ECoreType.sing_box && config.TunModeItem.EnableTun) | ||||
|         { | ||||
|             var tun2SocksAddress = node.Address; | ||||
|             if (node.ConfigType > EConfigType.Group) | ||||
|             { | ||||
|                 static async Task<List<string>> GetChildNodeAddressesAsync(string parentIndexId) | ||||
|                 { | ||||
|                     var childAddresses = new List<string>(); | ||||
|                     if (!ProfileGroupItemManager.Instance.TryGet(parentIndexId, out var groupItem) || groupItem.ChildItems.IsNullOrEmpty()) | ||||
|                         return childAddresses; | ||||
| 
 | ||||
|                     var childIds = Utils.String2List(groupItem.ChildItems); | ||||
| 
 | ||||
|                     foreach (var childId in childIds) | ||||
|                     { | ||||
|                         var childNode = await AppManager.Instance.GetProfileItem(childId); | ||||
|                         if (childNode == null) | ||||
|                             continue; | ||||
| 
 | ||||
|                         if (!childNode.IsComplex()) | ||||
|                         { | ||||
|                             childAddresses.Add(childNode.Address); | ||||
|                         } | ||||
|                         else if (childNode.ConfigType > EConfigType.Group) | ||||
|                         { | ||||
|                             var subAddresses = await GetChildNodeAddressesAsync(childNode.IndexId); | ||||
|                             childAddresses.AddRange(subAddresses); | ||||
|                         } | ||||
|                     } | ||||
| 
 | ||||
|                     return childAddresses; | ||||
|                 } | ||||
| 
 | ||||
|                 var lstAddresses = await GetChildNodeAddressesAsync(node.IndexId); | ||||
|                 if (lstAddresses.Count > 0) | ||||
|                 { | ||||
|                     tun2SocksAddress = Utils.List2String(lstAddresses); | ||||
|                 } | ||||
|             } | ||||
|             itemSocks = new ProfileItem() | ||||
|             { | ||||
|                 CoreType = ECoreType.sing_box, | ||||
|                 ConfigType = EConfigType.SOCKS, | ||||
|                 Address = Global.Loopback, | ||||
|                 SpiderX = node.Address, // Tun2SocksAddress | ||||
|                 SpiderX = tun2SocksAddress, // Tun2SocksAddress | ||||
|                 Port = AppManager.Instance.GetLocalPort(EInboundProtocol.socks) | ||||
|             }; | ||||
|         } | ||||
|  |  | |||
|  | @ -79,6 +79,7 @@ public class CoreConfigClashService | |||
| 
 | ||||
|             //external-controller | ||||
|             fileContent["external-controller"] = $"{Global.Loopback}:{AppManager.Instance.StatePort2}"; | ||||
|             fileContent.Remove("secret"); | ||||
|             //allow-lan | ||||
|             if (_config.Inbound.First().AllowLANConn) | ||||
|             { | ||||
|  |  | |||
|  | @ -414,16 +414,19 @@ public partial class CoreConfigSingboxService | |||
|             return 0; | ||||
|         } | ||||
| 
 | ||||
|         var domain = string.Empty; | ||||
|         List<string> domain = new(); | ||||
|         if (Utils.IsDomain(node.Address)) // normal outbound | ||||
|         { | ||||
|             domain = node.Address; | ||||
|             domain.Add(node.Address); | ||||
|         } | ||||
|         else if (node.Address == Global.Loopback && node.SpiderX.IsNotEmpty() && Utils.IsDomain(node.SpiderX)) // Tun2SocksAddress | ||||
|         if (node.Address == Global.Loopback && node.SpiderX.IsNotEmpty()) // Tun2SocksAddress | ||||
|         { | ||||
|             domain = node.SpiderX; | ||||
|             domain.AddRange(Utils.String2List(node.SpiderX) | ||||
|                 .Where(Utils.IsDomain) | ||||
|                 .Distinct() | ||||
|                 .ToList()); | ||||
|         } | ||||
|         if (domain.IsNullOrEmpty()) | ||||
|         if (domain.Count == 0) | ||||
|         { | ||||
|             return 0; | ||||
|         } | ||||
|  | @ -432,7 +435,7 @@ public partial class CoreConfigSingboxService | |||
|         singboxConfig.dns.rules.Insert(0, new Rule4Sbox | ||||
|         { | ||||
|             server = server, | ||||
|             domain = [domain], | ||||
|             domain = domain, | ||||
|         }); | ||||
| 
 | ||||
|         return await Task.FromResult(0); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue