Changed discover option to dnsSeed for clarity and added comments to documentation for the options.
This commit is contained in:
parent
ae97e36ff0
commit
c07bc0461d
@ -36,9 +36,9 @@ By default, peers will be added via DNS discovery and as peers are announced in
|
||||
```javascript
|
||||
|
||||
var pool = new Pool(Networks.livenet, {
|
||||
discover: false,
|
||||
listenAddr: false,
|
||||
addrs: [
|
||||
dnsSeed: false, // prevent seeding with DNS discovered known peers upon connecting
|
||||
listenAddr: false, // prevent new peers being added from addr messages
|
||||
addrs: [ // initial peers to connect to
|
||||
{
|
||||
ip: {
|
||||
v4: '127.0.0.1'
|
||||
|
||||
@ -44,15 +44,15 @@ function Pool(network, options) {
|
||||
this._addrs = [];
|
||||
|
||||
this.listenAddr = true;
|
||||
this.discover = true;
|
||||
this.dnsSeed = true;
|
||||
|
||||
// define configuration options
|
||||
if (options) {
|
||||
if (options.listenAddr === false) {
|
||||
this.listenAddr = false;
|
||||
}
|
||||
if (options.discover === false) {
|
||||
this.discover = false;
|
||||
if (options.dnsSeed === false) {
|
||||
this.dnsSeed = false;
|
||||
}
|
||||
if (options.addrs) {
|
||||
for(var i = 0; i < options.addrs.length; i++) {
|
||||
@ -119,7 +119,7 @@ Pool.PeerEvents = ['version', 'inv', 'getdata', 'ping', 'pong', 'addr',
|
||||
Pool.prototype.connect = function connect() {
|
||||
this.keepalive = true;
|
||||
var self = this;
|
||||
if (this.discover) {
|
||||
if (this.dnsSeed) {
|
||||
self._addAddrsFromSeeds();
|
||||
} else {
|
||||
self._fillConnections();
|
||||
|
||||
@ -48,7 +48,7 @@ describe('Pool', function() {
|
||||
throw new Error('DNS should not be called');
|
||||
});
|
||||
var options = {
|
||||
discover: false,
|
||||
dnsSeed: false,
|
||||
addrs: [
|
||||
{
|
||||
ip: {
|
||||
@ -66,7 +66,7 @@ describe('Pool', function() {
|
||||
|
||||
it('will add addrs via options argument', function() {
|
||||
var options = {
|
||||
discover: false,
|
||||
dnsSeed: false,
|
||||
addrs: [
|
||||
{
|
||||
ip: {
|
||||
@ -100,7 +100,7 @@ describe('Pool', function() {
|
||||
});
|
||||
|
||||
var options = {
|
||||
discover: false,
|
||||
dnsSeed: false,
|
||||
addrs: [
|
||||
{
|
||||
ip: {
|
||||
@ -150,7 +150,7 @@ describe('Pool', function() {
|
||||
});
|
||||
|
||||
var options = {
|
||||
discover: false,
|
||||
dnsSeed: false,
|
||||
listenAddr: false,
|
||||
addrs: [
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user