fcdns 0.5.9 → 0.6.0

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +267 -0
  2. package/README.md +8 -8
  3. package/lib/cli.js +113 -0
  4. package/lib/cli.js.map +1 -0
  5. package/lib/dao/clear.js +8 -0
  6. package/lib/dao/clear.js.map +1 -0
  7. package/lib/dao/get-poison-test-result.js +18 -0
  8. package/lib/dao/get-poison-test-result.js.map +1 -0
  9. package/lib/dao/get-route-result.js +19 -0
  10. package/lib/dao/get-route-result.js.map +1 -0
  11. package/lib/dao/upsert-poison-test-result.js +14 -0
  12. package/lib/dao/upsert-poison-test-result.js.map +1 -0
  13. package/lib/dao/upsert-route-result.js +14 -0
  14. package/lib/dao/upsert-route-result.js.map +1 -0
  15. package/lib/database.js +44 -0
  16. package/lib/database.js.map +1 -0
  17. package/lib/hostnames.js +25 -0
  18. package/lib/hostnames.js.map +1 -0
  19. package/lib/ip-ranges.js +77 -0
  20. package/lib/ip-ranges.js.map +1 -0
  21. package/lib/poison-tester.js +55 -0
  22. package/lib/poison-tester.js.map +1 -0
  23. package/lib/record-types.js +77 -0
  24. package/lib/record-types.js.map +1 -0
  25. package/lib/router.js +63 -0
  26. package/lib/router.js.map +1 -0
  27. package/lib/server.js +84 -0
  28. package/lib/server.js.map +1 -0
  29. package/lib/utils/create-dns-resolver.js +7 -0
  30. package/lib/utils/create-dns-resolver.js.map +1 -0
  31. package/lib/utils/hostname-pattern.js +11 -0
  32. package/lib/utils/hostname-pattern.js.map +1 -0
  33. package/lib/utils/is-ipv4-address.js +4 -0
  34. package/lib/utils/is-ipv4-address.js.map +1 -0
  35. package/lib/utils/is-ipv6-address.js +4 -0
  36. package/lib/utils/is-ipv6-address.js.map +1 -0
  37. package/lib/utils/is-server-online.js +21 -0
  38. package/lib/utils/is-server-online.js.map +1 -0
  39. package/lib/utils/package.js +16 -0
  40. package/lib/utils/package.js.map +1 -0
  41. package/lib/utils/parse-server-info.js +8 -0
  42. package/lib/utils/parse-server-info.js.map +1 -0
  43. package/lib/utils/resolve-a.js +14 -0
  44. package/lib/utils/resolve-a.js.map +1 -0
  45. package/package.json +52 -45
  46. package/dist/cli.cjs +0 -48308
package/CHANGELOG.md ADDED
@@ -0,0 +1,267 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ## [0.6.0](https://github.com/BlackGlory/fcdns/compare/v0.5.10...v0.6.0) (2023-03-12)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * - The minimal version of Node.js is 16.
11
+ - CommonJS => ESM.
12
+
13
+ * upgrade dependencies ([ff85e2c](https://github.com/BlackGlory/fcdns/commit/ff85e2ce4ec7d832614386b935da0f23df5024a1))
14
+
15
+ ### [0.5.10](https://github.com/BlackGlory/fcdns/compare/v0.5.9...v0.5.10) (2023-01-28)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * option types ([3853a1b](https://github.com/BlackGlory/fcdns/commit/3853a1be6889cd12d43c2fe22d3d7eb1a46861bf))
21
+
22
+ ### [0.5.9](https://github.com/BlackGlory/fcdns/compare/v0.5.8...v0.5.9) (2022-08-14)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * scripts ([58c8080](https://github.com/BlackGlory/fcdns/commit/58c80806f05e073dbc9bdc3c7abcc2f62dc19f91))
28
+
29
+ ### [0.5.8](https://github.com/BlackGlory/fcdns/compare/v0.5.7...v0.5.8) (2022-08-11)
30
+
31
+ ### [0.5.7](https://github.com/BlackGlory/fcdns/compare/v0.5.6...v0.5.7) (2022-08-11)
32
+
33
+ ### [0.5.6](https://github.com/BlackGlory/fcdns/compare/v0.5.5...v0.5.6) (2022-08-11)
34
+
35
+ ### [0.5.5](https://github.com/BlackGlory/fcdns/compare/v0.5.4...v0.5.5) (2022-08-06)
36
+
37
+ ### [0.5.4](https://github.com/BlackGlory/fcdns/compare/v0.5.3...v0.5.4) (2022-08-05)
38
+
39
+ ### [0.5.3](https://github.com/BlackGlory/fcdns/compare/v0.5.2...v0.5.3) (2022-08-05)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * bundle ([486968d](https://github.com/BlackGlory/fcdns/commit/486968d33297433fa5edc11d282d6a2a69e6f804))
45
+
46
+ ### [0.5.2](https://github.com/BlackGlory/fcdns/compare/v0.5.1...v0.5.2) (2022-08-05)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * bundle ([210ba5b](https://github.com/BlackGlory/fcdns/commit/210ba5b3355fbdc0930d0b60cd242a4d562f2e95))
52
+
53
+ ### [0.5.1](https://github.com/BlackGlory/fcdns/compare/v0.5.0...v0.5.1) (2022-08-05)
54
+
55
+
56
+ ### Bug Fixes
57
+
58
+ * bundle ([f80e617](https://github.com/BlackGlory/fcdns/commit/f80e6170e3cd50488992a47615b8c8e150c0609c))
59
+
60
+ ## [0.5.0](https://github.com/BlackGlory/fcdns/compare/v0.4.5...v0.5.0) (2022-08-05)
61
+
62
+
63
+ ### ⚠ BREAKING CHANGES
64
+
65
+ * Old route cache and test cache are discarded.
66
+
67
+ ### Features
68
+
69
+ * **scripts:** add scripts ([2caea3b](https://github.com/BlackGlory/fcdns/commit/2caea3b4e3c945cc450371b378bc630f9f8185a1))
70
+ * set process.title ([ea17e1b](https://github.com/BlackGlory/fcdns/commit/ea17e1bae4d70f85a0e7337fed577f34ae8298fe))
71
+
72
+
73
+ ### Bug Fixes
74
+
75
+ * scripts ([b664c6b](https://github.com/BlackGlory/fcdns/commit/b664c6b0bd2dc2e66e694b7d07bc1f56a961f18d))
76
+ * the syntax of option ([208c2c8](https://github.com/BlackGlory/fcdns/commit/208c2c8133859a2f2c18c74277a4de9e6e314a50))
77
+
78
+
79
+ * replace NDJSON with extra-disk-cache ([01c33ac](https://github.com/BlackGlory/fcdns/commit/01c33accaec74851ad68431adf524137d7dac7ab))
80
+
81
+ ### [0.4.5](https://github.com/BlackGlory/fcdns/compare/v0.4.4...v0.4.5) (2022-07-30)
82
+
83
+
84
+ ### Bug Fixes
85
+
86
+ * cli ([abaa8c5](https://github.com/BlackGlory/fcdns/commit/abaa8c5344527605ffe4f2cb702f410f51b04bb7))
87
+
88
+ ### [0.4.4](https://github.com/BlackGlory/fcdns/compare/v0.4.3...v0.4.4) (2022-07-30)
89
+
90
+ ### [0.4.3](https://github.com/BlackGlory/fcdns/compare/v0.4.2...v0.4.3) (2022-07-30)
91
+
92
+ ### [0.4.2](https://github.com/BlackGlory/fcdns/compare/v0.4.1...v0.4.2) (2022-07-26)
93
+
94
+
95
+ ### Features
96
+
97
+ * add timeout option ([42e044b](https://github.com/BlackGlory/fcdns/commit/42e044b972e6a99739d078fb085814fb5ff67929))
98
+
99
+ ### [0.4.1](https://github.com/BlackGlory/fcdns/compare/v0.4.0...v0.4.1) (2022-07-25)
100
+
101
+
102
+ ### Bug Fixes
103
+
104
+ * cli options ([0b4fa30](https://github.com/BlackGlory/fcdns/commit/0b4fa30ea4b41248a2593c5719030bcb2b55c5ea))
105
+
106
+ ## [0.4.0](https://github.com/BlackGlory/fcdns/compare/v0.3.16...v0.4.0) (2022-07-25)
107
+
108
+
109
+ ### ⚠ BREAKING CHANGES
110
+
111
+ * - Remove loose mode, because it doesn't work very well
112
+ - Remove microcaching, as caching is best implemented as a relay server
113
+
114
+ ### Features
115
+
116
+ * remove loose mode and microcaching ([986e58f](https://github.com/BlackGlory/fcdns/commit/986e58f4cc88ab3c77f3149e7a5dc644ee370d79))
117
+
118
+ ### [0.3.16](https://github.com/BlackGlory/fcdns/compare/v0.3.15...v0.3.16) (2022-07-25)
119
+
120
+ ### [0.3.15](https://github.com/BlackGlory/fcdns/compare/v0.3.14...v0.3.15) (2022-04-16)
121
+
122
+
123
+ ### Bug Fixes
124
+
125
+ * hostname blacklist ([0e21a21](https://github.com/BlackGlory/fcdns/commit/0e21a214c13633ee4a3b2fe6353ae97d72f3fa65))
126
+
127
+ ### [0.3.14](https://github.com/BlackGlory/fcdns/compare/v0.3.13...v0.3.14) (2022-04-16)
128
+
129
+
130
+ ### Features
131
+
132
+ * add hostname blacklist ([f196de1](https://github.com/BlackGlory/fcdns/commit/f196de13e742935ccdf4f67e1b54f73b057e15e8))
133
+
134
+
135
+ ### Bug Fixes
136
+
137
+ * make hostname list files optional ([ab2352f](https://github.com/BlackGlory/fcdns/commit/ab2352ff55dd05f947fa8eedd9dc6706e36c67ad))
138
+
139
+ ### [0.3.13](https://github.com/BlackGlory/fcdns/compare/v0.3.12...v0.3.13) (2022-04-01)
140
+
141
+ ### [0.3.12](https://github.com/BlackGlory/fcdns/compare/v0.3.11...v0.3.12) (2022-03-26)
142
+
143
+
144
+ ### Bug Fixes
145
+
146
+ * try fix the out of range problem about SOA serial ([ebc5275](https://github.com/BlackGlory/fcdns/commit/ebc5275cd7ec3074e07558b52ca93d492919f07c))
147
+
148
+ ### [0.3.11](https://github.com/BlackGlory/fcdns/compare/v0.3.10...v0.3.11) (2022-03-26)
149
+
150
+
151
+ ### Bug Fixes
152
+
153
+ * make sure to throw errors ([85ee589](https://github.com/BlackGlory/fcdns/commit/85ee58964c0b20df765c1d61dc4e3fb5e2c95dfd))
154
+
155
+ ### [0.3.10](https://github.com/BlackGlory/fcdns/compare/v0.3.9...v0.3.10) (2022-03-23)
156
+
157
+
158
+ ### Bug Fixes
159
+
160
+ * edge case ([9162617](https://github.com/BlackGlory/fcdns/commit/9162617e2ace75b22e418674320f79858bbdc959))
161
+
162
+ ### [0.3.9](https://github.com/BlackGlory/fcdns/compare/v0.3.8...v0.3.9) (2022-03-20)
163
+
164
+
165
+ ### Bug Fixes
166
+
167
+ * logging ([4902a1f](https://github.com/BlackGlory/fcdns/commit/4902a1f1390a83d02dbbf48395c74d791f5f27da))
168
+
169
+ ### [0.3.8](https://github.com/BlackGlory/fcdns/compare/v0.3.7...v0.3.8) (2022-03-20)
170
+
171
+
172
+ ### Bug Fixes
173
+
174
+ * logging ([21a71d5](https://github.com/BlackGlory/fcdns/commit/21a71d5988da3b32564b058be51fe98366bb3ccf))
175
+
176
+ ### [0.3.7](https://github.com/BlackGlory/fcdns/compare/v0.3.6...v0.3.7) (2022-03-20)
177
+
178
+
179
+ ### Bug Fixes
180
+
181
+ * forward entire response instead of answers ([326fbaf](https://github.com/BlackGlory/fcdns/commit/326fbaf40bc028bdd8c1d3b7c5c540430aa0e7dd))
182
+
183
+ ### [0.3.6](https://github.com/BlackGlory/fcdns/compare/v0.3.5...v0.3.6) (2022-03-03)
184
+
185
+ ### [0.3.5](https://github.com/BlackGlory/fcdns/compare/v0.3.4...v0.3.5) (2022-02-28)
186
+
187
+ ### [0.3.4](https://github.com/BlackGlory/fcdns/compare/v0.3.3...v0.3.4) (2022-02-28)
188
+
189
+ ### [0.3.3](https://github.com/BlackGlory/fcdns/compare/v0.3.2...v0.3.3) (2022-01-02)
190
+
191
+ ### [0.3.2](https://github.com/BlackGlory/fcdns/compare/v0.3.1...v0.3.2) (2021-12-21)
192
+
193
+ ### [0.3.1](https://github.com/BlackGlory/fcdns/compare/v0.3.0...v0.3.1) (2021-12-17)
194
+
195
+ ## [0.3.0](https://github.com/BlackGlory/fcdns/compare/v0.2.7...v0.3.0) (2021-12-17)
196
+
197
+
198
+ ### ⚠ BREAKING CHANGES
199
+
200
+ * - The minimum version is Node.js v16
201
+
202
+ * upgrade dependencies ([c9072dc](https://github.com/BlackGlory/fcdns/commit/c9072dc80e8f6867aca7f0a9d05abec154195f21))
203
+
204
+ ### [0.2.7](https://github.com/BlackGlory/fcdns/compare/v0.2.6...v0.2.7) (2021-12-12)
205
+
206
+ ### [0.2.6](https://github.com/BlackGlory/fcdns/compare/v0.2.5...v0.2.6) (2021-10-17)
207
+
208
+ ### [0.2.5](https://github.com/BlackGlory/fcdns/compare/v0.2.4...v0.2.5) (2021-10-14)
209
+
210
+ ### [0.2.4](https://github.com/BlackGlory/fcdns/compare/v0.2.3...v0.2.4) (2021-10-06)
211
+
212
+
213
+ ### Features
214
+
215
+ * add loose mode ([561f7f9](https://github.com/BlackGlory/fcdns/commit/561f7f9181a5bd76e5093ed5e7fc65daadd4702d))
216
+
217
+ ### [0.2.3](https://github.com/BlackGlory/fcdns/compare/v0.2.2...v0.2.3) (2021-09-18)
218
+
219
+ ### [0.2.2](https://github.com/BlackGlory/fcdns/compare/v0.2.1...v0.2.2) (2021-07-12)
220
+
221
+
222
+ ### Bug Fixes
223
+
224
+ * isHostnamePattern ([eee8e03](https://github.com/BlackGlory/fcdns/commit/eee8e03703e4cac962db6b2d05965f877051c30b))
225
+
226
+ ### [0.2.1](https://github.com/BlackGlory/fcdns/compare/v0.2.0...v0.2.1) (2021-07-09)
227
+
228
+
229
+ ### Features
230
+
231
+ * improve hostname pattern ([f86b9a6](https://github.com/BlackGlory/fcdns/commit/f86b9a64c92160dc5995fa1dc77e0a1f2c1daa3d))
232
+
233
+ ## [0.2.0](https://github.com/BlackGlory/fcdns/compare/v0.1.6...v0.2.0) (2021-07-09)
234
+
235
+
236
+ ### ⚠ BREAKING CHANGES
237
+
238
+ * rename whitelist.txt to ip-whitelist.txt
239
+
240
+ ### Features
241
+
242
+ * add hostname whitelist ([f96d2f3](https://github.com/BlackGlory/fcdns/commit/f96d2f38daf1506e168d7e380b09edad87165d06))
243
+ * support to parse ip addresses in whitelist ([10024db](https://github.com/BlackGlory/fcdns/commit/10024db45acb5201f67ecc64a7e2cf54ade396b4))
244
+
245
+ ### [0.1.6](https://github.com/BlackGlory/fcdns/compare/v0.1.5...v0.1.6) (2021-05-17)
246
+
247
+ ### [0.1.5](https://github.com/BlackGlory/fcdns/compare/v0.1.4...v0.1.5) (2021-05-14)
248
+
249
+ ### [0.1.4](https://github.com/BlackGlory/fcdns/compare/v0.1.3...v0.1.4) (2021-05-08)
250
+
251
+ ### [0.1.3](https://github.com/BlackGlory/fcdns/compare/v0.1.2...v0.1.3) (2021-05-08)
252
+
253
+ ### [0.1.2](https://github.com/BlackGlory/fcdns/compare/v0.1.1...v0.1.2) (2021-04-22)
254
+
255
+
256
+ ### Bug Fixes
257
+
258
+ * handle uncaught errors ([a324ed8](https://github.com/BlackGlory/fcdns/commit/a324ed8241feb1aab029b5bd23d3f792bce42c58))
259
+
260
+ ### [0.1.1](https://github.com/BlackGlory/fcdns/compare/v0.1.0...v0.1.1) (2021-04-14)
261
+
262
+ ## 0.1.0 (2021-04-12)
263
+
264
+
265
+ ### Features
266
+
267
+ * init ([5185bb9](https://github.com/BlackGlory/fcdns/commit/5185bb9103536124b15192b340bd0a91d1eb49af))
package/README.md CHANGED
@@ -19,14 +19,14 @@ Options:
19
19
  --test-server <server>
20
20
  --untrusted-server <server>
21
21
  --trusted-server <server>
22
- --port [port] (default: "53")
23
- --timeout [seconds] (default: "30")
24
- --ip-whitelist [filename] (default: "ip-whitelist.txt")
25
- --hostname-whitelist [filename] (default: "hostname-whitelist.txt")
26
- --hostname-blacklist [filename] (default: "hostname-blacklist.txt")
27
- --cache [filename] (default: "cache.db")
28
- --test-timeout [ms] (default: "200")
29
- --log [level] (default: "info")
22
+ --port <port> (default: "53")
23
+ --timeout <seconds> (default: "30")
24
+ --ip-whitelist <filename> (default: "ip-whitelist.txt")
25
+ --hostname-whitelist <filename> (default: "hostname-whitelist.txt")
26
+ --hostname-blacklist <filename> (default: "hostname-blacklist.txt")
27
+ --cache <filename> (default: "cache.db")
28
+ --test-timeout <milliseconds> (default: "200")
29
+ --log <level> (default: "info")
30
30
  -h, --help display help for command
31
31
  ```
32
32
 
package/lib/cli.js ADDED
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander';
3
+ import { startServer } from './server.js';
4
+ import { Router } from './router.js';
5
+ import { IPRanges } from './ip-ranges.js';
6
+ import { Hostnames } from './hostnames.js';
7
+ import { PoisonTester } from './poison-tester.js';
8
+ import { createDNSResolver } from "./utils/create-dns-resolver.js";
9
+ import { assert } from '@blackglory/prelude';
10
+ import { Level, Logger, TerminalTransport, stringToLevel } from 'extra-logger';
11
+ import { parseServerInfo } from "./utils/parse-server-info.js";
12
+ import { youDied } from 'you-died';
13
+ import * as Database from './database.js';
14
+ import { name, version, description } from "./utils/package.js";
15
+ process.title = name;
16
+ program
17
+ .name(name)
18
+ .version(version)
19
+ .description(description)
20
+ .requiredOption('--test-server <server>')
21
+ .requiredOption('--untrusted-server <server>')
22
+ .requiredOption('--trusted-server <server>')
23
+ .option('--port <port>', '', '53')
24
+ .option('--timeout <seconds>', '', '30')
25
+ .option('--ip-whitelist <filename>', '', 'ip-whitelist.txt')
26
+ .option('--hostname-whitelist <filename>', '', 'hostname-whitelist.txt')
27
+ .option('--hostname-blacklist <filename>', '', 'hostname-blacklist.txt')
28
+ .option('--cache <filename>', '', 'cache.db')
29
+ .option('--test-timeout <milliseconds>', '', '200')
30
+ .option('--log <level>', '', 'info')
31
+ .action(async () => {
32
+ const options = program.opts();
33
+ const cacheFilename = getCacheFilename(options);
34
+ const testServer = getTestServer(options);
35
+ const testTimeout = getTestTimeout(options);
36
+ const timeout = getTimeout(options);
37
+ const port = getPort(options);
38
+ const logLevel = getLogLevel(options);
39
+ const ipWhitelistFilename = getIpWhiltelistFilename(options);
40
+ const hostnameWhitelistFilename = getHostnameWhitelistFilename(options);
41
+ const hostnameBlacklistFilename = getHostnameBlacklistFilename(options);
42
+ const untrustedServer = getUntrustedServer(options);
43
+ const trustedServer = getTrustedServer(options);
44
+ Database.openDatabase(cacheFilename);
45
+ await Database.prepareDatabase();
46
+ youDied(() => Database.closeDatabase());
47
+ const poisonTester = new PoisonTester({
48
+ server: testServer,
49
+ timeout: testTimeout
50
+ });
51
+ const untrustedResolver = createDNSResolver(untrustedServer.host
52
+ + (untrustedServer.port ? `:${untrustedServer.port}` : ''));
53
+ const ipWhitelist = await IPRanges.fromFile(ipWhitelistFilename);
54
+ const hostnameWhitelist = await Hostnames.fromFile(hostnameWhitelistFilename);
55
+ const hostnameBlacklist = await Hostnames.fromFile(hostnameBlacklistFilename);
56
+ const router = new Router({
57
+ poisonTester,
58
+ untrustedResolver,
59
+ ipWhitelist,
60
+ hostnameWhitelist,
61
+ hostnameBlacklist
62
+ });
63
+ const logger = new Logger({
64
+ level: logLevel,
65
+ transport: new TerminalTransport({})
66
+ });
67
+ startServer({
68
+ router,
69
+ logger,
70
+ trustedServer,
71
+ untrustedServer,
72
+ timeout,
73
+ port
74
+ });
75
+ })
76
+ .parse();
77
+ function getTestServer(options) {
78
+ return options.testServer;
79
+ }
80
+ function getUntrustedServer(options) {
81
+ return parseServerInfo(options.untrustedServer);
82
+ }
83
+ function getTrustedServer(options) {
84
+ return parseServerInfo(options.trustedServer);
85
+ }
86
+ function getPort(options) {
87
+ assert(/^\d+$/.test(options.port), 'The parameter port must be integer');
88
+ return Number.parseInt(options.port, 10);
89
+ }
90
+ function getTimeout(options) {
91
+ assert(/^\d+$/.test(options.timeout), 'The parameter timeout must be integer');
92
+ return Number.parseInt(options.port, 10) * 1000;
93
+ }
94
+ function getIpWhiltelistFilename(options) {
95
+ return options.ipWhitelist;
96
+ }
97
+ function getHostnameWhitelistFilename(options) {
98
+ return options.hostnameWhitelist;
99
+ }
100
+ function getHostnameBlacklistFilename(options) {
101
+ return options.hostnameBlacklist;
102
+ }
103
+ function getCacheFilename(options) {
104
+ return options.cache;
105
+ }
106
+ function getTestTimeout(options) {
107
+ assert(/^\d+$/.test(options.testTimeout), 'The parameter test timeout must be integer');
108
+ return Number.parseInt(options.testTimeout, 10);
109
+ }
110
+ function getLogLevel(options) {
111
+ return stringToLevel(options.log, Level.Info);
112
+ }
113
+ //# sourceMappingURL=cli.js.map
package/lib/cli.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,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AI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAA;AACjD,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAiB;IAChD,OAAO,OAAO,CAAC,WAAW,CAAA;AAC5B,CAAC;AAED,SAAS,4BAA4B,CAAC,OAAiB;IACrD,OAAO,OAAO,CAAC,iBAAiB,CAAA;AAClC,CAAC;AAED,SAAS,4BAA4B,CAAC,OAAiB;IACrD,OAAO,OAAO,CAAC,iBAAiB,CAAA;AAClC,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAiB;IACzC,OAAO,OAAO,CAAC,KAAK,CAAA;AACtB,CAAC;AAED,SAAS,cAAc,CAAC,OAAiB;IACvC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,4CAA4C,CAAC,CAAA;IAEvF,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AACjD,CAAC;AAED,SAAS,WAAW,CAAC,OAAiB;IACpC,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;AAC/C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { getDatabase } from "../database.js";
2
+ import { withLazyStatic, lazyStatic } from 'extra-lazy';
3
+ export const clear = withLazyStatic(function () {
4
+ lazyStatic(() => getDatabase().prepare(`
5
+ DELETE FROM hostname
6
+ `), [getDatabase()]).run();
7
+ });
8
+ //# sourceMappingURL=clear.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear.js","sourceRoot":"","sources":["../../src/dao/clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAwB;AAC9C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,CAAC,MAAM,KAAK,GAAG,cAAc,CAAC;IAClC,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;;GAEtC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;AAC5B,CAAC,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { getDatabase } from "../database.js";
2
+ import { PoisonTestResult } from "../poison-tester.js";
3
+ import { withLazyStatic, lazyStatic } from 'extra-lazy';
4
+ export const getPoisonResult = withLazyStatic(function (hostname) {
5
+ const row = lazyStatic(() => getDatabase()
6
+ .prepare(`
7
+ SELECT poison_test_result
8
+ FROM hostname
9
+ WHERE hostname = $hostname
10
+ `), [getDatabase()])
11
+ .get({ hostname });
12
+ switch (row === null || row === void 0 ? void 0 : row.poison_test_result) {
13
+ case PoisonTestResult.Poisoned: return PoisonTestResult.Poisoned;
14
+ case PoisonTestResult.NotPoisoned: return PoisonTestResult.NotPoisoned;
15
+ default: return null;
16
+ }
17
+ });
18
+ //# sourceMappingURL=get-poison-test-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-poison-test-result.js","sourceRoot":"","sources":["../../src/dao/get-poison-test-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAwB;AAC9C,OAAO,EAAE,gBAAgB,EAAE,4BAA6B;AACxD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC,UAAU,QAAgB;IACtE,MAAM,GAAG,GAAsD,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;SAC1F,OAAO,CAAC;;;;KAIR,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;SACnB,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IAEpB,QAAQ,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,kBAAkB,EAAE;QAC/B,KAAK,gBAAgB,CAAC,QAAQ,CAAC,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAA;QAChE,KAAK,gBAAgB,CAAC,WAAW,CAAC,CAAC,OAAO,gBAAgB,CAAC,WAAW,CAAA;QACtE,OAAO,CAAC,CAAC,OAAO,IAAI,CAAA;KACrB;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { getDatabase } from "../database.js";
2
+ import { RouteResult } from "../router.js";
3
+ import { withLazyStatic, lazyStatic } from 'extra-lazy';
4
+ export const getRouteResult = withLazyStatic(function (hostname) {
5
+ const row = lazyStatic(() => getDatabase()
6
+ .prepare(`
7
+ SELECT route_result
8
+ FROM hostname
9
+ WHERE hostname = $hostname
10
+ `), [getDatabase()])
11
+ .get({ hostname });
12
+ switch (row === null || row === void 0 ? void 0 : row.route_result) {
13
+ case RouteResult.Unresolved: return RouteResult.Unresolved;
14
+ case RouteResult.TrustedServer: return RouteResult.TrustedServer;
15
+ case RouteResult.UntrustedServer: return RouteResult.UntrustedServer;
16
+ default: return null;
17
+ }
18
+ });
19
+ //# sourceMappingURL=get-route-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-route-result.js","sourceRoot":"","sources":["../../src/dao/get-route-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAwB;AAC9C,OAAO,EAAE,WAAW,EAAE,qBAAsB;AAC5C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,QAAgB;IACrE,MAAM,GAAG,GAAgD,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;SACpF,OAAO,CAAC;;;;KAIR,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;SACnB,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IAEpB,QAAQ,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAAY,EAAE;QACzB,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC,OAAO,WAAW,CAAC,UAAU,CAAA;QAC1D,KAAK,WAAW,CAAC,aAAa,CAAC,CAAC,OAAO,WAAW,CAAC,aAAa,CAAA;QAChE,KAAK,WAAW,CAAC,eAAe,CAAC,CAAC,OAAO,WAAW,CAAC,eAAe,CAAA;QACpE,OAAO,CAAC,CAAC,OAAO,IAAI,CAAA;KACrB;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { getDatabase } from "../database.js";
2
+ import { withLazyStatic, lazyStatic } from 'extra-lazy';
3
+ export const upsertPoisonTestResult = withLazyStatic(function (hostname, result) {
4
+ lazyStatic(() => getDatabase().prepare(`
5
+ INSERT INTO hostname (
6
+ hostname
7
+ , poison_test_result
8
+ )
9
+ VALUES ($hostname, $result)
10
+ ON CONFLICT(hostname)
11
+ DO UPDATE SET poison_test_result = $result
12
+ `), [getDatabase()]).run({ hostname, result });
13
+ });
14
+ //# sourceMappingURL=upsert-poison-test-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsert-poison-test-result.js","sourceRoot":"","sources":["../../src/dao/upsert-poison-test-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAwB;AAE9C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC,UACnD,QAAgB,EAChB,MAAwB;IAExB,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;;;;;;;;GAQtC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAA;AAChD,CAAC,CAAC,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { getDatabase } from "../database.js";
2
+ import { withLazyStatic, lazyStatic } from 'extra-lazy';
3
+ export const upsertRouteResult = withLazyStatic(function (hostname, routeResult) {
4
+ lazyStatic(() => getDatabase().prepare(`
5
+ INSERT INTO hostname (
6
+ hostname
7
+ , route_result
8
+ )
9
+ VALUES ($hostname, $routeResult)
10
+ ON CONFLICT(hostname)
11
+ DO UPDATE SET route_result = $routeResult
12
+ `), [getDatabase()]).run({ hostname, routeResult });
13
+ });
14
+ //# sourceMappingURL=upsert-route-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsert-route-result.js","sourceRoot":"","sources":["../../src/dao/upsert-route-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAwB;AAE9C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC,UAC9C,QAAgB,EAChB,WAAwB;IAExB,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;;;;;;;;GAQtC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAA;AACrD,CAAC,CAAC,CAAA"}
@@ -0,0 +1,44 @@
1
+ import Database from 'better-sqlite3';
2
+ import path from 'path';
3
+ import { ensureDirSync, findUpPackageFilename } from 'extra-filesystem';
4
+ import { assert } from '@blackglory/errors';
5
+ import { findMigrationFilenames, readMigrationFile } from 'migration-files';
6
+ import { migrate } from '@blackglory/better-sqlite3-migrations';
7
+ import { isntUndefined } from '@blackglory/prelude';
8
+ import { map } from 'extra-promise';
9
+ import { fileURLToPath } from 'url';
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ let db;
12
+ export function openDatabase(filename) {
13
+ if (isntUndefined(filename)) {
14
+ ensureDirSync(path.dirname(filename));
15
+ db = new Database(filename);
16
+ }
17
+ else {
18
+ db = new Database(':memory:');
19
+ }
20
+ }
21
+ export async function prepareDatabase() {
22
+ assert(db, 'Database is not opened');
23
+ await migrateDatabase(db);
24
+ }
25
+ export function getDatabase() {
26
+ assert(db, 'Database is not opened');
27
+ return db;
28
+ }
29
+ export function closeDatabase() {
30
+ if (db) {
31
+ db.exec(`
32
+ PRAGMA analysis_limit=400;
33
+ PRAGMA optimize;
34
+ `);
35
+ db.close();
36
+ }
37
+ }
38
+ async function migrateDatabase(db) {
39
+ const pkgRoot = path.join((await findUpPackageFilename(__dirname)), '..');
40
+ const migrationsPath = path.join(pkgRoot, 'migrations');
41
+ const migrations = await map(await findMigrationFilenames(migrationsPath), readMigrationFile);
42
+ migrate(db, migrations);
43
+ }
44
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AAErC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAE9D,IAAI,EAAa,CAAA;AAEjB,MAAM,UAAU,YAAY,CAAC,QAAiB;IAC5C,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE;QAC3B,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;QAErC,EAAE,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAA;KAC5B;SAAM;QACL,EAAE,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAA;KAC9B;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAA;IACpC,MAAM,eAAe,CAAC,EAAE,CAAC,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAA;IACpC,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,IAAI,EAAE,EAAE;QACN,EAAE,CAAC,IAAI,CAAC;;;KAGP,CAAC,CAAA;QACF,EAAE,CAAC,KAAK,EAAE,CAAA;KACX;AACH,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,EAAa;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,qBAAqB,CAAC,SAAS,CAAC,CAAE,EAAE,IAAI,CAAC,CAAA;IAC1E,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IACvD,MAAM,UAAU,GAAG,MAAM,GAAG,CAC1B,MAAM,sBAAsB,CAAC,cAAc,CAAC,EAC5C,iBAAiB,CAClB,CAAA;IACD,OAAO,CAAC,EAAE,EAAE,UAAU,CAAC,CAAA;AACzB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { promises as fs } from 'fs';
2
+ import { HostnamePattern } from "./utils/hostname-pattern.js";
3
+ import { ensureFile } from 'extra-filesystem';
4
+ export class Hostnames {
5
+ constructor(patterns) {
6
+ this.patterns = patterns;
7
+ }
8
+ static async fromFile(filename) {
9
+ await ensureFile(filename);
10
+ const text = await fs.readFile(filename, 'utf-8');
11
+ const patterns = text.split('\n')
12
+ .map(x => x.trim())
13
+ .filter(x => x !== '')
14
+ .filter(isHostnamePattern)
15
+ .map(x => new HostnamePattern(x));
16
+ return new Hostnames(patterns);
17
+ }
18
+ includes(hostname) {
19
+ return this.patterns.some(x => x.match(hostname));
20
+ }
21
+ }
22
+ function isHostnamePattern(text) {
23
+ return /^[\da-zA-Z\-.*]+$/.test(text);
24
+ }
25
+ //# sourceMappingURL=hostnames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostnames.js","sourceRoot":"","sources":["../src/hostnames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,oCAAkC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,OAAO,SAAS;IACpB,YAAoB,QAA2B;QAA3B,aAAQ,GAAR,QAAQ,CAAmB;IAAG,CAAC;IAEnD,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAgB;QACpC,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAA;QAE1B,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;aAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aAClB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;aACrB,MAAM,CAAC,iBAAiB,CAAC;aACzB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;QAEnC,OAAO,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAA;IAChC,CAAC;IAED,QAAQ,CAAC,QAAgB;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IACnD,CAAC;CACF;AAED,SAAS,iBAAiB,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