7 instantiations of IPNetwork
Microsoft.AspNetCore.HttpOverrides (4)
DualIPNetworkList.cs (4)
27var loopback = new IPNetwork(IPAddress.Loopback, 8); 54_system[index] = new IPNetwork(value.Prefix, value.PrefixLength); 67_system.Add(new IPNetwork(item.Prefix, item.PrefixLength)); 105_system.Insert(index, new IPNetwork(item.Prefix, item.PrefixLength));
Microsoft.AspNetCore.HttpOverrides.Tests (1)
ForwardedHeadersMiddlewareTest.cs (1)
1206options.KnownIPNetworks.Add(new System.Net.IPNetwork(networkIp, prefixLength));
System.Net.Primitives (2)
System\Net\IPNetwork.cs (2)
192result = new IPNetwork(address, prefixLength); 220result = new IPNetwork(address, prefixLength);
98 references to IPNetwork
Microsoft.AspNetCore.HttpOverrides (30)
DualIPNetworkList.cs (26)
8using IPNetwork = System.Net.IPNetwork; 13/// Internal list implementation that keeps <see cref="System.Net.IPNetwork"/> and the obsolete 17internal sealed class DualIPNetworkList : IList<IPNetwork>, IList<AspNetIPNetwork> 21private readonly List<IPNetwork> _system = new(); 27var loopback = new IPNetwork(IPAddress.Loopback, 8); 32int ICollection<IPNetwork>.Count => _system.Count; 35bool ICollection<IPNetwork>.IsReadOnly => false; 38IPNetwork IList<IPNetwork>.this[int index] 58void ICollection<IPNetwork>.Add(IPNetwork item) 76void ICollection<IPNetwork>.Clear() => Clear(); 79bool ICollection<IPNetwork>.Contains(IPNetwork item) => _system.Contains(item); 82public void CopyTo(IPNetwork[] array, int arrayIndex) => _system.CopyTo(array, arrayIndex); 85void ICollection<IPNetwork>.CopyTo(IPNetwork[] array, int arrayIndex) => CopyTo(array, arrayIndex); 90IEnumerator<IPNetwork> IEnumerable<IPNetwork>.GetEnumerator() => _system.GetEnumerator(); 93int IList<IPNetwork>.IndexOf(IPNetwork item) => _system.IndexOf(item); 96void IList<IPNetwork>.Insert(int index, IPNetwork item) 108bool ICollection<IPNetwork>.Remove(IPNetwork item) 136void IList<IPNetwork>.RemoveAt(int index) => RemoveAt(index);
ForwardedHeadersMiddleware.cs (1)
402foreach (var network in _options.KnownIPNetworks)
ForwardedHeadersOptions.cs (2)
7using IPNetwork = System.Net.IPNetwork; 99public IList<IPNetwork> KnownIPNetworks => _knownNetworks;
IPNetwork.cs (1)
12/// Please use <see cref="System.Net.IPNetwork"/> instead
Microsoft.AspNetCore.HttpOverrides.Tests (13)
DualIPNetworkListTests.cs (13)
31options.KnownIPNetworks.Add(System.Net.IPNetwork.Parse("10.0.0.0/8")); 55options.KnownIPNetworks[0] = System.Net.IPNetwork.Parse("172.16.0.0/12"); 87options.KnownIPNetworks.Add(System.Net.IPNetwork.Parse("10.0.0.0/8")); 88var first = options.KnownIPNetworks[0]; 104var loopback = options.KnownIPNetworks[0]; 115options.KnownIPNetworks.Add(System.Net.IPNetwork.Parse("10.0.0.0/8")); 116var arr = new System.Net.IPNetwork[5]; 142options.KnownIPNetworks.Add(System.Net.IPNetwork.Parse("10.0.0.0/8")); 143Assert.Equal(1, options.KnownIPNetworks.IndexOf(System.Net.IPNetwork.Parse("10.0.0.0/8"))); 165options.KnownIPNetworks.Insert(0, System.Net.IPNetwork.Parse("10.0.0.0/8")); 186options.KnownIPNetworks.Add(System.Net.IPNetwork.Parse("10.0.0.0/8")); 210options.KnownIPNetworks.Add(System.Net.IPNetwork.Parse("10.0.0.0/8")); 242options.KnownIPNetworks.Add(System.Net.IPNetwork.Parse("10.0.0.0/8"));
System.Net.Primitives (55)
System\Net\IPNetwork.cs (55)
22public readonly struct IPNetwork : IEquatable<IPNetwork>, ISpanFormattable, ISpanParsable<IPNetwork>, IUtf8SpanFormattable, IUtf8SpanParsable<IPNetwork> 37/// Initializes a new instance of the <see cref="IPNetwork"/> class with the specified <see cref="IPAddress"/> and prefix length. 112/// Converts a CIDR <see cref="string"/> to an <see cref="IPNetwork"/> instance. 115/// <returns>An <see cref="IPNetwork"/> instance.</returns> 118public static IPNetwork Parse(string s) 125/// Converts a CIDR character span to an <see cref="IPNetwork"/> instance. 128/// <returns>An <see cref="IPNetwork"/> instance.</returns> 130public static IPNetwork Parse(ReadOnlySpan<char> s) 132if (!TryParse(s, out IPNetwork result)) 141/// Converts a UTF-8 CIDR character span to an <see cref="IPNetwork"/> instance. 144/// <returns>An <see cref="IPNetwork"/> instance.</returns> 146public static IPNetwork Parse(ReadOnlySpan<byte> utf8Text) 148if (!TryParse(utf8Text, out IPNetwork result)) 157/// Converts the specified CIDR string to an <see cref="IPNetwork"/> instance and returns a value indicating whether the conversion succeeded. 160/// <param name="result">When the method returns, contains an <see cref="IPNetwork"/> instance if the conversion succeeds.</param> 162public static bool TryParse(string? s, out IPNetwork result) 174/// Converts the specified CIDR character span to an <see cref="IPNetwork"/> instance and returns a value indicating whether the conversion succeeded. 177/// <param name="result">When the method returns, contains an <see cref="IPNetwork"/> instance if the conversion succeeds.</param> 179public static bool TryParse(ReadOnlySpan<char> s, out IPNetwork result) 202/// Converts the specified UTF-8 CIDR character span to an <see cref="IPNetwork"/> instance and returns a value indicating whether the conversion succeeded. 205/// <param name="result">When the method returns, contains an <see cref="IPNetwork"/> instance if the conversion succeeds.</param> 207public static bool TryParse(ReadOnlySpan<byte> utf8Text, out IPNetwork result) 280/// Converts the instance to a string containing the <see cref="IPNetwork"/>'s CIDR notation. 282/// <returns>The <see cref="string"/> containing the <see cref="IPNetwork"/>'s CIDR notation.</returns> 287/// Attempts to write the <see cref="IPNetwork"/>'s CIDR notation to the given <paramref name="destination"/> span and returns a value indicating whether the operation succeeded. 296/// Attempts to write the <see cref="IPNetwork"/>'s CIDR notation to the given <paramref name="utf8Destination"/> UTF-8 span and returns a value indicating whether the operation succeeded. 305/// Determines whether two <see cref="IPNetwork"/> instances are equal. 307/// <param name="other">The <see cref="IPNetwork"/> instance to compare to this instance.</param> 309/// <exception cref="InvalidOperationException">Uninitialized <see cref="IPNetwork"/> instance.</exception> 310public bool Equals(IPNetwork other) => 315/// Determines whether two <see cref="IPNetwork"/> instances are equal. 317/// <param name="obj">The <see cref="IPNetwork"/> instance to compare to this instance.</param> 318/// <returns><see langword="true"/> if <paramref name="obj"/> is an <see cref="IPNetwork"/> instance and the networks are equal; otherwise <see langword="false"/>.</returns> 319/// <exception cref="InvalidOperationException">Uninitialized <see cref="IPNetwork"/> instance.</exception> 321obj is IPNetwork other && 325/// Determines whether the specified instances of <see cref="IPNetwork"/> are equal. 330public static bool operator ==(IPNetwork left, IPNetwork right) => left.Equals(right); 333/// Determines whether the specified instances of <see cref="IPNetwork"/> are not equal. 338public static bool operator !=(IPNetwork left, IPNetwork right) => !(left == right); 360static IPNetwork IParsable<IPNetwork>.Parse([NotNull] string s, IFormatProvider? provider) => Parse(s); 363static bool IParsable<IPNetwork>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out IPNetwork result) => TryParse(s, out result); 366static IPNetwork ISpanParsable<IPNetwork>.Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s); 369static IPNetwork IUtf8SpanParsable<IPNetwork>.Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text); 372static bool ISpanParsable<IPNetwork>.TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out IPNetwork result) => TryParse(s, out result); 375static bool IUtf8SpanParsable<IPNetwork>.TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out IPNetwork result) => TryParse(utf8Text, out result);