diff options
| author | Cody Robibero <cody@robibe.ro> | 2022-04-03 16:38:04 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2022-04-07 12:54:58 -0400 |
| commit | 94a69c8a8bfbb9c99f93bc6057a23b74f9c41ac8 (patch) | |
| tree | 28ced432e458518c82460b95cff9ed73fff6f075 /MediaBrowser.Common/Net/IPObject.cs | |
| parent | 04cac23a11cacb750a73c65d1dc54c01504626b0 (diff) | |
Merge pull request #7549 from cvium/fix_isinlocalnetwork
(cherry picked from commit bdb85aeecf10feae62ec615c8d80f1b517b8a5d6)
Signed-off-by: crobibero <cody@robibe.ro>
Diffstat (limited to 'MediaBrowser.Common/Net/IPObject.cs')
| -rw-r--r-- | MediaBrowser.Common/Net/IPObject.cs | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/MediaBrowser.Common/Net/IPObject.cs b/MediaBrowser.Common/Net/IPObject.cs index bd5368882..3a5187bc3 100644 --- a/MediaBrowser.Common/Net/IPObject.cs +++ b/MediaBrowser.Common/Net/IPObject.cs @@ -65,7 +65,7 @@ namespace MediaBrowser.Common.Net address = address.MapToIPv4(); } - if (IsLoopback(address)) + if (IPAddress.IsLoopback(address)) { return (address, prefixLength); } @@ -103,31 +103,6 @@ namespace MediaBrowser.Common.Net } /// <summary> - /// Tests to see if the ip address is a Loopback address. - /// </summary> - /// <param name="address">Value to test.</param> - /// <returns>True if it is.</returns> - public static bool IsLoopback(IPAddress address) - { - if (address == null) - { - throw new ArgumentNullException(nameof(address)); - } - - if (!address.Equals(IPAddress.None)) - { - if (address.IsIPv4MappedToIPv6) - { - address = address.MapToIPv4(); - } - - return address.Equals(IPAddress.Loopback) || address.Equals(IPAddress.IPv6Loopback); - } - - return false; - } - - /// <summary> /// Tests to see if the ip address is an IP6 address. /// </summary> /// <param name="address">Value to test.</param> @@ -295,7 +270,7 @@ namespace MediaBrowser.Common.Net /// <returns>True if it is.</returns> public virtual bool IsLoopback() { - return IsLoopback(Address); + return IPAddress.IsLoopback(Address); } /// <summary> |
