Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host解析应使用getAllByName以获取所有域名解析结果 #489

Closed
chenzuyibao opened this issue Nov 11, 2022 · 2 comments · Fixed by #491
Closed

Host解析应使用getAllByName以获取所有域名解析结果 #489

chenzuyibao opened this issue Nov 11, 2022 · 2 comments · Fixed by #491
Labels
type/enhancement Type: make the code neat or more efficient

Comments

@chenzuyibao
Copy link
Contributor

目前域名解析,将只读取host解析结果的第一个IP

String ip = InetAddress.getByName(addr.getHost()).getHostAddress();

    public static InetAddress getByName(String host)
        throws UnknownHostException {
        return InetAddress.getAllByName(host)[0];
    }

解决方式,使用getAllByName

    InetAddress[] inetAddresses = InetAddress.getAllByName(addr.getHost());
    for (InetAddress inetAddress : inetAddresses) {
        String ip = inetAddress.getHostAddress();
        newAddrs.add(new HostAddress(ip, addr.getPort()));
    }
@wey-gu
Copy link
Contributor

wey-gu commented Nov 14, 2022

cc @Nicole00

@Nicole00
Copy link
Contributor

good issue, we should consider the multiple ip for the given host. Looking forward your pr to support the all InetAddresses 😁@chenzuyibao

chenzuyibao added a commit to chenzuyibao/nebula-java that referenced this issue Nov 16, 2022
chenzuyibao added a commit to chenzuyibao/nebula-java that referenced this issue Nov 16, 2022
@Sophie-Xie Sophie-Xie added the type/enhancement Type: make the code neat or more efficient label Nov 30, 2022
Nicole00 added a commit that referenced this issue Nov 30, 2022
* modify v2.5.0 (#338)

* cherrypick:Bugfix/encoder row writer (#372)

* modify version to 2.5.1 (#373)

* fix: for issue #489

* Update README.md

* fix: for issue #489

Co-authored-by: laura-ding <48548375+laura-ding@users.noreply.github.com>
Co-authored-by: Anqi <anqi.wang@vesoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Type: make the code neat or more efficient
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants