-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRecursiveServer.js
52 lines (41 loc) · 998 Bytes
/
RecursiveServer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*!
* recursive.js - recursive dns server for bns
* Copyright (c) 2018, Christopher Jeffrey (MIT License).
* https://github.com/chjj/bns
*/
'use strict';
const DNSServer = require('bns/lib/server/dns');
const RecursiveResolver = require('./RecursiveResolver');
/**
* RecursiveServer
* @extends EventEmitter
*/
class RecursiveServer extends DNSServer {
constructor (options = {}) {
super(options);
this.resolver = new RecursiveResolver(options);
this.resolver.on('log', (...args) => this.emit('log', ...args));
this.resolver.on('error', err => this.emit('error', err));
this.ra = true;
this.initOptions(options);
}
use (...args) {
return this.resolver.use(...args);
}
get cache () {
return this.resolver.cache;
}
set cache (value) {
this.resolver.cache = value;
}
get hints () {
return this.resolver.hints;
}
set hints (value) {
this.resolver.hints = value;
}
}
/*
* Expose
*/
module.exports = RecursiveServer;