aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2023-02-16 18:15:12 +0100
committerShadowghost <Ghost_of_Stone@web.de>2023-02-17 17:39:11 +0100
commit42498194d9a4069b8cdeb9446f2714f74e3169de (patch)
tree56f279ef44f4f0a0cbf4c50c5416c69f675aa312 /MediaBrowser.Common
parent3a91c37283eb633e7e55df78b8017a5a492923b6 (diff)
Replace ISocket and UdpSocket, fix DLNA and SSDP binding and discovery
Diffstat (limited to 'MediaBrowser.Common')
-rw-r--r--MediaBrowser.Common/Net/INetworkManager.cs12
-rw-r--r--MediaBrowser.Common/Net/IPData.cs75
2 files changed, 7 insertions, 80 deletions
diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs
index 5721b19ca..68974f738 100644
--- a/MediaBrowser.Common/Net/INetworkManager.cs
+++ b/MediaBrowser.Common/Net/INetworkManager.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Net;
using System.Net.NetworkInformation;
+using MediaBrowser.Model.Net;
using Microsoft.AspNetCore.Http;
namespace MediaBrowser.Common.Net
@@ -70,27 +71,28 @@ namespace MediaBrowser.Common.Net
/// <param name="source">Source of the request.</param>
/// <param name="port">Optional port returned, if it's part of an override.</param>
/// <returns>IP address to use, or loopback address if all else fails.</returns>
- string GetBindInterface(HttpRequest source, out int? port);
+ string GetBindAddress(HttpRequest source, out int? port);
/// <summary>
/// Retrieves the bind address to use in system URLs. (Server Discovery, PlayTo, LiveTV, SystemInfo)
/// If no bind addresses are specified, an internal interface address is selected.
- /// (See <see cref="GetBindAddress(IPAddress, out int?)"/>.
+ /// (See <see cref="GetBindAddress(IPAddress, out int?, bool)"/>.
/// </summary>
/// <param name="source">IP address of the request.</param>
/// <param name="port">Optional port returned, if it's part of an override.</param>
+ /// <param name="skipOverrides">Optional boolean denoting if published server overrides should be ignored. Defaults to false.</param>
/// <returns>IP address to use, or loopback address if all else fails.</returns>
- string GetBindAddress(IPAddress source, out int? port);
+ string GetBindAddress(IPAddress source, out int? port, bool skipOverrides = false);
/// <summary>
/// Retrieves the bind address to use in system URLs. (Server Discovery, PlayTo, LiveTV, SystemInfo)
/// If no bind addresses are specified, an internal interface address is selected.
- /// (See <see cref="GetBindAddress(IPAddress, out int?)"/>.
+ /// (See <see cref="GetBindAddress(IPAddress, out int?, bool)"/>.
/// </summary>
/// <param name="source">Source of the request.</param>
/// <param name="port">Optional port returned, if it's part of an override.</param>
/// <returns>IP address to use, or loopback address if all else fails.</returns>
- string GetBindInterface(string source, out int? port);
+ string GetBindAddress(string source, out int? port);
/// <summary>
/// Get a list of all the MAC addresses associated with active interfaces.
diff --git a/MediaBrowser.Common/Net/IPData.cs b/MediaBrowser.Common/Net/IPData.cs
deleted file mode 100644
index 05842632c..000000000
--- a/MediaBrowser.Common/Net/IPData.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System.Net;
-using System.Net.Sockets;
-using Microsoft.AspNetCore.HttpOverrides;
-
-namespace MediaBrowser.Common.Net
-{
- /// <summary>
- /// Base network object class.
- /// </summary>
- public class IPData
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="IPData"/> class.
- /// </summary>
- /// <param name="address">The <see cref="IPAddress"/>.</param>
- /// <param name="subnet">The <see cref="IPNetwork"/>.</param>
- /// <param name="name">The interface name.</param>
- public IPData(IPAddress address, IPNetwork? subnet, string name)
- {
- Address = address;
- Subnet = subnet ?? (address.AddressFamily == AddressFamily.InterNetwork ? new IPNetwork(address, 32) : new IPNetwork(address, 128));
- Name = name;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IPData"/> class.
- /// </summary>
- /// <param name="address">The <see cref="IPAddress"/>.</param>
- /// <param name="subnet">The <see cref="IPNetwork"/>.</param>
- public IPData(IPAddress address, IPNetwork? subnet)
- : this(address, subnet, string.Empty)
- {
- }
-
- /// <summary>
- /// Gets or sets the object's IP address.
- /// </summary>
- public IPAddress Address { get; set; }
-
- /// <summary>
- /// Gets or sets the object's IP address.
- /// </summary>
- public IPNetwork Subnet { get; set; }
-
- /// <summary>
- /// Gets or sets the interface index.
- /// </summary>
- public int Index { get; set; }
-
- /// <summary>
- /// Gets or sets the interface name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets the AddressFamily of the object.
- /// </summary>
- public AddressFamily AddressFamily
- {
- get
- {
- if (Address.Equals(IPAddress.None))
- {
- return Subnet.Prefix.AddressFamily.Equals(IPAddress.None)
- ? AddressFamily.Unspecified
- : Subnet.Prefix.AddressFamily;
- }
- else
- {
- return Address.AddressFamily;
- }
- }
- }
- }
-}