aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Networking
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2021-03-27 17:24:47 +0100
committerJoshua M. Boniface <joshua@boniface.me>2021-04-11 14:13:44 -0400
commitc3c98331d973f79e4c38bbcd15e71e297641f483 (patch)
tree1d5f31383c5677ee26038e9db3d2fb8695e00861 /Jellyfin.Networking
parente78fa8c3ef0e1af49afae6ffec2439e1e2fc24a5 (diff)
Merge pull request #5495 from BaronGreenback/RemoteAccessFix
(cherry picked from commit a890a8509228f6a357a6986549afc492da74b146) Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
Diffstat (limited to 'Jellyfin.Networking')
-rw-r--r--Jellyfin.Networking/Manager/NetworkManager.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/Jellyfin.Networking/Manager/NetworkManager.cs b/Jellyfin.Networking/Manager/NetworkManager.cs
index 587c81624..2f5a5b6e3 100644
--- a/Jellyfin.Networking/Manager/NetworkManager.cs
+++ b/Jellyfin.Networking/Manager/NetworkManager.cs
@@ -587,6 +587,29 @@ namespace Jellyfin.Networking.Manager
return false;
}
+ /// <inheritdoc/>
+ public bool HasRemoteAccess(IPAddress remoteIp)
+ {
+ var config = _configurationManager.GetNetworkConfiguration();
+ if (config.EnableRemoteAccess)
+ {
+ // Comma separated list of IP addresses or IP/netmask entries for networks that will be allowed to connect remotely.
+ // If left blank, all remote addresses will be allowed.
+ if (RemoteAddressFilter.Count > 0 && !IsInLocalNetwork(remoteIp))
+ {
+ // remoteAddressFilter is a whitelist or blacklist.
+ return RemoteAddressFilter.ContainsAddress(remoteIp) == !config.IsRemoteIPFilterBlacklist;
+ }
+ }
+ else if (!IsInLocalNetwork(remoteIp))
+ {
+ // Remote not enabled. So everyone should be LAN.
+ return false;
+ }
+
+ return true;
+ }
+
/// <summary>
/// Reloads all settings and re-initialises the instance.
/// </summary>