@push.rocks/smartdns 7.6.1 → 7.8.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.
- package/dist_rust/rustdns-client_linux_amd64 +0 -0
- package/dist_rust/rustdns-client_linux_arm64 +0 -0
- package/dist_rust/rustdns_linux_amd64 +0 -0
- package/dist_rust/rustdns_linux_arm64 +0 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts_client/classes.dnsclient.d.ts +14 -32
- package/dist_ts_client/classes.dnsclient.js +63 -55
- package/dist_ts_client/classes.rustdnsclientbridge.d.ts +59 -0
- package/dist_ts_client/classes.rustdnsclientbridge.js +110 -0
- package/dist_ts_client/index.d.ts +1 -0
- package/dist_ts_client/index.js +2 -1
- package/dist_ts_client/plugins.d.ts +8 -1
- package/dist_ts_client/plugins.js +8 -2
- package/dist_ts_server/classes.dnsserver.d.ts +41 -54
- package/dist_ts_server/classes.dnsserver.js +290 -690
- package/dist_ts_server/classes.rustdnsbridge.d.ts +119 -0
- package/dist_ts_server/classes.rustdnsbridge.js +136 -0
- package/dist_ts_server/index.d.ts +1 -0
- package/dist_ts_server/index.js +2 -1
- package/dist_ts_server/plugins.d.ts +8 -7
- package/dist_ts_server/plugins.js +7 -8
- package/npmextra.json +18 -6
- package/package.json +10 -9
- package/readme.hints.md +28 -1
- package/readme.md +345 -645
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/readme.md +47 -0
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5ydXN0ZG5zYnJpZGdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfc2VydmVyL2NsYXNzZXMucnVzdGRuc2JyaWRnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQXFFeEM7O0dBRUc7QUFDSCxNQUFNLE9BQU8sYUFBYyx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TSxXQUFXLEdBQTJCO1FBQzFDLE9BQU8sRUFBRSxPQUFPO1FBQ2hCLFFBQVEsRUFBRSxPQUFPO1FBQ2pCLE9BQU8sRUFBRSxTQUFTO0tBQ25CLENBQUM7SUFFRixNQUFNLE9BQU8sR0FBMkI7UUFDdEMsS0FBSyxFQUFFLE9BQU87UUFDZCxPQUFPLEVBQUUsT0FBTztLQUNqQixDQUFDO0lBRUYsTUFBTSxDQUFDLEdBQUcsV0FBVyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQ2hDLE1BQU0sQ0FBQyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUV4QixJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQztRQUNYLE9BQU8sR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7SUFDckIsQ0FBQztJQUVELE9BQU8sSUFBSSxDQUFDO0FBQ2QsQ0FBQyJ9
|
package/dist_ts_server/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export * from './classes.dnsserver.js';
|
|
2
|
-
|
|
2
|
+
export * from './classes.rustdnsbridge.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19zZXJ2ZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLDRCQUE0QixDQUFDIn0=
|
|
@@ -1,14 +1,15 @@
|
|
|
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,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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, };
|
|
12
13
|
import * as dnsPacket from 'dns-packet';
|
|
13
14
|
import * as minimatch from 'minimatch';
|
|
14
|
-
export { dnsPacket,
|
|
15
|
+
export { dnsPacket, minimatch, };
|
|
@@ -1,18 +1,17 @@
|
|
|
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,
|
|
8
|
+
export { crypto, dgram, fs, net, path, };
|
|
9
|
+
export const events = { EventEmitter };
|
|
10
10
|
// @push.rocks scope
|
|
11
|
-
import * as
|
|
12
|
-
export {
|
|
11
|
+
import * as smartrust from '@push.rocks/smartrust';
|
|
12
|
+
export { smartrust, };
|
|
13
13
|
// third party
|
|
14
|
-
import elliptic from 'elliptic';
|
|
15
14
|
import * as dnsPacket from 'dns-packet';
|
|
16
15
|
import * as minimatch from 'minimatch';
|
|
17
|
-
export { dnsPacket,
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
export { dnsPacket, minimatch, };
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX3NlcnZlci9wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWM7QUFDZCxPQUFPLE1BQU0sTUFBTSxRQUFRLENBQUM7QUFDNUIsT0FBTyxLQUFLLE1BQU0sT0FBTyxDQUFDO0FBQzFCLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxRQUFRLENBQUM7QUFDdEMsT0FBTyxFQUFFLE1BQU0sSUFBSSxDQUFDO0FBQ3BCLE9BQU8sS0FBSyxHQUFHLE1BQU0sS0FBSyxDQUFDO0FBQzNCLE9BQU8sS0FBSyxJQUFJLE1BQU0sTUFBTSxDQUFDO0FBRTdCLE9BQU8sRUFDTCxNQUFNLEVBQ04sS0FBSyxFQUNMLEVBQUUsRUFDRixHQUFHLEVBQ0gsSUFBSSxHQUNMLENBQUE7QUFFRCxNQUFNLENBQUMsTUFBTSxNQUFNLEdBQUcsRUFBRSxZQUFZLEVBQUUsQ0FBQztBQUV2QyxvQkFBb0I7QUFDcEIsT0FBTyxLQUFLLFNBQVMsTUFBTSx1QkFBdUIsQ0FBQztBQUVuRCxPQUFPLEVBQ0wsU0FBUyxHQUNWLENBQUE7QUFFRCxjQUFjO0FBQ2QsT0FBTyxLQUFLLFNBQVMsTUFBTSxZQUFZLENBQUM7QUFDeEMsT0FBTyxLQUFLLFNBQVMsTUFBTSxXQUFXLENBQUM7QUFFdkMsT0FBTyxFQUNMLFNBQVMsRUFDVCxTQUFTLEdBQ1YsQ0FBQSJ9
|
package/npmextra.json
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
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
|
-
"
|
|
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.
|
|
3
|
+
"version": "7.8.0",
|
|
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"
|
|
@@ -42,17 +47,17 @@
|
|
|
42
47
|
"@push.rocks/smartenv": "^5.0.13",
|
|
43
48
|
"@push.rocks/smartpromise": "^4.2.3",
|
|
44
49
|
"@push.rocks/smartrequest": "^2.1.0",
|
|
50
|
+
"@push.rocks/smartrust": "^1.2.0",
|
|
45
51
|
"@tsclass/tsclass": "^9.2.0",
|
|
46
52
|
"@types/dns-packet": "^5.6.5",
|
|
47
|
-
"@types/elliptic": "^6.4.18",
|
|
48
53
|
"acme-client": "^5.4.0",
|
|
49
54
|
"dns-packet": "^5.6.1",
|
|
50
|
-
"elliptic": "^6.6.1",
|
|
51
55
|
"minimatch": "^10.0.1"
|
|
52
56
|
},
|
|
53
57
|
"devDependencies": {
|
|
54
58
|
"@git.zone/tsbuild": "^2.6.8",
|
|
55
59
|
"@git.zone/tsrun": "^1.3.3",
|
|
60
|
+
"@git.zone/tsrust": "^1.3.0",
|
|
56
61
|
"@git.zone/tstest": "^2.3.7",
|
|
57
62
|
"@types/node": "^22.15.21"
|
|
58
63
|
},
|
|
@@ -72,9 +77,5 @@
|
|
|
72
77
|
"last 1 chrome versions"
|
|
73
78
|
],
|
|
74
79
|
"type": "module",
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
"build": "(tsbuild tsfolders --web --allowimplicitany)",
|
|
78
|
-
"buildDocs": "tsdoc"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
80
|
+
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
|
81
|
+
}
|
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
|
|
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
|
|