Skip to content

Commit 3d34160

Browse files
committed
fix(transport): fail closed on unresolved endpoints
1 parent a23423f commit 3d34160

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎src/main/java/io/github/easy4j/hermes/util/EndpointGuard.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ public static void requireSafeHost(String host, String context) {
9393
try {
9494
addr = InetAddress.getByName(lookup);
9595
} catch (UnknownHostException e) {
96-
// DNS 还无法解析该主机(内部域名、尚未就绪的服务、离线环境)。
97-
// 约束只要求拦截 localhost/环回/私有/保留地址——未解析的主机不在
98-
// 其列,且请求期 DNS 失败会由 OkHttp 自然报错。放行。
99-
return;
96+
throw new IllegalArgumentException(
97+
"Endpoint host could not be resolved: " + host + " (" + context + ")", e);
10098
}
10199
if (isUnsafe(addr)) {
102100
throw new IllegalArgumentException(

0 commit comments

Comments
 (0)