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

net: remove discoverExternal() from the pool #212

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions lib/net/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ class Pool extends EventEmitter {
await this.hosts.open();

await this.discoverGateway();
await this.discoverExternal();
await this.discoverSeeds();

this.fillOutbound();
Expand Down Expand Up @@ -522,52 +521,6 @@ class Pool extends EventEmitter {
}
}

/**
* Attempt to discover external IP via DNS.
* @returns {Promise}
*/

async discoverExternal() {
const port = this.options.publicPort;

// Pointless if we're not listening.
if (!this.options.listen)
return;

// Never hit a DNS server if
// we're using an outbound proxy.
if (this.options.proxy)
return;

// Try not to hit this if we can avoid it.
if (this.hosts.local.size > 0)
return;

let host4 = null;

try {
host4 = await dns.getIPv4(2000);
} catch (e) {
this.logger.debug('Could not find external IPv4 (dns).');
this.logger.debug(e);
}

if (host4 && this.hosts.addLocal(host4, port, scores.DNS))
this.logger.info('External IPv4 found (dns): %s.', host4);

let host6 = null;

try {
host6 = await dns.getIPv6(2000);
} catch (e) {
this.logger.debug('Could not find external IPv6 (dns).');
this.logger.debug(e);
}

if (host6 && this.hosts.addLocal(host6, port, scores.DNS))
this.logger.info('External IPv6 found (dns): %s.', host6);
}

/**
* Handle incoming connection.
* @private
Expand Down