|
|
@ -201,29 +201,29 @@ namespace Jellyfin.Networking.Tests
|
|
|
|
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
|
|
|
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
|
|
|
|
|
|
|
|
|
|
|
// Test included.
|
|
|
|
// Test included.
|
|
|
|
Collection<IPObject> nc = nm.CreateIPCollection(settings.Split(","), false);
|
|
|
|
Collection<IPObject> nc = nm.CreateIPCollection(settings.Split(','), false);
|
|
|
|
Assert.Equal(nc.AsString(), result1);
|
|
|
|
Assert.Equal(nc.AsString(), result1);
|
|
|
|
|
|
|
|
|
|
|
|
// Test excluded.
|
|
|
|
// Test excluded.
|
|
|
|
nc = nm.CreateIPCollection(settings.Split(","), true);
|
|
|
|
nc = nm.CreateIPCollection(settings.Split(','), true);
|
|
|
|
Assert.Equal(nc.AsString(), result3);
|
|
|
|
Assert.Equal(nc.AsString(), result3);
|
|
|
|
|
|
|
|
|
|
|
|
conf.EnableIPV6 = false;
|
|
|
|
conf.EnableIPV6 = false;
|
|
|
|
nm.UpdateSettings(conf);
|
|
|
|
nm.UpdateSettings(conf);
|
|
|
|
|
|
|
|
|
|
|
|
// Test IP4 included.
|
|
|
|
// Test IP4 included.
|
|
|
|
nc = nm.CreateIPCollection(settings.Split(","), false);
|
|
|
|
nc = nm.CreateIPCollection(settings.Split(','), false);
|
|
|
|
Assert.Equal(nc.AsString(), result2);
|
|
|
|
Assert.Equal(nc.AsString(), result2);
|
|
|
|
|
|
|
|
|
|
|
|
// Test IP4 excluded.
|
|
|
|
// Test IP4 excluded.
|
|
|
|
nc = nm.CreateIPCollection(settings.Split(","), true);
|
|
|
|
nc = nm.CreateIPCollection(settings.Split(','), true);
|
|
|
|
Assert.Equal(nc.AsString(), result4);
|
|
|
|
Assert.Equal(nc.AsString(), result4);
|
|
|
|
|
|
|
|
|
|
|
|
conf.EnableIPV6 = true;
|
|
|
|
conf.EnableIPV6 = true;
|
|
|
|
nm.UpdateSettings(conf);
|
|
|
|
nm.UpdateSettings(conf);
|
|
|
|
|
|
|
|
|
|
|
|
// Test network addresses of collection.
|
|
|
|
// Test network addresses of collection.
|
|
|
|
nc = nm.CreateIPCollection(settings.Split(","), false);
|
|
|
|
nc = nm.CreateIPCollection(settings.Split(','), false);
|
|
|
|
nc = nc.AsNetworks();
|
|
|
|
nc = nc.AsNetworks();
|
|
|
|
Assert.Equal(nc.AsString(), result5);
|
|
|
|
Assert.Equal(nc.AsString(), result5);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -262,8 +262,8 @@ namespace Jellyfin.Networking.Tests
|
|
|
|
|
|
|
|
|
|
|
|
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
|
|
|
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
|
|
|
|
|
|
|
|
|
|
|
Collection<IPObject> nc1 = nm.CreateIPCollection(settings.Split(","), false);
|
|
|
|
Collection<IPObject> nc1 = nm.CreateIPCollection(settings.Split(','), false);
|
|
|
|
Collection<IPObject> nc2 = nm.CreateIPCollection(compare.Split(","), false);
|
|
|
|
Collection<IPObject> nc2 = nm.CreateIPCollection(compare.Split(','), false);
|
|
|
|
|
|
|
|
|
|
|
|
Assert.Equal(nc1.Union(nc2).AsString(), result);
|
|
|
|
Assert.Equal(nc1.Union(nc2).AsString(), result);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -372,10 +372,10 @@ namespace Jellyfin.Networking.Tests
|
|
|
|
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
|
|
|
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
|
|
|
|
|
|
|
|
|
|
|
// Test included, IP6.
|
|
|
|
// Test included, IP6.
|
|
|
|
Collection<IPObject> ncSource = nm.CreateIPCollection(source.Split(","));
|
|
|
|
Collection<IPObject> ncSource = nm.CreateIPCollection(source.Split(','));
|
|
|
|
Collection<IPObject> ncDest = nm.CreateIPCollection(dest.Split(","));
|
|
|
|
Collection<IPObject> ncDest = nm.CreateIPCollection(dest.Split(','));
|
|
|
|
Collection<IPObject> ncResult = ncSource.Union(ncDest);
|
|
|
|
Collection<IPObject> ncResult = ncSource.Union(ncDest);
|
|
|
|
Collection<IPObject> resultCollection = nm.CreateIPCollection(result.Split(","));
|
|
|
|
Collection<IPObject> resultCollection = nm.CreateIPCollection(result.Split(','));
|
|
|
|
Assert.True(ncResult.Compare(resultCollection));
|
|
|
|
Assert.True(ncResult.Compare(resultCollection));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -527,7 +527,7 @@ namespace Jellyfin.Networking.Tests
|
|
|
|
var conf = new NetworkConfiguration()
|
|
|
|
var conf = new NetworkConfiguration()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
EnableIPV4 = true,
|
|
|
|
EnableIPV4 = true,
|
|
|
|
RemoteIPFilter = addresses.Split(","),
|
|
|
|
RemoteIPFilter = addresses.Split(','),
|
|
|
|
IsRemoteIPFilterBlacklist = false
|
|
|
|
IsRemoteIPFilterBlacklist = false
|
|
|
|
};
|
|
|
|
};
|
|
|
|
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
|
|
|
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
|
|
@ -546,7 +546,7 @@ namespace Jellyfin.Networking.Tests
|
|
|
|
var conf = new NetworkConfiguration()
|
|
|
|
var conf = new NetworkConfiguration()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
EnableIPV4 = true,
|
|
|
|
EnableIPV4 = true,
|
|
|
|
RemoteIPFilter = addresses.Split(","),
|
|
|
|
RemoteIPFilter = addresses.Split(','),
|
|
|
|
IsRemoteIPFilterBlacklist = true
|
|
|
|
IsRemoteIPFilterBlacklist = true
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|