@blockcore/dns 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,4 +18,5 @@ export declare class BlockcoreDns {
18
18
  * Supply null as parameter for serviceType to avoid preloading services.
19
19
  */
20
20
  load(nameservers?: DnsListEntry[], serviceType?: string): Promise<void>;
21
+ private getRandomInt;
21
22
  }
@@ -59,5 +59,11 @@ export class BlockcoreDns {
59
59
  }
60
60
  }
61
61
  this.services = Array.from(servicesMap.values());
62
+ // Set randomly active server after load is complete.
63
+ const randomIndex = this.getRandomInt(this.nameservers.length);
64
+ this.api.setActiveServer(this.nameservers[randomIndex].url);
65
+ }
66
+ getRandomInt(max) {
67
+ return Math.floor(Math.random() * max);
62
68
  }
63
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockcore/dns",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "DNS Provider package to query and resolve dynamic and decentralized DNS entries",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",