in domain/src/main/java/org/apache/rocketmq/eventbridge/domain/model/source/HTTPEventSourceService.java [237:254]
private void checkIp(String securityConfig, List<String> subnets) throws EventBridgeException {
if (!SECURITY_CONFIG_IP.equals(securityConfig) && !CollectionUtils.isEmpty(subnets)) {
throw new EventBridgeException(HttpSourceParametersInvalid, "Parameter Ip should be empty when SecurityConfig is " + securityConfig);
}
if (SECURITY_CONFIG_IP.equals(securityConfig)) {
if (CollectionUtils.isEmpty(subnets)) {
throw new EventBridgeException(HttpSourceParametersInvalid, "Parameter Ip should not be empty when SecurityConfig is " + securityConfig);
}
if (subnets.size() > SECURITY_CONFIG_LENGTH) {
throw new EventBridgeException(ExceedHttpSourceParametersCount, SECURITY_CONFIG_LENGTH, "Ip", subnets.size());
}
for (String subnet : subnets) {
if (!NetUtil.isIpv4(subnet) && !NetUtil.isNetSegment(subnet)) {
throw new EventBridgeException(HttpSourceParametersInvalid, "Illegal IP or network segment: " + subnet);
}
}
}
}