Skip to content

Commit

Permalink
dns: expose bns internal wire type in root server class for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Feb 11, 2021
1 parent 87aee00 commit 3852599
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/dns/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,14 @@ class RootServer extends DNSServer {
this.host = '127.0.0.1';
this.port = 5300;
this.lookup = null;
this.middle = null;
this.publicHost = '127.0.0.1';

// Plugins can access internal types like
// Message, Record, etc. and hijack lookup
// requests by adding a middleware function.
this.wire = wire;
this.middle = null;

// Plugins can add or remove items from
// this set before the server is opened.
this.blacklist = new Set([
Expand Down
1 change: 1 addition & 0 deletions test/ns-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ describe('RootServer Plugins', function() {
const [qs] = req.question;
const name = qs.name.toLowerCase();
const type = qs.type;
const wire = ns.wire;

if (tld === 'bit') {
// This plugin runs an imaginary Namecoin full node.
Expand Down

0 comments on commit 3852599

Please sign in to comment.