recker 1.0.14 → 1.0.15-next.0e216c0
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/README.md +78 -100
- package/dist/ai/client.d.ts +2 -3
- package/dist/ai/client.d.ts.map +1 -1
- package/dist/ai/client.js +5 -6
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +1 -1
- package/dist/bench/generator.d.ts.map +1 -1
- package/dist/bench/generator.js +2 -1
- package/dist/bench/stats.d.ts +15 -1
- package/dist/bench/stats.d.ts.map +1 -1
- package/dist/bench/stats.js +84 -5
- package/dist/cli/index.js +21 -0
- package/dist/cli/tui/ai-chat.js +2 -2
- package/dist/cli/tui/load-dashboard.d.ts.map +1 -1
- package/dist/cli/tui/load-dashboard.js +62 -8
- package/dist/cli/tui/scroll-buffer.d.ts +43 -0
- package/dist/cli/tui/scroll-buffer.d.ts.map +1 -0
- package/dist/cli/tui/scroll-buffer.js +162 -0
- package/dist/cli/tui/search-panel.d.ts +41 -0
- package/dist/cli/tui/search-panel.d.ts.map +1 -0
- package/dist/cli/tui/search-panel.js +419 -0
- package/dist/cli/tui/shell.d.ts +11 -0
- package/dist/cli/tui/shell.d.ts.map +1 -1
- package/dist/cli/tui/shell.js +236 -46
- package/dist/contract/index.js +3 -2
- package/dist/dns/index.d.ts +36 -0
- package/dist/dns/index.d.ts.map +1 -0
- package/dist/dns/index.js +125 -0
- package/dist/dns/propagation.d.ts +19 -0
- package/dist/dns/propagation.d.ts.map +1 -0
- package/dist/dns/propagation.js +129 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/mcp/embeddings-loader.d.ts +18 -0
- package/dist/mcp/embeddings-loader.d.ts.map +1 -0
- package/dist/mcp/embeddings-loader.js +152 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/search/hybrid-search.d.ts.map +1 -1
- package/dist/mcp/search/hybrid-search.js +7 -21
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +8 -1
- package/dist/recker.d.ts +47 -0
- package/dist/recker.d.ts.map +1 -0
- package/dist/recker.js +99 -0
- package/dist/transport/base-udp.d.ts.map +1 -1
- package/dist/transport/base-udp.js +1 -0
- package/dist/transport/udp-response.d.ts +2 -2
- package/dist/transport/udp-response.d.ts.map +1 -1
- package/dist/transport/udp-response.js +2 -2
- package/dist/transport/udp.d.ts +4 -3
- package/dist/transport/udp.d.ts.map +1 -1
- package/dist/transport/udp.js +16 -7
- package/dist/types/udp.d.ts +1 -0
- package/dist/types/udp.d.ts.map +1 -1
- package/dist/udp/index.d.ts +2 -2
- package/dist/udp/index.d.ts.map +1 -1
- package/dist/udp/index.js +2 -2
- package/dist/utils/colors.d.ts +16 -0
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/colors.js +16 -0
- package/dist/utils/tls-inspector.d.ts +6 -0
- package/dist/utils/tls-inspector.d.ts.map +1 -1
- package/dist/utils/tls-inspector.js +35 -1
- package/dist/utils/whois.d.ts +18 -0
- package/dist/utils/whois.d.ts.map +1 -1
- package/dist/utils/whois.js +63 -0
- package/dist/webrtc/index.d.ts +80 -0
- package/dist/webrtc/index.d.ts.map +1 -0
- package/dist/webrtc/index.js +311 -0
- package/dist/websocket/client.d.ts +1 -1
- package/dist/websocket/client.d.ts.map +1 -1
- package/dist/websocket/client.js +1 -1
- package/package.json +2 -2
- package/dist/mcp/data/embeddings.json +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class UDPResponseWrapper {
|
|
2
2
|
_buffer;
|
|
3
3
|
_timings;
|
|
4
4
|
_connection;
|
|
@@ -85,7 +85,7 @@ export class UDPResponseImpl {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
clone() {
|
|
88
|
-
return new
|
|
88
|
+
return new UDPResponseWrapper(Buffer.from(this._buffer), {
|
|
89
89
|
timings: { ...this._timings },
|
|
90
90
|
connection: { ...this._connection },
|
|
91
91
|
url: this._url,
|
package/dist/transport/udp.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ReckerRequest, ReckerResponse } from '../types/index.js';
|
|
2
2
|
import type { UDPTransportOptions, SimpleUDPAPI } from '../types/udp.js';
|
|
3
3
|
import { BaseUDPTransport } from './base-udp.js';
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class UDPClient extends BaseUDPTransport {
|
|
5
5
|
private socket;
|
|
6
6
|
private baseUrl;
|
|
7
7
|
private udpOptions;
|
|
8
8
|
private multicastGroups;
|
|
9
9
|
constructor(baseUrl?: string, options?: UDPTransportOptions);
|
|
10
|
+
private log;
|
|
10
11
|
private getSocket;
|
|
11
12
|
private _socketBound;
|
|
12
13
|
dispatch(req: ReckerRequest): Promise<ReckerResponse>;
|
|
@@ -16,7 +17,7 @@ export declare class UDPTransportImpl extends BaseUDPTransport {
|
|
|
16
17
|
leaveMulticast(group: string): void;
|
|
17
18
|
close(): Promise<void>;
|
|
18
19
|
}
|
|
19
|
-
export declare function
|
|
20
|
+
export declare function createUDP(options?: UDPTransportOptions): UDPClient;
|
|
20
21
|
export declare const udp: SimpleUDPAPI;
|
|
21
|
-
export {
|
|
22
|
+
export { UDPClient as UDPTransport };
|
|
22
23
|
//# sourceMappingURL=udp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"udp.d.ts","sourceRoot":"","sources":["../../src/transport/udp.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EACV,mBAAmB,EAInB,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAwC,MAAM,eAAe,CAAC;
|
|
1
|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
2
2
|
import { BaseUDPTransport, udpRequestStorage } from './base-udp.js';
|
|
3
|
-
import {
|
|
3
|
+
import { UDPResponseWrapper } from './udp-response.js';
|
|
4
4
|
const DEFAULT_OPTIONS = {
|
|
5
5
|
timeout: 5000,
|
|
6
6
|
retransmissions: 3,
|
|
7
7
|
maxPacketSize: 65507,
|
|
8
8
|
observability: true,
|
|
9
|
+
debug: false,
|
|
9
10
|
broadcast: false,
|
|
10
11
|
multicastTTL: 1,
|
|
11
12
|
multicastLoopback: true,
|
|
12
13
|
type: 'udp4',
|
|
13
14
|
};
|
|
14
|
-
export class
|
|
15
|
+
export class UDPClient extends BaseUDPTransport {
|
|
15
16
|
socket = null;
|
|
16
17
|
baseUrl;
|
|
17
18
|
udpOptions;
|
|
@@ -26,6 +27,7 @@ export class UDPTransportImpl extends BaseUDPTransport {
|
|
|
26
27
|
retransmissions: options.retransmissions ?? DEFAULT_OPTIONS.retransmissions,
|
|
27
28
|
maxPacketSize: options.maxPacketSize ?? DEFAULT_OPTIONS.maxPacketSize,
|
|
28
29
|
observability: options.observability ?? DEFAULT_OPTIONS.observability,
|
|
30
|
+
debug: options.debug ?? DEFAULT_OPTIONS.debug,
|
|
29
31
|
localAddress: options.localAddress ?? '',
|
|
30
32
|
localPort: options.localPort ?? 0,
|
|
31
33
|
broadcast: options.broadcast ?? DEFAULT_OPTIONS.broadcast,
|
|
@@ -37,6 +39,11 @@ export class UDPTransportImpl extends BaseUDPTransport {
|
|
|
37
39
|
sendBufferSize: options.sendBufferSize,
|
|
38
40
|
};
|
|
39
41
|
}
|
|
42
|
+
log(message, ...args) {
|
|
43
|
+
if (this.udpOptions.debug) {
|
|
44
|
+
console.log(`[UDP] ${message}`, ...args);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
40
47
|
getSocket() {
|
|
41
48
|
if (!this.socket) {
|
|
42
49
|
this.socket = this.createSocket(this.udpOptions.type);
|
|
@@ -75,6 +82,7 @@ export class UDPTransportImpl extends BaseUDPTransport {
|
|
|
75
82
|
return udpRequestStorage.run(context, async () => {
|
|
76
83
|
const fullUrl = this.baseUrl ? `${this.baseUrl}${req.url}` : req.url;
|
|
77
84
|
const { host, port, path } = this.parseUrl(fullUrl);
|
|
85
|
+
this.log(`Dispatch to ${fullUrl}`);
|
|
78
86
|
if (!host || !port) {
|
|
79
87
|
throw new Error(`Invalid UDP URL: ${fullUrl}. Expected format: udp://host:port/path`);
|
|
80
88
|
}
|
|
@@ -114,7 +122,8 @@ export class UDPTransportImpl extends BaseUDPTransport {
|
|
|
114
122
|
const responseBuffer = await this.sendWithRetry(socket, body, targetPort, targetAddress, req.signal);
|
|
115
123
|
const timings = this.collectTimings();
|
|
116
124
|
const connection = this.collectConnection(socket);
|
|
117
|
-
|
|
125
|
+
this.log(`Response received in ${timings.total.toFixed(0)}ms (${responseBuffer.length} bytes)`);
|
|
126
|
+
return new UDPResponseWrapper(responseBuffer, {
|
|
118
127
|
timings,
|
|
119
128
|
connection,
|
|
120
129
|
url: fullUrl,
|
|
@@ -183,12 +192,12 @@ export class UDPTransportImpl extends BaseUDPTransport {
|
|
|
183
192
|
}
|
|
184
193
|
}
|
|
185
194
|
}
|
|
186
|
-
export function
|
|
187
|
-
return new
|
|
195
|
+
export function createUDP(options = {}) {
|
|
196
|
+
return new UDPClient('', options);
|
|
188
197
|
}
|
|
189
198
|
export const udp = {
|
|
190
199
|
async send(address, data, options = {}) {
|
|
191
|
-
const transport = new
|
|
200
|
+
const transport = new UDPClient('', options);
|
|
192
201
|
try {
|
|
193
202
|
const response = await transport.dispatch({
|
|
194
203
|
url: address.startsWith('udp://') ? address : `udp://${address}`,
|
|
@@ -257,4 +266,4 @@ export const udp = {
|
|
|
257
266
|
});
|
|
258
267
|
},
|
|
259
268
|
};
|
|
260
|
-
export {
|
|
269
|
+
export { UDPClient as UDPTransport };
|
package/dist/types/udp.d.ts
CHANGED
package/dist/types/udp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"udp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AY;IAI3B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAKzF,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,mBAAmB,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GACnD,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAKjC,QAAQ,CACN,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,mBAAmB,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GACnD,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CAClC"}
|
package/dist/udp/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { UDPClient, UDPTransport, createUDP, udp } from '../transport/udp.js';
|
|
2
|
+
export { UDPResponseWrapper, StreamingUDPResponse } from '../transport/udp-response.js';
|
|
3
3
|
export { BaseUDPTransport, udpRequestStorage } from '../transport/base-udp.js';
|
|
4
4
|
export type { UDPRequestContext } from '../transport/base-udp.js';
|
|
5
5
|
export type { UDPTimings, DTLSTimings, QUICTimings, UDPConnection, DTLSConnection, QUICConnection, BaseUDPTransportOptions, UDPTransportOptions, DTLSTransportOptions, QUICTransportOptions, UDPRequestOptions, UDPRequest, UDPResponse, UDPTransport as UDPTransportInterface, DTLSTransportInterface, QUICTransportInterface, UDPBatchResult, UDPDiscoveryResult, SimpleUDPAPI, } from '../types/udp.js';
|
package/dist/udp/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/udp/index.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/udp/index.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAG9E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAGxF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,YAAY,EAEV,UAAU,EACV,WAAW,EACX,WAAW,EAEX,aAAa,EACb,cAAc,EACd,cAAc,EAEd,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EAEpB,iBAAiB,EACjB,UAAU,EACV,WAAW,EAEX,YAAY,IAAI,qBAAqB,EACrC,sBAAsB,EACtB,sBAAsB,EAEtB,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,iBAAiB,CAAC"}
|
package/dist/udp/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { UDPClient, UDPTransport, createUDP, udp } from '../transport/udp.js';
|
|
2
|
+
export { UDPResponseWrapper, StreamingUDPResponse } from '../transport/udp-response.js';
|
|
3
3
|
export { BaseUDPTransport, udpRequestStorage } from '../transport/base-udp.js';
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ export declare const magenta: (s: string | number) => string;
|
|
|
9
9
|
export declare const cyan: (s: string | number) => string;
|
|
10
10
|
export declare const white: (s: string | number) => string;
|
|
11
11
|
export declare const gray: (s: string | number) => string;
|
|
12
|
+
export declare const bgBlack: (s: string | number) => string;
|
|
13
|
+
export declare const bgRed: (s: string | number) => string;
|
|
14
|
+
export declare const bgGreen: (s: string | number) => string;
|
|
15
|
+
export declare const bgYellow: (s: string | number) => string;
|
|
16
|
+
export declare const bgBlue: (s: string | number) => string;
|
|
17
|
+
export declare const bgMagenta: (s: string | number) => string;
|
|
18
|
+
export declare const bgCyan: (s: string | number) => string;
|
|
19
|
+
export declare const bgWhite: (s: string | number) => string;
|
|
12
20
|
declare const colors: {
|
|
13
21
|
reset: (s: string) => string;
|
|
14
22
|
bold: (s: string | number) => string;
|
|
@@ -21,6 +29,14 @@ declare const colors: {
|
|
|
21
29
|
cyan: (s: string | number) => string;
|
|
22
30
|
white: (s: string | number) => string;
|
|
23
31
|
gray: (s: string | number) => string;
|
|
32
|
+
bgBlack: (s: string | number) => string;
|
|
33
|
+
bgRed: (s: string | number) => string;
|
|
34
|
+
bgGreen: (s: string | number) => string;
|
|
35
|
+
bgYellow: (s: string | number) => string;
|
|
36
|
+
bgBlue: (s: string | number) => string;
|
|
37
|
+
bgMagenta: (s: string | number) => string;
|
|
38
|
+
bgCyan: (s: string | number) => string;
|
|
39
|
+
bgWhite: (s: string | number) => string;
|
|
24
40
|
grey: (s: string | number) => string;
|
|
25
41
|
};
|
|
26
42
|
export default colors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,KAAK,MAAmB,MAAM,WAA4C,CAAC;AACxF,eAAO,MAAM,IAAI,MAfY,MAAM,GAAG,MAAM,WAeb,CAAC;AAGhC,eAAO,MAAM,KAAK,MAlBW,MAAM,GAAG,MAAM,WAkBX,CAAC;AAClC,eAAO,MAAM,GAAG,MAnBa,MAAM,GAAG,MAAM,WAmBb,CAAC;AAChC,eAAO,MAAM,KAAK,MApBW,MAAM,GAAG,MAAM,WAoBX,CAAC;AAClC,eAAO,MAAM,MAAM,MArBU,MAAM,GAAG,MAAM,WAqBV,CAAC;AACnC,eAAO,MAAM,IAAI,MAtBY,MAAM,GAAG,MAAM,WAsBZ,CAAC;AACjC,eAAO,MAAM,OAAO,MAvBS,MAAM,GAAG,MAAM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CR,CAAC;AACrC,eAAO,MAAM,MAAM,MAjCU,MAAM,GAAG,MAAM,WAiCV,CAAC;AACnC,eAAO,MAAM,SAAS,MAlCO,MAAM,GAAG,MAAM,WAkCP,CAAC;AACtC,eAAO,MAAM,MAAM,MAnCU,MAAM,GAAG,MAAM,WAmCV,CAAC;AACnC,eAAO,MAAM,OAAO,MApCS,MAAM,GAAG,MAAM,WAoCT,CAAC;AAGpC,QAAA,MAAM,MAAM;eAzByB,MAAM;cAdd,MAAM,GAAG,MAAM;eAAf,MAAM,GAAG,MAAM;aAAf,MAAM,GAAG,MAAM;eAAf,MAAM,GAAG,MAAM;gBAAf,MAAM,GAAG,MAAM;cAAf,MAAM,GAAG,MAAM;iBAAf,MAAM,GAAG,MAAM;cAAf,MAAM,GAAG,MAAM;eAAf,MAAM,GAAG,MAAM;cAAf,MAAM,GAAG,MAAM;iBAAf,MAAM,GAAG,MAAM;eAAf,MAAM,GAAG,MAAM;iBAAf,MAAM,GAAG,MAAM;kBAAf,MAAM,GAAG,MAAM;gBAAf,MAAM,GAAG,MAAM;mBAAf,MAAM,GAAG,MAAM;gBAAf,MAAM,GAAG,MAAM;iBAAf,MAAM,GAAG,MAAM;cAAf,MAAM,GAAG,MAAM;CA8D3C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/utils/colors.js
CHANGED
|
@@ -33,6 +33,14 @@ export const magenta = code(35, 39);
|
|
|
33
33
|
export const cyan = code(36, 39);
|
|
34
34
|
export const white = code(37, 39);
|
|
35
35
|
export const gray = code(90, 39);
|
|
36
|
+
export const bgBlack = code(40, 49);
|
|
37
|
+
export const bgRed = code(41, 49);
|
|
38
|
+
export const bgGreen = code(42, 49);
|
|
39
|
+
export const bgYellow = code(43, 49);
|
|
40
|
+
export const bgBlue = code(44, 49);
|
|
41
|
+
export const bgMagenta = code(45, 49);
|
|
42
|
+
export const bgCyan = code(46, 49);
|
|
43
|
+
export const bgWhite = code(47, 49);
|
|
36
44
|
const colors = {
|
|
37
45
|
reset,
|
|
38
46
|
bold,
|
|
@@ -45,6 +53,14 @@ const colors = {
|
|
|
45
53
|
cyan,
|
|
46
54
|
white,
|
|
47
55
|
gray,
|
|
56
|
+
bgBlack,
|
|
57
|
+
bgRed,
|
|
58
|
+
bgGreen,
|
|
59
|
+
bgYellow,
|
|
60
|
+
bgBlue,
|
|
61
|
+
bgMagenta,
|
|
62
|
+
bgCyan,
|
|
63
|
+
bgWhite,
|
|
48
64
|
grey: gray,
|
|
49
65
|
};
|
|
50
66
|
export default colors;
|
|
@@ -16,6 +16,12 @@ export interface TLSInfo {
|
|
|
16
16
|
} | null;
|
|
17
17
|
authorized: boolean;
|
|
18
18
|
authorizationError?: Error;
|
|
19
|
+
altNames?: string[];
|
|
20
|
+
pubkey: {
|
|
21
|
+
algo: string;
|
|
22
|
+
size: number;
|
|
23
|
+
} | null;
|
|
24
|
+
extKeyUsage?: string[];
|
|
19
25
|
}
|
|
20
26
|
export declare function inspectTLS(host: string, port?: number, options?: ConnectionOptions): Promise<TLSInfo>;
|
|
21
27
|
//# sourceMappingURL=tls-inspector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tls-inspector.d.ts","sourceRoot":"","sources":["../../src/utils/tls-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"tls-inspector.d.ts","sourceRoot":"","sources":["../../src/utils/tls-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGjE,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,IAAI,CAAC;IACT,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAE3B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAkF9G"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { connect } from 'node:tls';
|
|
2
|
+
import * as crypto from 'node:crypto';
|
|
2
3
|
export function inspectTLS(host, port = 443, options = {}) {
|
|
3
4
|
return new Promise((resolve, reject) => {
|
|
4
5
|
const socket = connect(port, host, { ...options, servername: host }, () => {
|
|
@@ -11,6 +12,36 @@ export function inspectTLS(host, port = 443, options = {}) {
|
|
|
11
12
|
const validTo = new Date(cert.valid_to);
|
|
12
13
|
const now = new Date();
|
|
13
14
|
const daysRemaining = Math.floor((validTo.getTime() - now.getTime()) / (1000 * 60 * 60 * 24));
|
|
15
|
+
const altNames = cert.subjectaltname
|
|
16
|
+
? cert.subjectaltname.split(', ').map(s => s.replace(/^DNS:|^IP Address:/, '')).filter(Boolean)
|
|
17
|
+
: [];
|
|
18
|
+
let pubkey = null;
|
|
19
|
+
if (cert.pubkey) {
|
|
20
|
+
try {
|
|
21
|
+
const keyObject = crypto.createPublicKey(cert.pubkey);
|
|
22
|
+
let keySize;
|
|
23
|
+
const keyAlgo = keyObject.asymmetricKeyType || 'unknown';
|
|
24
|
+
if (keyObject.asymmetricKeyDetails) {
|
|
25
|
+
if (keyObject.asymmetricKeyDetails.modulusLength) {
|
|
26
|
+
keySize = keyObject.asymmetricKeyDetails.modulusLength;
|
|
27
|
+
}
|
|
28
|
+
else if (keyObject.asymmetricKeyDetails.namedCurve) {
|
|
29
|
+
const curve = keyObject.asymmetricKeyDetails.namedCurve;
|
|
30
|
+
if (curve.includes('256') || curve.includes('p256'))
|
|
31
|
+
keySize = 256;
|
|
32
|
+
else if (curve.includes('384') || curve.includes('p384'))
|
|
33
|
+
keySize = 384;
|
|
34
|
+
else if (curve.includes('521') || curve.includes('p521'))
|
|
35
|
+
keySize = 521;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (keySize) {
|
|
39
|
+
pubkey = { algo: keyAlgo, size: keySize };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
14
45
|
const info = {
|
|
15
46
|
valid: now >= validFrom && now <= validTo,
|
|
16
47
|
validFrom,
|
|
@@ -24,7 +55,10 @@ export function inspectTLS(host, port = 443, options = {}) {
|
|
|
24
55
|
protocol: socket.getProtocol(),
|
|
25
56
|
cipher: socket.getCipher(),
|
|
26
57
|
authorized: socket.authorized,
|
|
27
|
-
authorizationError: socket.authorizationError
|
|
58
|
+
authorizationError: socket.authorizationError,
|
|
59
|
+
altNames,
|
|
60
|
+
pubkey,
|
|
61
|
+
extKeyUsage: cert.ext_key_usage || []
|
|
28
62
|
};
|
|
29
63
|
socket.end();
|
|
30
64
|
resolve(info);
|
package/dist/utils/whois.d.ts
CHANGED
|
@@ -12,4 +12,22 @@ export interface WhoisResult {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function whois(query: string, options?: WhoisOptions): Promise<WhoisResult>;
|
|
14
14
|
export declare function isDomainAvailable(domain: string, options?: WhoisOptions): Promise<boolean>;
|
|
15
|
+
export interface WhoisClientOptions {
|
|
16
|
+
server?: string;
|
|
17
|
+
port?: number;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
follow?: boolean;
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare class WhoisClient {
|
|
23
|
+
private options;
|
|
24
|
+
constructor(options?: WhoisClientOptions);
|
|
25
|
+
private log;
|
|
26
|
+
lookup(query: string, options?: WhoisOptions): Promise<WhoisResult>;
|
|
27
|
+
isAvailable(domain: string): Promise<boolean>;
|
|
28
|
+
getRegistrar(domain: string): Promise<string | null>;
|
|
29
|
+
getExpiration(domain: string): Promise<Date | null>;
|
|
30
|
+
getNameServers(domain: string): Promise<string[]>;
|
|
31
|
+
}
|
|
32
|
+
export declare function createWhois(options?: WhoisClientOptions): WhoisClient;
|
|
15
33
|
//# sourceMappingURL=whois.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whois.d.ts","sourceRoot":"","sources":["../../src/utils/whois.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAK3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAKhB,IAAI,CAAC,EAAE,MAAM,CAAC;IAMd,OAAO,CAAC,EAAE,MAAM,CAAC;IAMjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAI1B,GAAG,EAAE,MAAM,CAAC;IAKZ,KAAK,EAAE,MAAM,CAAC;IAKd,MAAM,EAAE,MAAM,CAAC;IAKf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CACzC;AAmND,wBAAsB,KAAK,CACzB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAmCtB;AAMD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,C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Y,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAUpD,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAgBnD,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAKxD;AAoBD,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,WAAW,CAErE"}
|
package/dist/utils/whois.js
CHANGED
|
@@ -181,3 +181,66 @@ export async function isDomainAvailable(domain, options) {
|
|
|
181
181
|
return false;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
+
export class WhoisClient {
|
|
185
|
+
options;
|
|
186
|
+
constructor(options = {}) {
|
|
187
|
+
this.options = {
|
|
188
|
+
server: options.server ?? '',
|
|
189
|
+
port: options.port ?? 43,
|
|
190
|
+
timeout: options.timeout ?? 10000,
|
|
191
|
+
follow: options.follow ?? true,
|
|
192
|
+
debug: options.debug ?? false,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
log(message, ...args) {
|
|
196
|
+
if (this.options.debug) {
|
|
197
|
+
console.log(`[WHOIS] ${message}`, ...args);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async lookup(query, options) {
|
|
201
|
+
this.log(`Looking up: ${query}`);
|
|
202
|
+
const start = Date.now();
|
|
203
|
+
const result = await whois(query, {
|
|
204
|
+
server: options?.server ?? (this.options.server || undefined),
|
|
205
|
+
port: options?.port ?? this.options.port,
|
|
206
|
+
timeout: options?.timeout ?? this.options.timeout,
|
|
207
|
+
follow: options?.follow ?? this.options.follow,
|
|
208
|
+
});
|
|
209
|
+
this.log(`Lookup completed in ${Date.now() - start}ms from ${result.server}`);
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
async isAvailable(domain) {
|
|
213
|
+
this.log(`Checking availability: ${domain}`);
|
|
214
|
+
return isDomainAvailable(domain, {
|
|
215
|
+
server: this.options.server || undefined,
|
|
216
|
+
port: this.options.port,
|
|
217
|
+
timeout: this.options.timeout,
|
|
218
|
+
follow: this.options.follow,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
async getRegistrar(domain) {
|
|
222
|
+
const result = await this.lookup(domain);
|
|
223
|
+
return result.data['registrar'] ||
|
|
224
|
+
result.data['sponsoring registrar'] ||
|
|
225
|
+
null;
|
|
226
|
+
}
|
|
227
|
+
async getExpiration(domain) {
|
|
228
|
+
const result = await this.lookup(domain);
|
|
229
|
+
const expiry = result.data['registry expiry date'] ||
|
|
230
|
+
result.data['expiration date'] ||
|
|
231
|
+
result.data['expiry date'];
|
|
232
|
+
if (expiry) {
|
|
233
|
+
const date = new Date(expiry);
|
|
234
|
+
return isNaN(date.getTime()) ? null : date;
|
|
235
|
+
}
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
async getNameServers(domain) {
|
|
239
|
+
const result = await this.lookup(domain);
|
|
240
|
+
const ns = result.data['name server'] || result.data['nserver'] || [];
|
|
241
|
+
return Array.isArray(ns) ? ns : [ns];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
export function createWhois(options) {
|
|
245
|
+
return new WhoisClient(options);
|
|
246
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
export interface IceServer {
|
|
3
|
+
urls: string | string[];
|
|
4
|
+
username?: string;
|
|
5
|
+
credential?: string;
|
|
6
|
+
}
|
|
7
|
+
export type SignalingMessageType = 'offer' | 'answer' | 'ice-candidate' | 'bye';
|
|
8
|
+
export interface SignalingMessage {
|
|
9
|
+
type: SignalingMessageType;
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
payload: RTCSessionDescriptionInit | RTCIceCandidateInit | null;
|
|
13
|
+
}
|
|
14
|
+
export interface SignalingChannelOptions {
|
|
15
|
+
send: (message: SignalingMessage) => void | Promise<void>;
|
|
16
|
+
onMessage: (handler: (message: SignalingMessage) => void) => void;
|
|
17
|
+
onClose?: (handler: () => void) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface WebRTCClientOptions {
|
|
20
|
+
peerId?: string;
|
|
21
|
+
signaling: SignalingChannelOptions;
|
|
22
|
+
iceServers?: IceServer[];
|
|
23
|
+
dataChannelOptions?: RTCDataChannelInit;
|
|
24
|
+
connectionTimeout?: number;
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export type ConnectionState = 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed';
|
|
28
|
+
export interface PeerInfo {
|
|
29
|
+
peerId: string;
|
|
30
|
+
state: ConnectionState;
|
|
31
|
+
dataChannelState: RTCDataChannelState | 'none';
|
|
32
|
+
localCandidates: number;
|
|
33
|
+
remoteCandidates: number;
|
|
34
|
+
connectedAt?: Date;
|
|
35
|
+
}
|
|
36
|
+
export declare class SignalingChannel extends EventEmitter {
|
|
37
|
+
private options;
|
|
38
|
+
constructor(options: SignalingChannelOptions);
|
|
39
|
+
send(message: SignalingMessage): Promise<void>;
|
|
40
|
+
sendOffer(to: string, from: string, offer: RTCSessionDescriptionInit): Promise<void>;
|
|
41
|
+
sendAnswer(to: string, from: string, answer: RTCSessionDescriptionInit): Promise<void>;
|
|
42
|
+
sendIceCandidate(to: string, from: string, candidate: RTCIceCandidateInit): Promise<void>;
|
|
43
|
+
sendBye(to: string, from: string): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export declare class WebRTCClient extends EventEmitter {
|
|
46
|
+
private peerId;
|
|
47
|
+
private signaling;
|
|
48
|
+
private iceServers;
|
|
49
|
+
private dataChannelOptions;
|
|
50
|
+
private connectionTimeout;
|
|
51
|
+
private debug;
|
|
52
|
+
private connections;
|
|
53
|
+
private dataChannels;
|
|
54
|
+
private pendingCandidates;
|
|
55
|
+
constructor(options: WebRTCClientOptions);
|
|
56
|
+
getPeerId(): string;
|
|
57
|
+
getPeerInfo(peerId: string): PeerInfo | null;
|
|
58
|
+
getConnectedPeers(): string[];
|
|
59
|
+
connect(remotePeerId: string): Promise<void>;
|
|
60
|
+
disconnect(remotePeerId: string): void;
|
|
61
|
+
disconnectAll(): void;
|
|
62
|
+
send(data: unknown, remotePeerId?: string): void;
|
|
63
|
+
sendBinary(data: ArrayBuffer | Uint8Array, remotePeerId?: string): void;
|
|
64
|
+
private generatePeerId;
|
|
65
|
+
private log;
|
|
66
|
+
private createPeerConnection;
|
|
67
|
+
private setupDataChannel;
|
|
68
|
+
private setupSignalingHandlers;
|
|
69
|
+
private addPendingCandidates;
|
|
70
|
+
private waitForConnection;
|
|
71
|
+
}
|
|
72
|
+
export declare const DEFAULT_ICE_SERVERS: IceServer[];
|
|
73
|
+
export declare function isWebRTCAvailable(): boolean;
|
|
74
|
+
export declare function getWebRTCSupport(): {
|
|
75
|
+
available: boolean;
|
|
76
|
+
dataChannels: boolean;
|
|
77
|
+
media: boolean;
|
|
78
|
+
environment: 'browser' | 'node' | 'unknown';
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webrtc/index.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAS3C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAKD,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,QAAQ,GAAG,eAAe,GAAG,KAAK,CAAC;AAKhF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,yBAAyB,GAAG,mBAAmB,GAAG,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