mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-25 14:15:53 +00:00
@@ -52,7 +52,7 @@ PortConstraint::checkValueImpl(Value const& port) const
|
||||
} else {
|
||||
p = static_cast<uint32_t>(std::get<int64_t>(port));
|
||||
}
|
||||
if (p >= portMin && p <= portMax)
|
||||
if (p >= kPORT_MIN && p <= kPORT_MAX)
|
||||
return std::nullopt;
|
||||
return Error{"Port does not satisfy the constraint bounds"};
|
||||
}
|
||||
@@ -71,14 +71,14 @@ ValidIPConstraint::checkValueImpl(Value const& ip) const
|
||||
if (std::get<std::string>(ip) == "localhost")
|
||||
return std::nullopt;
|
||||
|
||||
static std::regex const ipv4(
|
||||
static std::regex const kIPV4(
|
||||
R"(^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$)"
|
||||
);
|
||||
|
||||
static std::regex const ip_url(
|
||||
static std::regex const kIP_URL(
|
||||
R"(^((http|https):\/\/)?((([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,6})|(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))(:\d{1,5})?(\/[^\s]*)?$)"
|
||||
);
|
||||
if (std::regex_match(std::get<std::string>(ip), ipv4) || std::regex_match(std::get<std::string>(ip), ip_url))
|
||||
if (std::regex_match(std::get<std::string>(ip), kIPV4) || std::regex_match(std::get<std::string>(ip), kIP_URL))
|
||||
return std::nullopt;
|
||||
|
||||
return Error{"Ip is not a valid ip address"};
|
||||
|
||||
Reference in New Issue
Block a user