aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Net
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2022-07-20 14:29:30 +0200
committerShadowghost <Ghost_of_Stone@web.de>2022-07-20 14:29:30 +0200
commit2281b8c997dff0fa148bf0f193b37664420aca3e (patch)
tree1f650a3bfe9ed13c11831e1226d8f36bd042a5f3 /MediaBrowser.Common/Net
parenta492082f4e015d6d38368c4ac05d39d236387214 (diff)
Move away from using Collection, simplify code, add proper ordering
Diffstat (limited to 'MediaBrowser.Common/Net')
-rw-r--r--MediaBrowser.Common/Net/INetworkManager.cs13
-rw-r--r--MediaBrowser.Common/Net/NetworkExtensions.cs6
2 files changed, 9 insertions, 10 deletions
diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs
index 9f48535576..bb0e2dcb36 100644
--- a/MediaBrowser.Common/Net/INetworkManager.cs
+++ b/MediaBrowser.Common/Net/INetworkManager.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Net;
using System.Net.NetworkInformation;
using Microsoft.AspNetCore.Http;
@@ -34,13 +33,13 @@ namespace MediaBrowser.Common.Net
/// If all the interfaces are specified, and none are excluded, it returns zero items
/// to represent any address.</returns>
/// <param name="individualInterfaces">When false, return <see cref="IPAddress.Any"/> or <see cref="IPAddress.IPv6Any"/> for all interfaces.</param>
- List<IPData> GetAllBindInterfaces(bool individualInterfaces = false);
+ IReadOnlyList<IPData> GetAllBindInterfaces(bool individualInterfaces = false);
/// <summary>
- /// Returns a collection containing the loopback interfaces.
+ /// Returns a list containing the loopback interfaces.
/// </summary>
/// <returns>List{IPData}.</returns>
- List<IPData> GetLoopbacks();
+ IReadOnlyList<IPData> GetLoopbacks();
/// <summary>
/// Retrieves the bind address to use in system url's. (Server Discovery, PlayTo, LiveTV, SystemInfo)
@@ -97,7 +96,7 @@ namespace MediaBrowser.Common.Net
/// Get a list of all the MAC addresses associated with active interfaces.
/// </summary>
/// <returns>List of MAC addresses.</returns>
- IReadOnlyCollection<PhysicalAddress> GetMacAddresses();
+ IReadOnlyList<PhysicalAddress> GetMacAddresses();
/// <summary>
/// Returns true if the address is part of the user defined LAN.
@@ -122,13 +121,13 @@ namespace MediaBrowser.Common.Net
/// <param name="intf">Interface name.</param>
/// <param name="result">Resultant object's ip addresses, if successful.</param>
/// <returns>Success of the operation.</returns>
- bool TryParseInterface(string intf, out Collection<IPData>? result);
+ bool TryParseInterface(string intf, out List<IPData>? result);
/// <summary>
/// Returns all the internal Bind interface addresses.
/// </summary>
/// <returns>An internal list of interfaces addresses.</returns>
- List<IPData> GetInternalBindAddresses();
+ IReadOnlyList<IPData> GetInternalBindAddresses();
/// <summary>
/// Checks to see if <paramref name="remoteIp"/> has access.
diff --git a/MediaBrowser.Common/Net/NetworkExtensions.cs b/MediaBrowser.Common/Net/NetworkExtensions.cs
index ae1e47ccc2..316c2ebcd1 100644
--- a/MediaBrowser.Common/Net/NetworkExtensions.cs
+++ b/MediaBrowser.Common/Net/NetworkExtensions.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.HttpOverrides;
using System;
-using System.Collections.ObjectModel;
+using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Sockets;
@@ -148,9 +148,9 @@ namespace MediaBrowser.Common.Net
/// <param name="result">Collection of <see cref="IPNetwork"/>.</param>
/// <param name="negated">Boolean signaling if negated or not negated values should be parsed.</param>
/// <returns><c>True</c> if parsing was successful.</returns>
- public static bool TryParseSubnets(string[] values, out Collection<IPNetwork> result, bool negated = false)
+ public static bool TryParseSubnets(string[] values, out List<IPNetwork> result, bool negated = false)
{
- result = new Collection<IPNetwork>();
+ result = new List<IPNetwork>();
if (values == null || values.Length == 0)
{