mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 01:54:42 +01:00
Remove IpAddressInfo and IpEndPointInfo classes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -9,7 +10,7 @@ namespace MediaBrowser.Model.Net
|
||||
/// </summary>
|
||||
public interface ISocket : IDisposable
|
||||
{
|
||||
IpAddressInfo LocalIPAddress { get; }
|
||||
IPAddress LocalIPAddress { get; }
|
||||
|
||||
Task<SocketReceiveResult> ReceiveAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken);
|
||||
|
||||
@@ -21,6 +22,6 @@ namespace MediaBrowser.Model.Net
|
||||
/// <summary>
|
||||
/// Sends a UDP message to a particular end point (uni or multicast).
|
||||
/// </summary>
|
||||
Task SendToAsync(byte[] buffer, int offset, int bytes, IpEndPointInfo endPoint, CancellationToken cancellationToken);
|
||||
Task SendToAsync(byte[] buffer, int offset, int bytes, IPEndPoint endPoint, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
@@ -8,7 +9,7 @@ namespace MediaBrowser.Model.Net
|
||||
public interface ISocketFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Createa a new unicast socket using the specified local port number.
|
||||
/// Creates a new unicast socket using the specified local port number.
|
||||
/// </summary>
|
||||
/// <param name="localPort">The local port to bind to.</param>
|
||||
/// <returns>A <see cref="ISocket"/> implementation.</returns>
|
||||
@@ -16,15 +17,15 @@ namespace MediaBrowser.Model.Net
|
||||
|
||||
ISocket CreateUdpBroadcastSocket(int localPort);
|
||||
|
||||
ISocket CreateTcpSocket(IpAddressInfo remoteAddress, int remotePort);
|
||||
ISocket CreateTcpSocket(IPAddress remoteAddress, int remotePort);
|
||||
|
||||
/// <summary>
|
||||
/// Createa a new unicast socket using the specified local port number.
|
||||
/// Creates a new unicast socket using the specified local port number.
|
||||
/// </summary>
|
||||
ISocket CreateSsdpUdpSocket(IpAddressInfo localIp, int localPort);
|
||||
ISocket CreateSsdpUdpSocket(IPAddress localIp, int localPort);
|
||||
|
||||
/// <summary>
|
||||
/// Createa a new multicast socket using the specified multicast IP address, multicast time to live and local port.
|
||||
/// Creates a new multicast socket using the specified multicast IP address, multicast time to live and local port.
|
||||
/// </summary>
|
||||
/// <param name="ipAddress">The multicast IP address to bind to.</param>
|
||||
/// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public class IpAddressInfo
|
||||
{
|
||||
public static IpAddressInfo Any = new IpAddressInfo("0.0.0.0", IpAddressFamily.InterNetwork);
|
||||
public static IpAddressInfo IPv6Any = new IpAddressInfo("00000000000000000000", IpAddressFamily.InterNetworkV6);
|
||||
public static IpAddressInfo Loopback = new IpAddressInfo("127.0.0.1", IpAddressFamily.InterNetwork);
|
||||
public static IpAddressInfo IPv6Loopback = new IpAddressInfo("::1", IpAddressFamily.InterNetworkV6);
|
||||
|
||||
public string Address { get; set; }
|
||||
public IpAddressInfo SubnetMask { get; set; }
|
||||
public IpAddressFamily AddressFamily { get; set; }
|
||||
|
||||
public IpAddressInfo(string address, IpAddressFamily addressFamily)
|
||||
{
|
||||
Address = address;
|
||||
AddressFamily = addressFamily;
|
||||
}
|
||||
|
||||
public bool Equals(IpAddressInfo address)
|
||||
{
|
||||
return string.Equals(address.Address, Address, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Address;
|
||||
}
|
||||
}
|
||||
|
||||
public enum IpAddressFamily
|
||||
{
|
||||
InterNetwork,
|
||||
InterNetworkV6
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public class IpEndPointInfo
|
||||
{
|
||||
public IpAddressInfo IpAddress { get; set; }
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public IpEndPointInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IpEndPointInfo(IpAddressInfo address, int port)
|
||||
{
|
||||
IpAddress = address;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var ipAddresString = IpAddress == null ? string.Empty : IpAddress.ToString();
|
||||
|
||||
return ipAddresString + ":" + Port.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.Net;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
/// <summary>
|
||||
@@ -18,7 +20,7 @@ namespace MediaBrowser.Model.Net
|
||||
/// <summary>
|
||||
/// The <see cref="IpEndPointInfo"/> the data was received from.
|
||||
/// </summary>
|
||||
public IpEndPointInfo RemoteEndPoint { get; set; }
|
||||
public IpAddressInfo LocalIPAddress { get; set; }
|
||||
public IPEndPoint RemoteEndPoint { get; set; }
|
||||
public IPAddress LocalIPAddress { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user