< 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: 175
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

Coverage history 0 25 50 75 100

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
 9322    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    {
 26229        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    public bool EnableUPnP { get; set; }
 114
 115    /// <summary>
 116    /// Gets or sets a value indicating whether IPv6 is enabled.
 117    /// </summary>
 118    public bool EnableIPv4 { get; set; } = true;
 119
 120    /// <summary>
 121    /// Gets or sets a value indicating whether IPv6 is enabled.
 122    /// </summary>
 123    public bool EnableIPv6 { get; set; }
 124
 125    /// <summary>
 126    /// Gets or sets a value indicating whether access from outside of the LAN is permitted.
 127    /// </summary>
 128    public bool EnableRemoteAccess { get; set; } = true;
 129
 130    /// <summary>
 131    /// Gets or sets the subnets that are deemed to make up the LAN.
 132    /// </summary>
 133    public string[] LocalNetworkSubnets { get; set; } = Array.Empty<string>();
 134
 135    /// <summary>
 136    /// Gets or sets the interface addresses which Jellyfin will bind to. If empty, all interfaces will be used.
 137    /// </summary>
 138    public string[] LocalNetworkAddresses { get; set; } = Array.Empty<string>();
 139
 140    /// <summary>
 141    /// Gets or sets the known proxies.
 142    /// </summary>
 143    public string[] KnownProxies { get; set; } = Array.Empty<string>();
 144
 145    /// <summary>
 146    /// Gets or sets a value indicating whether address names that match <see cref="VirtualInterfaceNames"/> should be i
 147    /// </summary>
 148    public bool IgnoreVirtualInterfaces { get; set; } = true;
 149
 150    /// <summary>
 151    /// Gets or sets a value indicating the interface name prefixes that should be ignored. The list can be comma separa
 152    /// </summary>
 93153    public string[] VirtualInterfaceNames { get; set; } = new string[] { "veth" };
 154
 155    /// <summary>
 156    /// Gets or sets a value indicating whether the published server uri is based on information in HTTP requests.
 157    /// </summary>
 158    public bool EnablePublishedServerUriByRequest { get; set; } = false;
 159
 160    /// <summary>
 161    /// Gets or sets the PublishedServerUriBySubnet
 162    /// Gets or sets PublishedServerUri to advertise for specific subnets.
 163    /// </summary>
 164    public string[] PublishedServerUriBySubnet { get; set; } = Array.Empty<string>();
 165
 166    /// <summary>
 167    /// Gets or sets the filter for remote IP connectivity. Used in conjunction with <seealso cref="IsRemoteIPFilterBlac
 168    /// </summary>
 169    public string[] RemoteIPFilter { get; set; } = Array.Empty<string>();
 170
 171    /// <summary>
 172    /// Gets or sets a value indicating whether <seealso cref="RemoteIPFilter"/> contains a blacklist or a whitelist. De
 173    /// </summary>
 174    public bool IsRemoteIPFilterBlacklist { get; set; }
 175}