NetworkConfiguration.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. #pragma warning disable CA1819 // Properties should not return arrays
  2. using System;
  3. using MediaBrowser.Model.Configuration;
  4. namespace Jellyfin.Networking.Configuration
  5. {
  6. /// <summary>
  7. /// Defines the <see cref="NetworkConfiguration" />.
  8. /// </summary>
  9. public class NetworkConfiguration
  10. {
  11. /// <summary>
  12. /// Gets the default http port.
  13. /// </summary>
  14. public const int DefaultHttpPort = 8096;
  15. /// <summary>
  16. /// Gets the default https port.
  17. /// </summary>
  18. public const int DefaultHttpsPort = 8920;
  19. private string _baseUrl = string.Empty;
  20. /// <summary>
  21. /// Gets or sets a value indicating whether the server should force connections over HTTPS.
  22. /// </summary>
  23. public bool RequireHttps { get; set; }
  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. {
  29. get => _baseUrl;
  30. set
  31. {
  32. // Normalize the start of the string
  33. if (string.IsNullOrWhiteSpace(value))
  34. {
  35. // If baseUrl is empty, set an empty prefix string
  36. _baseUrl = string.Empty;
  37. return;
  38. }
  39. if (value[0] != '/')
  40. {
  41. // If baseUrl was not configured with a leading slash, append one for consistency
  42. value = "/" + value;
  43. }
  44. // Normalize the end of the string
  45. if (value[^1] == '/')
  46. {
  47. // If baseUrl was configured with a trailing slash, remove it for consistency
  48. value = value.Remove(value.Length - 1);
  49. }
  50. _baseUrl = value;
  51. }
  52. }
  53. /// <summary>
  54. /// Gets or sets the public HTTPS port.
  55. /// </summary>
  56. /// <value>The public HTTPS port.</value>
  57. public int PublicHttpsPort { get; set; } = DefaultHttpsPort;
  58. /// <summary>
  59. /// Gets or sets the HTTP server port number.
  60. /// </summary>
  61. /// <value>The HTTP server port number.</value>
  62. public int HttpServerPortNumber { get; set; } = DefaultHttpPort;
  63. /// <summary>
  64. /// Gets or sets the HTTPS server port number.
  65. /// </summary>
  66. /// <value>The HTTPS server port number.</value>
  67. public int HttpsPortNumber { get; set; } = DefaultHttpsPort;
  68. /// <summary>
  69. /// Gets or sets a value indicating whether to use HTTPS.
  70. /// </summary>
  71. /// <remarks>
  72. /// In order for HTTPS to be used, in addition to setting this to true, valid values must also be
  73. /// provided for <see cref="ServerConfiguration.CertificatePath"/> and <see cref="ServerConfiguration.CertificatePassword"/>.
  74. /// </remarks>
  75. public bool EnableHttps { get; set; }
  76. /// <summary>
  77. /// Gets or sets the public mapped port.
  78. /// </summary>
  79. /// <value>The public mapped port.</value>
  80. public int PublicPort { get; set; } = DefaultHttpPort;
  81. /// <summary>
  82. /// Gets or sets a value indicating whether the http port should be mapped as part of UPnP automatic port forwarding..
  83. /// </summary>
  84. public bool UPnPCreateHttpPortMap { get; set; }
  85. /// <summary>
  86. /// Gets or sets the UDPPortRange
  87. /// Gets or sets client udp port range..
  88. /// </summary>
  89. public string UDPPortRange { get; set; } = string.Empty;
  90. /// <summary>
  91. /// Gets or sets a value indicating whether gets or sets IPV6 capability..
  92. /// </summary>
  93. public bool EnableIPV6 { get; set; }
  94. /// <summary>
  95. /// Gets or sets a value indicating whether gets or sets IPV4 capability..
  96. /// </summary>
  97. public bool EnableIPV4 { get; set; } = true;
  98. /// <summary>
  99. /// Gets or sets a value indicating whether detailed ssdp logs are sent to the console/log.
  100. /// "Emby.Dlna": "Debug" must be set in logging.default.json for this property to work..
  101. /// </summary>
  102. public bool EnableSSDPTracing { get; set; }
  103. /// <summary>
  104. /// Gets or sets the SSDPTracingFilter
  105. /// Gets or sets a value indicating whether an IP address is to be used to filter the detailed ssdp logs that are being sent to the console/log.
  106. /// If the setting "Emby.Dlna": "Debug" msut be set in logging.default.json for this property to work..
  107. /// </summary>
  108. public string SSDPTracingFilter { get; set; } = string.Empty;
  109. /// <summary>
  110. /// Gets or sets the number of times SSDP UDP messages are sent..
  111. /// </summary>
  112. public int UDPSendCount { get; set; } = 2;
  113. /// <summary>
  114. /// Gets or sets the delay between each groups of SSDP messages (in ms)..
  115. /// </summary>
  116. public int UDPSendDelay { get; set; } = 100;
  117. /// <summary>
  118. /// Gets or sets a value indicating whether address names that match <see cref="VirtualInterfaceNames"/> should be Ignore for the purposes of binding..
  119. /// </summary>
  120. public bool IgnoreVirtualInterfaces { get; set; } = true;
  121. /// <summary>
  122. /// Gets or sets the VirtualInterfaceNames
  123. /// Gets or sets a value indicating the interfaces that should be ignored. The list can be comma separated. <seealso cref="IgnoreVirtualInterfaces"/>..
  124. /// </summary>
  125. public string VirtualInterfaceNames { get; set; } = "vEthernet*";
  126. /// <summary>
  127. /// Gets or sets the time (in seconds) between the pings of SSDP gateway monitor..
  128. /// </summary>
  129. public int GatewayMonitorPeriod { get; set; } = 60;
  130. /// <summary>
  131. /// Gets a value indicating whether multi-socket binding is available..
  132. /// </summary>
  133. public bool EnableMultiSocketBinding { get; } = true;
  134. /// <summary>
  135. /// Gets or sets a value indicating whether all IPv6 interfaces should be treated as on the internal network.
  136. /// Depending on the address range implemented ULA ranges might not be used..
  137. /// </summary>
  138. public bool TrustAllIP6Interfaces { get; set; }
  139. /// <summary>
  140. /// Gets or sets the ports that HDHomerun uses..
  141. /// </summary>
  142. public string HDHomerunPortRange { get; set; } = string.Empty;
  143. /// <summary>
  144. /// Gets or sets the PublishedServerUriBySubnet
  145. /// Gets or sets PublishedServerUri to advertise for specific subnets..
  146. /// </summary>
  147. public string[] PublishedServerUriBySubnet { get; set; } = Array.Empty<string>();
  148. /// <summary>
  149. /// Gets or sets a value indicating whether Autodiscovery tracing is enabled..
  150. /// </summary>
  151. public bool AutoDiscoveryTracing { get; set; }
  152. /// <summary>
  153. /// Gets or sets a value indicating whether Autodiscovery is enabled..
  154. /// </summary>
  155. public bool AutoDiscovery { get; set; } = true;
  156. /// <summary>
  157. /// Gets or sets the filter for remote IP connectivity. Used in conjuntion with <seealso cref="IsRemoteIPFilterBlacklist"/>..
  158. /// </summary>
  159. public string[] RemoteIPFilter { get; set; } = Array.Empty<string>();
  160. /// <summary>
  161. /// Gets or sets a value indicating whether <seealso cref="RemoteIPFilter"/> contains a blacklist or a whitelist. Default is a whitelist..
  162. /// </summary>
  163. public bool IsRemoteIPFilterBlacklist { get; set; }
  164. /// <summary>
  165. /// Gets or sets a value indicating whether to enable automatic port forwarding..
  166. /// </summary>
  167. public bool EnableUPnP { get; set; }
  168. /// <summary>
  169. /// Gets or sets a value indicating whether access outside of the LAN is permitted..
  170. /// </summary>
  171. public bool EnableRemoteAccess { get; set; } = true;
  172. /// <summary>
  173. /// Gets or sets the subnets that are deemed to make up the LAN..
  174. /// </summary>
  175. public string[] LocalNetworkSubnets { get; set; } = Array.Empty<string>();
  176. /// <summary>
  177. /// Gets or sets the interface addresses which Jellyfin will bind to. If empty, all interfaces will be used..
  178. /// </summary>
  179. public string[] LocalNetworkAddresses { get; set; } = Array.Empty<string>();
  180. /// <summary>
  181. /// Gets or sets the known proxies.
  182. /// </summary>
  183. public string[] KnownProxies { get; set; } = Array.Empty<string>();
  184. }
  185. }