-
Notifications
You must be signed in to change notification settings - Fork 1
/
UnboundServer.js
55 lines (43 loc) · 1.02 KB
/
UnboundServer.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
53
54
55
/*!
* unbound.js - unbound 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 UnboundResolver = require('bns/lib/resolver/unbound');
/**
* UnboundServer
* @extends EventEmitter
*/
class UnboundServer extends DNSServer {
constructor(options) {
super(options);
this.resolver = new UnboundResolver(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);
}
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;
}
}
/*
* Static
*/
UnboundServer.version = UnboundResolver.version;
UnboundServer.native = UnboundResolver.native;
/*
* Expose
*/
module.exports = UnboundServer;