示例#1
0
文件: IP.cs 项目: CptWesley/IPToolkit
        private static async Task <string?> GetLocalIPv6Async(bool recurse)
        {
            string?ip = await GetAsync(IPv6LocalRetriever, TryGetLocalV6Async).ConfigureAwait(false);

            if (ip != null)
            {
                return(ip);
            }

            if (recurse)
            {
                string?ip4 = await GetLocalIPv4Async(false).ConfigureAwait(false);

                if (ip4 != null)
                {
                    return(IPLookupTable.CreateLocal().GetIPv6(ip4));
                }
            }

            return(IPLookupTable.CreateLocal().GetIPv6Addresses().FirstOrDefault());
        }
示例#2
0
文件: IP.cs 项目: CptWesley/IPToolkit
        private static string?GetLocalIPv6(bool recurse)
        {
            string?ip = Get(IPv6LocalRetriever, TryGetLocalV6);

            if (ip != null)
            {
                return(ip);
            }

            if (recurse)
            {
                string?ip4 = GetLocalIPv4(false);

                if (ip4 != null)
                {
                    return(IPLookupTable.CreateLocal().GetIPv6(ip4));
                }
            }

            return(IPLookupTable.CreateLocal().GetIPv6Addresses().FirstOrDefault());
        }
示例#3
0
文件: IP.cs 项目: CptWesley/IPToolkit
 /// <summary>
 /// Gets the local IPv6 addresses synchronously.
 /// </summary>
 /// <returns>Local IPv6 addresses that can be found.</returns>
 public static string[] GetLocalIPv6s()
 => IPLookupTable.CreateLocal().GetIPv6Addresses();