< Summary - Jellyfin

Information
Class: MediaBrowser.Common.Net.NetworkConfiguration
Assembly: MediaBrowser.Common
File(s): /srv/git/jellyfin/MediaBrowser.Common/Net/NetworkConfiguration.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 176
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

0255075100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
get_BaseUrl()100%11100%
set_BaseUrl(...)100%66100%

File(s)

/srv/git/jellyfin/MediaBrowser.Common/Net/NetworkConfiguration.cs

#LineLine coverage
 1#pragma warning disable CA1819 // Properties should not return arrays
 2
 3using System;
 4
 5namespace MediaBrowser.Common.Net;
 6
 7/// <summary>
 8/// Defines the <see cref="NetworkConfiguration" />.
 9/// </summary>
 10public class NetworkConfiguration
 11{
 12    /// <summary>
 13    /// The default value for <see cref="InternalHttpPort"/>.
 14    /// </summary>
 15    public const int DefaultHttpPort = 8096;
 16
 17    /// <summary>
 18    /// The default value for <see cref="PublicHttpsPort"/> and <see cref="InternalHttpsPort"/>.
 19    /// </summary>
 20    public const int DefaultHttpsPort = 8920;
 21
 9222    private string _baseUrl = string.Empty;
 23
 24    /// <summary>
 25    /// Gets or sets a value used to specify the URL prefix that your Jellyfin instance can be accessed at.
 26    /// </summary>
 27    public string BaseUrl
 28    {
 24429        get => _baseUrl;
 30        set
 31        {
 32            // Normalize the start of the string
 933            if (string.IsNullOrWhiteSpace(value))
 34            {
 35                // If baseUrl is empty, set an empty prefix string
 136                _baseUrl = string.Empty;
 137                return;
 38            }
 39
 840            if (value[0] != '/')
 41            {
 42                // If baseUrl was not configured with a leading slash, append one for consistency
 443                value = "/" + value;
 44            }
 45
 46            // Normalize the end of the string
 847            if (value[^1] == '/')
 48            {
 49                // If baseUrl was configured with a trailing slash, remove it for consistency
 450                value = value.Remove(value.Length - 1);
 51            }
 52
 853            _baseUrl = value;
 854        }
 55    }
 56
 57    /// <summary>
 58    /// Gets or sets a value indicating whether to use HTTPS.
 59    /// </summary>
 60    /// <remarks>
 61    /// In order for HTTPS to be used, in addition to setting this to true, valid values must also be
 62    /// provided for <see cref="CertificatePath"/> and <see cref="CertificatePassword"/>.
 63    /// </remarks>
 64    public bool EnableHttps { get; set; }
 65
 66    /// <summary>
 67    /// Gets or sets a value indicating whether the server should force connections over HTTPS.
 68    /// </summary>
 69    public bool RequireHttps { get; set; }
 70
 71    /// <summary>
 72    /// Gets or sets the filesystem path of an X.509 certificate to use for SSL.
 73    /// </summary>
 74    public string CertificatePath { get; set; } = string.Empty;
 75
 76    /// <summary>
 77    /// Gets or sets the password required to access the X.509 certificate data in the file specified by <see cref="Cert
 78    /// </summary>
 79    public string CertificatePassword { get; set; } = string.Empty;
 80
 81    /// <summary>
 82    /// Gets or sets the internal HTTP server port.
 83    /// </summary>
 84    /// <value>The HTTP server port.</value>
 85    public int InternalHttpPort { get; set; } = DefaultHttpPort;
 86
 87    /// <summary>
 88    /// Gets or sets the internal HTTPS server port.
 89    /// </summary>
 90    /// <value>The HTTPS server port.</value>
 91    public int InternalHttpsPort { get; set; } = DefaultHttpsPort;
 92
 93    /// <summary>
 94    /// Gets or sets the public HTTP port.
 95    /// </summary>
 96    /// <value>The public HTTP port.</value>
 97    public int PublicHttpPort { get; set; } = DefaultHttpPort;
 98
 99    /// <summary>
 100    /// Gets or sets the public HTTPS port.
 101    /// </summary>
 102    /// <value>The public HTTPS port.</value>
 103    public int PublicHttpsPort { get; set; } = DefaultHttpsPort;
 104
 105    /// <summary>
 106    /// Gets or sets a value indicating whether Autodiscovery is enabled.
 107    /// </summary>
 108    public bool AutoDiscovery { get; set; } = true;
 109
 110    /// <summary>
 111    /// Gets or sets a value indicating whether to enable automatic port forwarding.
 112    /// </summary>
 113    [Obsolete("No longer supported")]
 114    public bool EnableUPnP { get; set; }
 115
 116    /// <summary>
 117    /// Gets or sets a value indicating whether IPv6 is enabled.
 118    /// </summary>
 119    public bool EnableIPv4 { get; set; } = true;
 120
 121    /// <summary>
 122    /// Gets or sets a value indicating whether IPv6 is enabled.
 123    /// </summary>
 124    public bool EnableIPv6 { get; set; }
 125
 126    /// <summary>
 127    /// Gets or sets a value indicating whether access from outside of the LAN is permitted.
 128    /// </summary>
 129    public bool EnableRemoteAccess { get; set; } = true;
 130
 131    /// <summary>
 132    /// Gets or sets the subnets that are deemed to make up the LAN.
 133    /// </summary>
 134    public string[] LocalNetworkSubnets { get; set; } = Array.Empty<string>();
 135
 136    /// <summary>
 137    /// Gets or sets the interface addresses which Jellyfin will bind to. If empty, all interfaces will be used.
 138    /// </summary>
 139    public string[] LocalNetworkAddresses { get; set; } = Array.Empty<string>();
 140
 141    /// <summary>
 142    /// Gets or sets the known proxies.
 143    /// </summary>
 144    public string[] KnownProxies { get; set; } = Array.Empty<string>();
 145
 146    /// <summary>
 147    /// Gets or sets a value indicating whether address names that match <see cref="VirtualInterfaceNames"/> should be i
 148    /// </summary>
 149    public bool IgnoreVirtualInterfaces { get; set; } = true;
 150
 151    /// <summary>
 152    /// Gets or sets a value indicating the interface name prefixes that should be ignored. The list can be comma separa
 153    /// </summary>
 92154    public string[] VirtualInterfaceNames { get; set; } = new string[] { "veth" };
 155
 156    /// <summary>
 157    /// Gets or sets a value indicating whether the published server uri is based on information in HTTP requests.
 158    /// </summary>
 159    public bool EnablePublishedServerUriByRequest { get; set; } = false;
 160
 161    /// <summary>
 162    /// Gets or sets the PublishedServerUriBySubnet
 163    /// Gets or sets PublishedServerUri to advertise for specific subnets.
 164    /// </summary>
 165    public string[] PublishedServerUriBySubnet { get; set; } = Array.Empty<string>();
 166
 167    /// <summary>
 168    /// Gets or sets the filter for remote IP connectivity. Used in conjunction with <seealso cref="IsRemoteIPFilterBlac
 169    /// </summary>
 170    public string[] RemoteIPFilter { get; set; } = Array.Empty<string>();
 171
 172    /// <summary>
 173    /// Gets or sets a value indicating whether <seealso cref="RemoteIPFilter"/> contains a blacklist or a whitelist. De
 174    /// </summary>
 175    public bool IsRemoteIPFilterBlacklist { get; set; }
 176}