src/packages/EmbedIO/Utilities/IPParser.cs
/// <summary>
/// Parses the specified IP address.
/// </summary>
/// <param name="address">The IP address.</param>
/// <returns>A collection of <see cref="IPAddress"/> parsed correctly from <paramref name="address"/>.</returns>
Parses the specified IP address.
Parses the specified IP address .
public static async Task<IEnumerable<IPAddress>> ParseAsync(string address)
        {
            if (address == null)
                return Enumerable.Empty<IPAddress>();
            if (IPAddress.TryParse(address, out var ip))
                return new List<IPAddress> { ip };
            try
            {
                return await Dns.GetHostAddressesAsync(address).ConfigureAwait(false);
            }
            catch (SocketException socketEx)
            {
                socketEx.Log(nameof(IPParser));
            }
            catch
            {
            }
            if (IsCidrNotation(address))
                return ParseCidrNotation(address);
            return IsSimpleIPRange(address) ? TryParseSimpleIPRange(address) : Enumerable.Empty<IPAddress>();
        }
public static async Task < IEnumerable < IPAddress > > ParseAsync ( string address ) { if ( address == null ) return Enumerable . Empty < IPAddress > ( ) ; if ( IPAddress . TryParse ( address , out var ip ) ) return new List < IPAddress > { ip } ; try { return await Dns . GetHostAddressesAsync ( address ) . ConfigureAwait ( false ) ; } catch ( SocketException socketEx ) { socketEx . Log ( nameof ( IPParser ) ) ; } catch { } if ( IsCidrNotation ( address ) ) return ParseCidrNotation ( address ) ; return IsSimpleIPRange ( address ) ? TryParseSimpleIPRange ( address ) : Enumerable . Empty < IPAddress > ( ) ; }
Parses the specified IP address.
Parses the specified IP address .
// Ignore
A collection of  parsed correctly from .
A collection of parsed correctly from .
address
string
The IP address.
The IP address .