Skip to content

InetAddress.getLocalHost() may return the loopback address #19

@johnmgithub

Description

@johnmgithub

In Query.java runOnce() the call to InetAddress.getLocalHost() may return the loopback address in some circumstances - observed on some macOS installations, though I don't know the underlying cause. A possible workaround is to change runOnce() as follows:

public Set<Instance> runOnce() throws IOException {
        InetAddress address = null;
        try(final Socket socket = new Socket()){
            socket.connect(new InetSocketAddress("google.com", 80));
            address = socket.getLocalAddress();
        }
        return runOnceOn(address);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions