@push.rocks/smartdns 7.6.1 → 7.8.1

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 (33) hide show
  1. package/dist_rust/rustdns-client_linux_amd64 +0 -0
  2. package/dist_rust/rustdns-client_linux_arm64 +0 -0
  3. package/dist_rust/rustdns_linux_amd64 +0 -0
  4. package/dist_rust/rustdns_linux_arm64 +0 -0
  5. package/dist_ts/00_commitinfo_data.js +1 -1
  6. package/dist_ts_client/classes.dnsclient.d.ts +14 -32
  7. package/dist_ts_client/classes.dnsclient.js +63 -55
  8. package/dist_ts_client/classes.rustdnsclientbridge.d.ts +59 -0
  9. package/dist_ts_client/classes.rustdnsclientbridge.js +110 -0
  10. package/dist_ts_client/index.d.ts +1 -0
  11. package/dist_ts_client/index.js +2 -1
  12. package/dist_ts_client/plugins.d.ts +8 -2
  13. package/dist_ts_client/plugins.js +8 -3
  14. package/dist_ts_server/classes.dnsserver.d.ts +38 -57
  15. package/dist_ts_server/classes.dnsserver.js +180 -702
  16. package/dist_ts_server/classes.rustdnsbridge.d.ts +119 -0
  17. package/dist_ts_server/classes.rustdnsbridge.js +136 -0
  18. package/dist_ts_server/index.d.ts +1 -0
  19. package/dist_ts_server/index.js +2 -1
  20. package/dist_ts_server/plugins.d.ts +8 -8
  21. package/dist_ts_server/plugins.js +7 -9
  22. package/npmextra.json +18 -6
  23. package/package.json +19 -19
  24. package/readme.hints.md +30 -4
  25. package/readme.md +345 -645
  26. package/ts/00_commitinfo_data.ts +1 -1
  27. package/ts/readme.md +47 -0
  28. package/dist_ts_client/dnsly.plugins.d.ts +0 -10
  29. package/dist_ts_client/dnsly.plugins.js +0 -12
  30. package/dist_ts_server/classes.dnssec.d.ts +0 -31
  31. package/dist_ts_server/classes.dnssec.js +0 -155
  32. package/dist_ts_server/classes.dnstools.d.ts +0 -31
  33. package/dist_ts_server/classes.dnstools.js +0 -139
@@ -0,0 +1,119 @@
1
+ import * as plugins from './plugins.js';
2
+ export type TDnsCommands = {
3
+ start: {
4
+ params: {
5
+ config: IRustDnsConfig;
6
+ };
7
+ result: Record<string, never>;
8
+ };
9
+ stop: {
10
+ params: Record<string, never>;
11
+ result: Record<string, never>;
12
+ };
13
+ dnsQueryResult: {
14
+ params: {
15
+ correlationId: string;
16
+ answers: IIpcDnsAnswer[];
17
+ answered: boolean;
18
+ };
19
+ result: {
20
+ resolved: boolean;
21
+ };
22
+ };
23
+ updateCerts: {
24
+ params: {
25
+ httpsKey: string;
26
+ httpsCert: string;
27
+ };
28
+ result: Record<string, never>;
29
+ };
30
+ processPacket: {
31
+ params: {
32
+ packet: string;
33
+ };
34
+ result: {
35
+ packet: string;
36
+ };
37
+ };
38
+ ping: {
39
+ params: Record<string, never>;
40
+ result: {
41
+ pong: boolean;
42
+ };
43
+ };
44
+ };
45
+ export interface IRustDnsConfig {
46
+ udpPort: number;
47
+ httpsPort: number;
48
+ udpBindInterface: string;
49
+ httpsBindInterface: string;
50
+ httpsKey: string;
51
+ httpsCert: string;
52
+ dnssecZone: string;
53
+ dnssecAlgorithm: string;
54
+ primaryNameserver: string;
55
+ enableLocalhostHandling: boolean;
56
+ manualUdpMode: boolean;
57
+ manualHttpsMode: boolean;
58
+ }
59
+ export interface IIpcDnsQuestion {
60
+ name: string;
61
+ type: string;
62
+ class: string;
63
+ }
64
+ export interface IIpcDnsAnswer {
65
+ name: string;
66
+ type: string;
67
+ class: string;
68
+ ttl: number;
69
+ data: any;
70
+ }
71
+ export interface IDnsQueryEvent {
72
+ correlationId: string;
73
+ questions: IIpcDnsQuestion[];
74
+ dnssecRequested: boolean;
75
+ }
76
+ /**
77
+ * Bridge to the Rust DNS binary via smartrust IPC.
78
+ */
79
+ export declare class RustDnsBridge extends plugins.events.EventEmitter {
80
+ private bridge;
81
+ constructor();
82
+ /**
83
+ * Spawn the Rust binary and wait for readiness.
84
+ */
85
+ spawn(): Promise<boolean>;
86
+ /**
87
+ * Start the DNS server with given config.
88
+ */
89
+ startServer(config: IRustDnsConfig): Promise<void>;
90
+ /**
91
+ * Stop the DNS server.
92
+ */
93
+ stopServer(): Promise<void>;
94
+ /**
95
+ * Send a DNS query result back to Rust.
96
+ */
97
+ sendQueryResult(correlationId: string, answers: IIpcDnsAnswer[], answered: boolean): Promise<void>;
98
+ /**
99
+ * Update TLS certificates.
100
+ */
101
+ updateCerts(httpsKey: string, httpsCert: string): Promise<void>;
102
+ /**
103
+ * Process a raw DNS packet via IPC (for manual/passthrough mode).
104
+ * Returns the DNS response as a Buffer.
105
+ */
106
+ processPacket(packet: Buffer): Promise<Buffer>;
107
+ /**
108
+ * Ping the Rust binary for health check.
109
+ */
110
+ ping(): Promise<boolean>;
111
+ /**
112
+ * Kill the Rust process.
113
+ */
114
+ kill(): void;
115
+ /**
116
+ * Whether the bridge is running.
117
+ */
118
+ get running(): boolean;
119
+ }
@@ -0,0 +1,136 @@
1
+ import * as plugins from './plugins.js';
2
+ /**
3
+ * Bridge to the Rust DNS binary via smartrust IPC.
4
+ */
5
+ export class RustDnsBridge extends plugins.events.EventEmitter {
6
+ constructor() {
7
+ super();
8
+ const packageDir = plugins.path.resolve(plugins.path.dirname(new URL(import.meta.url).pathname), '..');
9
+ // Determine platform suffix for dist_rust binaries (matches tsrust naming)
10
+ const platformSuffix = getPlatformSuffix();
11
+ const localPaths = [];
12
+ // dist_rust/ candidates (tsrust cross-compiled output, platform-specific)
13
+ if (platformSuffix) {
14
+ localPaths.push(plugins.path.join(packageDir, 'dist_rust', `rustdns_${platformSuffix}`));
15
+ }
16
+ // dist_rust/ without suffix (native build)
17
+ localPaths.push(plugins.path.join(packageDir, 'dist_rust', 'rustdns'));
18
+ // Local dev build paths
19
+ localPaths.push(plugins.path.join(packageDir, 'rust', 'target', 'release', 'rustdns'));
20
+ localPaths.push(plugins.path.join(packageDir, 'rust', 'target', 'debug', 'rustdns'));
21
+ this.bridge = new plugins.smartrust.RustBridge({
22
+ binaryName: 'rustdns',
23
+ cliArgs: ['--management'],
24
+ requestTimeoutMs: 30_000,
25
+ readyTimeoutMs: 10_000,
26
+ localPaths,
27
+ searchSystemPath: false,
28
+ });
29
+ // Forward events from inner bridge
30
+ this.bridge.on('management:dnsQuery', (data) => {
31
+ this.emit('dnsQuery', data);
32
+ });
33
+ this.bridge.on('management:started', () => {
34
+ this.emit('started');
35
+ });
36
+ this.bridge.on('management:stopped', () => {
37
+ this.emit('stopped');
38
+ });
39
+ this.bridge.on('management:error', (data) => {
40
+ this.emit('error', new Error(data.message));
41
+ });
42
+ this.bridge.on('stderr', (line) => {
43
+ // Forward Rust tracing output as debug logs
44
+ if (line.trim()) {
45
+ console.log(`[rustdns] ${line}`);
46
+ }
47
+ });
48
+ }
49
+ /**
50
+ * Spawn the Rust binary and wait for readiness.
51
+ */
52
+ async spawn() {
53
+ return this.bridge.spawn();
54
+ }
55
+ /**
56
+ * Start the DNS server with given config.
57
+ */
58
+ async startServer(config) {
59
+ await this.bridge.sendCommand('start', { config });
60
+ }
61
+ /**
62
+ * Stop the DNS server.
63
+ */
64
+ async stopServer() {
65
+ await this.bridge.sendCommand('stop', {});
66
+ }
67
+ /**
68
+ * Send a DNS query result back to Rust.
69
+ */
70
+ async sendQueryResult(correlationId, answers, answered) {
71
+ await this.bridge.sendCommand('dnsQueryResult', {
72
+ correlationId,
73
+ answers,
74
+ answered,
75
+ });
76
+ }
77
+ /**
78
+ * Update TLS certificates.
79
+ */
80
+ async updateCerts(httpsKey, httpsCert) {
81
+ await this.bridge.sendCommand('updateCerts', { httpsKey, httpsCert });
82
+ }
83
+ /**
84
+ * Process a raw DNS packet via IPC (for manual/passthrough mode).
85
+ * Returns the DNS response as a Buffer.
86
+ */
87
+ async processPacket(packet) {
88
+ const result = await this.bridge.sendCommand('processPacket', {
89
+ packet: packet.toString('base64'),
90
+ });
91
+ return Buffer.from(result.packet, 'base64');
92
+ }
93
+ /**
94
+ * Ping the Rust binary for health check.
95
+ */
96
+ async ping() {
97
+ const result = await this.bridge.sendCommand('ping', {});
98
+ return result.pong;
99
+ }
100
+ /**
101
+ * Kill the Rust process.
102
+ */
103
+ kill() {
104
+ this.bridge.kill();
105
+ }
106
+ /**
107
+ * Whether the bridge is running.
108
+ */
109
+ get running() {
110
+ return this.bridge.running;
111
+ }
112
+ }
113
+ /**
114
+ * Get the tsrust platform suffix for the current platform.
115
+ * Matches the naming convention used by @git.zone/tsrust.
116
+ */
117
+ function getPlatformSuffix() {
118
+ const platform = process.platform;
119
+ const arch = process.arch;
120
+ const platformMap = {
121
+ 'linux': 'linux',
122
+ 'darwin': 'macos',
123
+ 'win32': 'windows',
124
+ };
125
+ const archMap = {
126
+ 'x64': 'amd64',
127
+ 'arm64': 'arm64',
128
+ };
129
+ const p = platformMap[platform];
130
+ const a = archMap[arch];
131
+ if (p && a) {
132
+ return `${p}_${a}`;
133
+ }
134
+ return null;
135
+ }
136
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5ydXN0ZG5zYnJpZGdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfc2VydmVyL2NsYXNzZXMucnVzdGRuc2JyaWRnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQXFFeEM7O0dBRUc7QUFDSCxNQUFNLE9BQU8sYUFBYyxTQUFRLE9BQU8sQ0FBQyxNQUFNLENBQUMsWUFBWTtJQUc1RDtRQUNFLEtBQUssRUFBRSxDQUFDO1FBRVIsTUFBTSxVQUFVLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQ3JDLE9BQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksR0FBRyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsUUFBUSxDQUFDLEVBQ3ZELElBQUksQ0FDTCxDQUFDO1FB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0FBQyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUV4QixJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQztRQUNYLE9BQU8sR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7SUFDckIsQ0FBQztJQUVELE9BQU8sSUFBSSxDQUFDO0FBQ2QsQ0FBQyJ9
@@ -1 +1,2 @@
1
1
  export * from './classes.dnsserver.js';
2
+ export * from './classes.rustdnsbridge.js';
@@ -1,2 +1,3 @@
1
1
  export * from './classes.dnsserver.js';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19zZXJ2ZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx3QkFBd0IsQ0FBQyJ9
2
+ export * from './classes.rustdnsbridge.js';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19zZXJ2ZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLDRCQUE0QixDQUFDIn0=
@@ -1,14 +1,14 @@
1
1
  import crypto from 'crypto';
2
2
  import dgram from 'dgram';
3
+ import { EventEmitter } from 'events';
3
4
  import fs from 'fs';
4
- import http from 'http';
5
- import https from 'https';
6
5
  import * as net from 'net';
7
6
  import * as path from 'path';
8
- export { crypto, dgram, fs, http, https, net, path, };
9
- import * as smartpromise from '@push.rocks/smartpromise';
10
- export { smartpromise, };
11
- import elliptic from 'elliptic';
12
- import * as dnsPacket from 'dns-packet';
7
+ export { crypto, dgram, fs, net, path, };
8
+ export declare const events: {
9
+ EventEmitter: typeof EventEmitter;
10
+ };
11
+ import * as smartrust from '@push.rocks/smartrust';
12
+ export { smartrust, };
13
13
  import * as minimatch from 'minimatch';
14
- export { dnsPacket, elliptic, minimatch, };
14
+ export { minimatch, };
@@ -1,18 +1,16 @@
1
1
  // node native
2
2
  import crypto from 'crypto';
3
3
  import dgram from 'dgram';
4
+ import { EventEmitter } from 'events';
4
5
  import fs from 'fs';
5
- import http from 'http';
6
- import https from 'https';
7
6
  import * as net from 'net';
8
7
  import * as path from 'path';
9
- export { crypto, dgram, fs, http, https, net, path, };
8
+ export { crypto, dgram, fs, net, path, };
9
+ export const events = { EventEmitter };
10
10
  // @push.rocks scope
11
- import * as smartpromise from '@push.rocks/smartpromise';
12
- export { smartpromise, };
11
+ import * as smartrust from '@push.rocks/smartrust';
12
+ export { smartrust, };
13
13
  // third party
14
- import elliptic from 'elliptic';
15
- import * as dnsPacket from 'dns-packet';
16
14
  import * as minimatch from 'minimatch';
17
- export { dnsPacket, elliptic, minimatch, };
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX3NlcnZlci9wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWM7QUFDZCxPQUFPLE1BQU0sTUFBTSxRQUFRLENBQUM7QUFDNUIsT0FBTyxLQUFLLE1BQU0sT0FBTyxDQUFDO0FBQzFCLE9BQU8sRUFBRSxNQUFNLElBQUksQ0FBQztBQUNwQixPQUFPLElBQUksTUFBTSxNQUFNLENBQUM7QUFDeEIsT0FBTyxLQUFLLE1BQU0sT0FBTyxDQUFDO0FBQzFCLE9BQU8sS0FBSyxHQUFHLE1BQU0sS0FBSyxDQUFDO0FBQzNCLE9BQU8sS0FBSyxJQUFJLE1BQU0sTUFBTSxDQUFDO0FBRTdCLE9BQU8sRUFDTCxNQUFNLEVBQ04sS0FBSyxFQUNM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BQUV2QyxvQkFBb0I7QUFDcEIsT0FBTyxLQUFLLFNBQVMsTUFBTSx1QkFBdUIsQ0FBQztBQUVuRCxPQUFPLEVBQ0wsU0FBUyxHQUNWLENBQUE7QUFFRCxjQUFjO0FBQ2QsT0FBTyxLQUFLLFNBQVMsTUFBTSxXQUFXLENBQUM7QUFFdkMsT0FBTyxFQUNMLFNBQVMsR0FDVixDQUFBIn0=
package/npmextra.json CHANGED
@@ -1,5 +1,11 @@
1
1
  {
2
- "gitzone": {
2
+ "@git.zone/tsrust": {
3
+ "targets": [
4
+ "linux_amd64",
5
+ "linux_arm64"
6
+ ]
7
+ },
8
+ "@git.zone/cli": {
3
9
  "projectType": "npm",
4
10
  "module": {
5
11
  "githost": "code.foss.global",
@@ -27,14 +33,20 @@
27
33
  "Domain Propagation",
28
34
  "DNS Server"
29
35
  ]
36
+ },
37
+ "release": {
38
+ "registries": [
39
+ "https://verdaccio.lossless.digital",
40
+ "https://registry.npmjs.org"
41
+ ],
42
+ "accessLevel": "public"
30
43
  }
31
44
  },
32
- "npmci": {
45
+ "@git.zone/tsdoc": {
46
+ "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
47
+ },
48
+ "@ship.zone/szci": {
33
49
  "npmGlobalTools": [],
34
- "npmAccessLevel": "public",
35
50
  "npmRegistryUrl": "registry.npmjs.org"
36
- },
37
- "tsdoc": {
38
- "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
39
51
  }
40
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@push.rocks/smartdns",
3
- "version": "7.6.1",
3
+ "version": "7.8.1",
4
4
  "private": false,
5
5
  "description": "A robust TypeScript library providing advanced DNS management and resolution capabilities including support for DNSSEC, custom DNS servers, and integration with various DNS providers.",
6
6
  "exports": {
@@ -8,6 +8,11 @@
8
8
  "./server": "./dist_ts_server/index.js",
9
9
  "./client": "./dist_ts_client/index.js"
10
10
  },
11
+ "scripts": {
12
+ "test": "(tstest test/ --verbose --timeout 60)",
13
+ "build": "(tsbuild tsfolders --web --allowimplicitany) && (tsrust)",
14
+ "buildDocs": "tsdoc"
15
+ },
11
16
  "repository": {
12
17
  "type": "git",
13
18
  "url": "https://code.foss.global/push.rocks/smartdns.git"
@@ -39,22 +44,21 @@
39
44
  "homepage": "https://code.foss.global/push.rocks/smartdns",
40
45
  "dependencies": {
41
46
  "@push.rocks/smartdelay": "^3.0.1",
42
- "@push.rocks/smartenv": "^5.0.13",
47
+ "@push.rocks/smartenv": "^6.0.0",
43
48
  "@push.rocks/smartpromise": "^4.2.3",
44
- "@push.rocks/smartrequest": "^2.1.0",
45
- "@tsclass/tsclass": "^9.2.0",
46
- "@types/dns-packet": "^5.6.5",
47
- "@types/elliptic": "^6.4.18",
49
+ "@push.rocks/smartrust": "^1.2.1",
50
+ "@tsclass/tsclass": "^9.3.0",
48
51
  "acme-client": "^5.4.0",
49
- "dns-packet": "^5.6.1",
50
- "elliptic": "^6.6.1",
51
- "minimatch": "^10.0.1"
52
+ "minimatch": "^10.2.0"
52
53
  },
53
54
  "devDependencies": {
54
- "@git.zone/tsbuild": "^2.6.8",
55
- "@git.zone/tsrun": "^1.3.3",
56
- "@git.zone/tstest": "^2.3.7",
57
- "@types/node": "^22.15.21"
55
+ "@git.zone/tsbuild": "^4.1.2",
56
+ "@git.zone/tsrun": "^2.0.1",
57
+ "@git.zone/tsrust": "^1.3.0",
58
+ "@git.zone/tstest": "^3.1.8",
59
+ "@types/dns-packet": "^5.6.5",
60
+ "@types/node": "^25.2.3",
61
+ "dns-packet": "^5.6.1"
58
62
  },
59
63
  "files": [
60
64
  "ts/**/*",
@@ -72,9 +76,5 @@
72
76
  "last 1 chrome versions"
73
77
  ],
74
78
  "type": "module",
75
- "scripts": {
76
- "test": "(tstest test/ --verbose --timeout 60)",
77
- "build": "(tsbuild tsfolders --web --allowimplicitany)",
78
- "buildDocs": "tsdoc"
79
- }
80
- }
79
+ "packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
80
+ }
package/readme.hints.md CHANGED
@@ -5,8 +5,35 @@
5
5
  The smartdns library is structured into three main modules:
6
6
 
7
7
  1. **Client Module** (`ts_client/`) - DNS client functionality
8
- 2. **Server Module** (`ts_server/`) - DNS server implementation
8
+ 2. **Server Module** (`ts_server/`) - DNS server with Rust backend
9
9
  3. **Main Module** (`ts/`) - Re-exports both client and server
10
+ 4. **Rust Module** (`rust/`) - High-performance DNS server binary
11
+
12
+ ## Rust Backend Architecture (v8.0+)
13
+
14
+ The DNS server's network I/O, packet parsing/encoding, and DNSSEC signing run in Rust.
15
+ TypeScript retains handler registration, ACME orchestration, and the public API.
16
+
17
+ ### Rust Crate Structure
18
+ - `rustdns` - Main binary with IPC management loop (`--management` flag)
19
+ - `rustdns-protocol` - DNS wire format parsing/encoding, record types
20
+ - `rustdns-server` - Async UDP + HTTPS DoH servers (tokio, hyper, rustls)
21
+ - `rustdns-dnssec` - ECDSA P-256 / ED25519 key generation and RRset signing
22
+
23
+ ### IPC Flow
24
+ ```
25
+ DNS Query -> Rust (UDP/HTTPS) -> Parse packet
26
+ -> Try local resolution (localhost, DNSKEY)
27
+ -> If handler needed: emit "dnsQuery" event to TypeScript
28
+ -> TypeScript runs minimatch handlers, sends "dnsQueryResult" back
29
+ -> Rust builds response, signs DNSSEC if requested, sends packet
30
+ ```
31
+
32
+ ### Key Files
33
+ - `ts_server/classes.rustdnsbridge.ts` - TypeScript IPC bridge wrapping smartrust.RustBridge
34
+ - `ts_server/classes.dnsserver.ts` - DnsServer class (public API, delegates to Rust bridge)
35
+ - `rust/crates/rustdns/src/management.rs` - IPC management loop
36
+ - `rust/crates/rustdns/src/resolver.rs` - DNS resolver with callback support
10
37
 
11
38
  ## Client Module (Smartdns class)
12
39
 
@@ -67,11 +94,10 @@ The smartdns library is structured into three main modules:
67
94
 
68
95
  ## Key Dependencies
69
96
 
70
- - `dns-packet`: DNS packet encoding/decoding (wire format)
71
- - `elliptic`: Cryptographic operations for DNSSEC
97
+ - `dns-packet`: DNS packet encoding/decoding (wire format, used by TS fallback path)
72
98
  - `acme-client`: Let's Encrypt certificate automation
73
99
  - `minimatch`: Glob pattern matching for domains
74
- - `@push.rocks/smartrequest`: HTTP client for DoH queries
100
+ - `@push.rocks/smartrust`: TypeScript-to-Rust IPC bridge
75
101
  - `@tsclass/tsclass`: Type definitions for DNS records
76
102
 
77
103
  ## Testing Insights