[collector] 采集器参数替换校验补充

This commit is contained in:
tomsun28
2021-11-19 10:38:58 +08:00
parent 3ce1009b1f
commit 116e4ed13d

View File

@@ -19,6 +19,8 @@ public class IpDomainUtil {
private static final String LOCALHOST = "localhost";
private static final Pattern DOMAIN_SCHEMA = Pattern.compile("^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)");
/**
* 校验判断是否是 ip或者domain
* @param ipDomain ip domain string
@@ -37,4 +39,13 @@ public class IpDomainUtil {
return DOMAIN_PATTERN.matcher(ipDomain).matches();
}
/**
* 判断 domain or ip 是否存在http / https 头
* @param domainIp host
* @return 存在true
*/
public static boolean isHasSchema(String domainIp) {
return DOMAIN_SCHEMA.matcher(domainIp).matches();
}
}