mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-27 22:57:09 -04:00
Allow binding to specific interface addresses
https://trello.com/c/aWazKGQc/404-allow-binding-to-specified-ip-address
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Validators;
|
||||
using NzbDrone.Core.Parser;
|
||||
@@ -33,6 +35,21 @@ namespace NzbDrone.Core.Validation
|
||||
return ruleBuilder.SetValidator(new InclusiveBetweenValidator(1, 65535));
|
||||
}
|
||||
|
||||
public static IRuleBuilderOptions<T, string> ValidIp4Address<T>(this IRuleBuilder<T, string> ruleBuilder)
|
||||
{
|
||||
|
||||
return ruleBuilder.Must(x =>
|
||||
{
|
||||
IPAddress parsedAddress;
|
||||
if (!IPAddress.TryParse(x, out parsedAddress))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return parsedAddress.AddressFamily == AddressFamily.InterNetwork;
|
||||
});
|
||||
}
|
||||
|
||||
public static IRuleBuilderOptions<T, Language> ValidLanguage<T>(this IRuleBuilder<T, Language> ruleBuilder)
|
||||
{
|
||||
return ruleBuilder.SetValidator(new LangaugeValidator());
|
||||
|
||||
Reference in New Issue
Block a user