作者 陈刚

抽取域名

... ... @@ -7,10 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
* 测试https是否可以访问
... ... @@ -23,18 +20,11 @@ public class CheckHttpsUtils {
//读取文件里的url
URL resource = CheckHttpsUtils.class.getClassLoader().getResource("url.txt");
List<String> urls = FileUtils.readLines(new File(resource.getFile()), "utf-8");
List<String> errorList = new ArrayList();
Set<String> distinctUrl = new HashSet<>(urls); //去重
Collection<String> distinctUrl = getUrlList(urls);
OkHttpClient client = new OkHttpClient();
for (String url : distinctUrl) {
try {
//去前后空格
String s = StringUtils.trimToNull(url);
if (s == null) continue;
//将http强转为https
url = url.replace("http://", "https://");
url = url.replace("HTTP://", "https://");
//检测https的GET请求
Request request = new Request.Builder()
.url(url)
... ... @@ -59,4 +49,25 @@ public class CheckHttpsUtils {
}
}
/**
* 抽取域名, 并去重
*/
private static Collection<String> getUrlList(List<String> urls) {
Set<String> distinctUrl = new HashSet<>(); //去重
for (String url : urls) {
//去前后空格
url = StringUtils.trimToNull(url);
if (url == null) continue;
//将http强转为https
int i = url.indexOf("/", 10);
if (i > 0) {
url = url.substring(0, i);
}
url = url.toLowerCase();
url = url.replace("http://", "https://");
distinctUrl.add(url);
}
return distinctUrl;
}
}
... ...
https://apollo_meta.dev.aukeyit.com
https://apollo_meta.dev.aukeyit.com
https://jenkins.aukeyit.com:8050
https://jenkins.aukeyit.com:8050
https://jenkins.aukeyit.com:8050/job/$JENKINS_JOB/ws/target/$PROJECT.jar
https://jenkins.aukeyit.com:8050/job/$JENKINS_JOB/ws/target/classes/Dockerfile
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com
https://nexus.aukeyit.com:8081/#browse/search/maven=attributes.maven2.artifactId%3Daukey-notice-starter
https://minio.dw.aukeyit.com/test/logo.png
https://apollo_meta.qa.aukeyit.com
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com
https://eureka.qa.aukeyit.com/eureka
https://eureka.qa.aukeyit.com/eureka
https://eureka.qa.aukeyit.com/eureka
https://apollo_meta.dev.aukeyit.com
https://doc.aukeyit.com/docs/#/dws/public/公共项目/aukey-apollo-starter.md`
https://gitlab.aukeyit.com/dpt/doc/blob/master/public/公共项目/aukey-apollo-starter.md`
https://eureka.qa.aukeyit.com/eureka
https://apollo_meta_dev.aukeyit.com
https://dw.qa.aukeyit.com
https://dw_gz.aukeyit.com
http://browser-interface.qa.aukeyit.com
https://eureka.qa.aukeyit.com/
\ No newline at end of file
https://dw.qa.aukeyit.com
https://gitlab.aukeyit.com/dpt/dws-commons-service
https://eureka.aukeyit.com/eureka
https://eureka.qa.aukeyit.com/eureka
https://eureka.qa.aukeyit.com/eureka
https://dw.qa.aukeyit.com
https://eureka.qa.aukeyit.com/eureka
https://jenkins.aukeyit.com:8050
https://jenkins.aukeyit.com:8050
https://jenkins.aukeyit.com:8050/job/$JENKINS_JOB/ws/target/$PROJECT.jar
https://jenkins.aukeyit.com:8050/job/$JENKINS_JOB/ws/target/classes/Dockerfile
https://eureka.aukeyit.com/eureka
https://eureka.qa.aukeyit.com/eureka
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com
https://nexus.aukeyit.com:8081/#browse/search/maven=attributes.maven2.artifactId%3Daukey-notice-starter
https://minio.dw.aukeyit.com/test/logo.png
https://gz.dw.aukeyit.com/soft-upgrade/api/getUserInfoForInstallReportCrawlerNest?as=VjKP4HMY1zgDROAciLGBby3vU907TFmkl2XSJIeCdstuqxpWo5
https://minio.dw.aukeyit.com/others/upgrade/soft-upgrade/v1.0.0.zip
https://minio.dw.aukeyit.com/others/upgrade/soft-upgrade/v1.0.0.zip
https://minio.dw.aukeyit.com/others/upgrade/soft-upgrade/v1.0.0.zip
https://eureka.aukeyit.com/eureka
https://eureka.qa.aukeyit.com/eureka
https://eureka.aukeyit.com/eureka
https://eureka.qa.aukeyit.com/eureka
https://gz.dw.aukeyit.com/appauth/getToken?appId=10002&appSecret=123456@2&serverAppId=10003
https://apollo_meta.qa.aukeyit.com
https://dw_gz.aukeyit.com
https://eureka.qa.aukeyit.com/eureka
https://dw_gz.aukeyit.com/eureka
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com
https://eureka.aukeyit.com/eureka
https://dw.qa.aukeyit.com
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com
https://dw.qa.aukeyit.com
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com
https://gz.dw.aukeyit.com
https://dw.qa.aukeyit.com
https://dw.qa.aukeyit.com
https://dw_gz.aukeyit.com
https://dw_gz.aukeyit.com
https://gz.dw.aukeyit.com
https://dw.qa.aukeyit.com
https://gz.dw.aukeyit.com/dws-commons-service/
https://dw.qa.aukeyit.com/dws-commons-service/
https://dw.qa.aukeyit.com/dws-commons-service/
https://gz.dw.aukeyit.com/soft-upgrade
https://nexus.aukeyit.com:8081/repository/aukeys-releases/
https://nexus.aukeyit.com:8081/repository/aukeys-snapshots/
https://nexus.aukeyit.com:8081/repository/aukeys-releases/
https://nexus.aukeyit.com:8081/repository/aukeys-snapshots/
https://nexus.aukeyit.com:8081/repository/aukeys-releases/
https://nexus.aukeyit.com:8081/repository/aukeys-snapshots/
https://nexus.aukeyit.com:8081/repository/aukeys-releases/
https://nexus.aukeyit.com:8081/repository/aukeys-snapshots/
http://nexus.star.aukeyit.com:8081/repository/aukeys-releases/
http://nexus.star.aukeyit.com:8081/repository/aukeys-snapshots/
http://nexus.aukeyit.com:8081/repository/aukeys-releases/
http://nexus.aukeyit.com:8081/repository/aukeys-snapshots/
http://nexus.aukeyit.com:8081/repository/aukeys-releases/
http://nexus.aukeyit.com:8081/repository/aukeys-snapshots/
http://nexus.aukeyit.com:8081/repository/aukeys-releases/
http://nexus.aukeyit.com:8081/repository/aukeys-snapshots/
https://eureka.qa.aukeyit.com/eureka
https://eureka.qa.aukeyit.com/eureka
https://eureka.aukeyit.com/eureka/
https://eureka.aukeyit.com/eureka
\ No newline at end of file
... ...