Skip to content

Commit

Permalink
Merge pull request #9958 from Shadowghost/networking-fixex
Browse files Browse the repository at this point in the history
  • Loading branch information
Bond-009 committed Jul 6, 2023
2 parents b95fa29 + 2bc2848 commit 5b711f3
Show file tree
Hide file tree
Showing 9 changed files with 451 additions and 377 deletions.
1 change: 1 addition & 0 deletions Emby.Dlna/Main/DlnaEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Emby.Dlna.PlayTo;
using Emby.Dlna.Ssdp;
using Jellyfin.Networking.Configuration;
using Jellyfin.Networking.Extensions;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading.Tasks;
using Emby.Server.Implementations.Udp;
using Jellyfin.Networking.Configuration;
using Jellyfin.Networking.Extensions;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
Expand Down
75 changes: 75 additions & 0 deletions Jellyfin.Networking/Constants/Network.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System.Net;
using Microsoft.AspNetCore.HttpOverrides;

namespace Jellyfin.Networking.Constants;

/// <summary>
/// Networking constants.
/// </summary>
public static class Network
{
/// <summary>
/// IPv4 mask bytes.
/// </summary>
public const int IPv4MaskBytes = 4;

/// <summary>
/// IPv6 mask bytes.
/// </summary>
public const int IPv6MaskBytes = 16;

/// <summary>
/// Minimum IPv4 prefix size.
/// </summary>
public const int MinimumIPv4PrefixSize = 32;

/// <summary>
/// Minimum IPv6 prefix size.
/// </summary>
public const int MinimumIPv6PrefixSize = 128;

/// <summary>
/// Whole IPv4 address space.
/// </summary>
public static readonly IPNetwork IPv4Any = new IPNetwork(IPAddress.Any, 0);

/// <summary>
/// Whole IPv6 address space.
/// </summary>
public static readonly IPNetwork IPv6Any = new IPNetwork(IPAddress.IPv6Any, 0);

/// <summary>
/// IPv4 Loopback as defined in RFC 5735.
/// </summary>
public static readonly IPNetwork IPv4RFC5735Loopback = new IPNetwork(IPAddress.Loopback, 8);

/// <summary>
/// IPv4 private class A as defined in RFC 1918.
/// </summary>
public static readonly IPNetwork IPv4RFC1918PrivateClassA = new IPNetwork(IPAddress.Parse("10.0.0.0"), 8);

/// <summary>
/// IPv4 private class B as defined in RFC 1918.
/// </summary>
public static readonly IPNetwork IPv4RFC1918PrivateClassB = new IPNetwork(IPAddress.Parse("172.16.0.0"), 12);

/// <summary>
/// IPv4 private class C as defined in RFC 1918.
/// </summary>
public static readonly IPNetwork IPv4RFC1918PrivateClassC = new IPNetwork(IPAddress.Parse("192.168.0.0"), 16);

/// <summary>
/// IPv6 loopback as defined in RFC 4291.
/// </summary>
public static readonly IPNetwork IPv6RFC4291Loopback = new IPNetwork(IPAddress.IPv6Loopback, 128);

/// <summary>
/// IPv6 site local as defined in RFC 4291.
/// </summary>
public static readonly IPNetwork IPv6RFC4291SiteLocal = new IPNetwork(IPAddress.Parse("fe80::"), 10);

/// <summary>
/// IPv6 unique local as defined in RFC 4193.
/// </summary>
public static readonly IPNetwork IPv6RFC4193UniqueLocal = new IPNetwork(IPAddress.Parse("fc00::"), 7);
}
Loading

0 comments on commit 5b711f3

Please sign in to comment.