1
0
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:
Mike
2014-10-01 14:34:10 -04:00
committed by Mark McDowall
parent 65c1e8852a
commit 5a8ce04bd5
6 changed files with 63 additions and 13 deletions
@@ -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());