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()); }
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()); }
/// <summary> /// Gets the local IPv6 addresses synchronously. /// </summary> /// <returns>Local IPv6 addresses that can be found.</returns> public static string[] GetLocalIPv6s() => IPLookupTable.CreateLocal().GetIPv6Addresses();