mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
7dc061cc8a
Closes #2025 (cherry picked from commit 6bdeafcf8c78e145595f52e885356be1210abe91)
20 lines
721 B
C#
20 lines
721 B
C#
using FluentValidation;
|
|
using FluentValidation.Validators;
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
namespace NzbDrone.Core.Validation
|
|
{
|
|
public static class IpValidation
|
|
{
|
|
public static IRuleBuilderOptions<T, string> ValidIpAddress<T>(this IRuleBuilder<T, string> ruleBuilder)
|
|
{
|
|
return ruleBuilder.Must(x => x.IsValidIpAddress()).WithMessage("Must contain wildcard (*) or a valid IP Address");
|
|
}
|
|
|
|
public static IRuleBuilderOptions<T, string> NotListenAllIp4Address<T>(this IRuleBuilder<T, string> ruleBuilder)
|
|
{
|
|
return ruleBuilder.SetValidator(new RegularExpressionValidator(@"^(?!0\.0\.0\.0)")).WithMessage("Use * instead of 0.0.0.0");
|
|
}
|
|
}
|
|
}
|