recker 1.0.20-next.613e553 → 1.0.20-next.963881c
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/cli/index.d.ts +0 -1
- package/dist/cli/index.js +290 -2
- package/dist/cli/tui/shell.js +1 -1
- package/dist/plugins/cache.js +1 -1
- package/dist/plugins/retry.js +2 -2
- package/dist/transport/undici.js +1 -1
- package/dist/utils/dns-toolkit.js +1 -1
- package/dist/utils/dns.js +2 -2
- package/dist/utils/optional-require.js +1 -1
- package/dist/webrtc/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
import { program } from 'commander';
|
|
3
2
|
import { promises as fs } from 'node:fs';
|
|
4
3
|
import { join } from 'node:path';
|
|
@@ -725,7 +724,7 @@ ${colors.gray('Status:')} ${statusIcon}
|
|
|
725
724
|
.command('generate-dmarc')
|
|
726
725
|
.description('Generate a DMARC record interactively')
|
|
727
726
|
.option('-p, --policy <policy>', 'Policy: none, quarantine, reject', 'none')
|
|
728
|
-
.option('
|
|
727
|
+
.option('--subdomain-policy <policy>', 'Subdomain policy')
|
|
729
728
|
.option('--pct <percent>', 'Percentage of emails to apply policy', '100')
|
|
730
729
|
.option('--rua <emails>', 'Aggregate report email(s), comma-separated')
|
|
731
730
|
.option('--ruf <emails>', 'Forensic report email(s), comma-separated')
|
|
@@ -880,6 +879,295 @@ ${colors.bold(colors.yellow('Examples:'))}
|
|
|
880
879
|
const { startLoadDashboard } = await import('./tui/load-dashboard.js');
|
|
881
880
|
await startLoadDashboard({ url, users, duration, mode, http2, rampUp });
|
|
882
881
|
});
|
|
882
|
+
const serve = program.command('serve').description('Start mock servers for testing protocols');
|
|
883
|
+
serve
|
|
884
|
+
.command('http')
|
|
885
|
+
.description('Start a mock HTTP server')
|
|
886
|
+
.option('-p, --port <number>', 'Port to listen on', '3000')
|
|
887
|
+
.option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
|
|
888
|
+
.option('--echo', 'Echo request body back in response')
|
|
889
|
+
.option('--delay <ms>', 'Add delay to responses (milliseconds)', '0')
|
|
890
|
+
.option('--cors', 'Enable CORS', true)
|
|
891
|
+
.addHelpText('after', `
|
|
892
|
+
${colors.bold(colors.yellow('Examples:'))}
|
|
893
|
+
${colors.green('$ rek serve http')} ${colors.gray('Start on port 3000')}
|
|
894
|
+
${colors.green('$ rek serve http -p 8080')} ${colors.gray('Start on port 8080')}
|
|
895
|
+
${colors.green('$ rek serve http --echo')} ${colors.gray('Echo mode')}
|
|
896
|
+
${colors.green('$ rek serve http --delay 500')} ${colors.gray('Add 500ms delay')}
|
|
897
|
+
`)
|
|
898
|
+
.action(async (options) => {
|
|
899
|
+
const { MockHttpServer } = await import('../testing/mock-http-server.js');
|
|
900
|
+
const server = await MockHttpServer.create({
|
|
901
|
+
port: parseInt(options.port),
|
|
902
|
+
host: options.host,
|
|
903
|
+
delay: parseInt(options.delay),
|
|
904
|
+
cors: options.cors,
|
|
905
|
+
});
|
|
906
|
+
if (options.echo) {
|
|
907
|
+
server.any('/*', (req) => ({
|
|
908
|
+
status: 200,
|
|
909
|
+
body: {
|
|
910
|
+
method: req.method,
|
|
911
|
+
path: req.path,
|
|
912
|
+
query: req.query,
|
|
913
|
+
headers: req.headers,
|
|
914
|
+
body: req.body,
|
|
915
|
+
},
|
|
916
|
+
}));
|
|
917
|
+
}
|
|
918
|
+
console.log(colors.green(`
|
|
919
|
+
┌─────────────────────────────────────────────┐
|
|
920
|
+
│ ${colors.bold('Recker Mock HTTP Server')} │
|
|
921
|
+
├─────────────────────────────────────────────┤
|
|
922
|
+
│ URL: ${colors.cyan(server.url.padEnd(37))}│
|
|
923
|
+
│ Mode: ${colors.yellow((options.echo ? 'Echo' : 'Default').padEnd(36))}│
|
|
924
|
+
│ Delay: ${colors.gray((options.delay + 'ms').padEnd(35))}│
|
|
925
|
+
├─────────────────────────────────────────────┤
|
|
926
|
+
│ Press ${colors.bold('Ctrl+C')} to stop │
|
|
927
|
+
└─────────────────────────────────────────────┘
|
|
928
|
+
`));
|
|
929
|
+
server.on('request', (req) => {
|
|
930
|
+
console.log(colors.gray(`${new Date().toISOString()} `) + colors.cyan(req.method.padEnd(7)) + req.path);
|
|
931
|
+
});
|
|
932
|
+
process.on('SIGINT', async () => {
|
|
933
|
+
console.log(colors.yellow('\nShutting down...'));
|
|
934
|
+
await server.stop();
|
|
935
|
+
process.exit(0);
|
|
936
|
+
});
|
|
937
|
+
});
|
|
938
|
+
serve
|
|
939
|
+
.command('websocket')
|
|
940
|
+
.alias('ws')
|
|
941
|
+
.description('Start a mock WebSocket server')
|
|
942
|
+
.option('-p, --port <number>', 'Port to listen on', '8080')
|
|
943
|
+
.option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
|
|
944
|
+
.option('--echo', 'Echo messages back (default: true)', true)
|
|
945
|
+
.option('--no-echo', 'Disable echo mode')
|
|
946
|
+
.option('--delay <ms>', 'Add delay to responses (milliseconds)', '0')
|
|
947
|
+
.addHelpText('after', `
|
|
948
|
+
${colors.bold(colors.yellow('Examples:'))}
|
|
949
|
+
${colors.green('$ rek serve websocket')} ${colors.gray('Start on port 8080')}
|
|
950
|
+
${colors.green('$ rek serve ws -p 9000')} ${colors.gray('Start on port 9000')}
|
|
951
|
+
${colors.green('$ rek serve ws --no-echo')} ${colors.gray('Disable echo')}
|
|
952
|
+
`)
|
|
953
|
+
.action(async (options) => {
|
|
954
|
+
const { MockWebSocketServer } = await import('../testing/mock-websocket-server.js');
|
|
955
|
+
const server = await MockWebSocketServer.create({
|
|
956
|
+
port: parseInt(options.port),
|
|
957
|
+
host: options.host,
|
|
958
|
+
echo: options.echo,
|
|
959
|
+
delay: parseInt(options.delay),
|
|
960
|
+
});
|
|
961
|
+
console.log(colors.green(`
|
|
962
|
+
┌─────────────────────────────────────────────┐
|
|
963
|
+
│ ${colors.bold('Recker Mock WebSocket Server')} │
|
|
964
|
+
├─────────────────────────────────────────────┤
|
|
965
|
+
│ URL: ${colors.cyan(server.url.padEnd(37))}│
|
|
966
|
+
│ Echo: ${colors.yellow((options.echo ? 'Enabled' : 'Disabled').padEnd(36))}│
|
|
967
|
+
│ Delay: ${colors.gray((options.delay + 'ms').padEnd(35))}│
|
|
968
|
+
├─────────────────────────────────────────────┤
|
|
969
|
+
│ Press ${colors.bold('Ctrl+C')} to stop │
|
|
970
|
+
└─────────────────────────────────────────────┘
|
|
971
|
+
`));
|
|
972
|
+
server.on('connection', (client) => {
|
|
973
|
+
console.log(colors.green(`+ Connected: ${client.id}`));
|
|
974
|
+
});
|
|
975
|
+
server.on('message', (msg, client) => {
|
|
976
|
+
const data = msg.data.toString().slice(0, 50);
|
|
977
|
+
console.log(colors.gray(`${new Date().toISOString()} `) + colors.cyan(client.id) + ` ${data}${msg.data.toString().length > 50 ? '...' : ''}`);
|
|
978
|
+
});
|
|
979
|
+
server.on('disconnect', (client) => {
|
|
980
|
+
console.log(colors.red(`- Disconnected: ${client.id}`));
|
|
981
|
+
});
|
|
982
|
+
process.on('SIGINT', async () => {
|
|
983
|
+
console.log(colors.yellow('\nShutting down...'));
|
|
984
|
+
await server.stop();
|
|
985
|
+
process.exit(0);
|
|
986
|
+
});
|
|
987
|
+
});
|
|
988
|
+
serve
|
|
989
|
+
.command('sse')
|
|
990
|
+
.description('Start a mock SSE (Server-Sent Events) server')
|
|
991
|
+
.option('-p, --port <number>', 'Port to listen on', '8081')
|
|
992
|
+
.option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
|
|
993
|
+
.option('--path <string>', 'SSE endpoint path', '/events')
|
|
994
|
+
.option('--heartbeat <ms>', 'Send heartbeat every N ms (0 = disabled)', '0')
|
|
995
|
+
.addHelpText('after', `
|
|
996
|
+
${colors.bold(colors.yellow('Examples:'))}
|
|
997
|
+
${colors.green('$ rek serve sse')} ${colors.gray('Start on port 8081')}
|
|
998
|
+
${colors.green('$ rek serve sse -p 9000')} ${colors.gray('Start on port 9000')}
|
|
999
|
+
${colors.green('$ rek serve sse --heartbeat 5000')} ${colors.gray('Send heartbeat every 5s')}
|
|
1000
|
+
|
|
1001
|
+
${colors.bold(colors.yellow('Interactive Commands:'))}
|
|
1002
|
+
Type a message and press Enter to broadcast it to all clients.
|
|
1003
|
+
`)
|
|
1004
|
+
.action(async (options) => {
|
|
1005
|
+
const { MockSSEServer } = await import('../testing/mock-sse-server.js');
|
|
1006
|
+
const readline = await import('node:readline');
|
|
1007
|
+
const server = await MockSSEServer.create({
|
|
1008
|
+
port: parseInt(options.port),
|
|
1009
|
+
host: options.host,
|
|
1010
|
+
path: options.path,
|
|
1011
|
+
});
|
|
1012
|
+
if (parseInt(options.heartbeat) > 0) {
|
|
1013
|
+
server.startPeriodicEvents('heartbeat', parseInt(options.heartbeat));
|
|
1014
|
+
}
|
|
1015
|
+
console.log(colors.green(`
|
|
1016
|
+
┌─────────────────────────────────────────────┐
|
|
1017
|
+
│ ${colors.bold('Recker Mock SSE Server')} │
|
|
1018
|
+
├─────────────────────────────────────────────┤
|
|
1019
|
+
│ URL: ${colors.cyan(server.url.padEnd(37))}│
|
|
1020
|
+
│ Heartbeat: ${colors.yellow((options.heartbeat === '0' ? 'Disabled' : options.heartbeat + 'ms').padEnd(31))}│
|
|
1021
|
+
├─────────────────────────────────────────────┤
|
|
1022
|
+
│ Type message + Enter to broadcast │
|
|
1023
|
+
│ Press ${colors.bold('Ctrl+C')} to stop │
|
|
1024
|
+
└─────────────────────────────────────────────┘
|
|
1025
|
+
`));
|
|
1026
|
+
server.on('connection', (client) => {
|
|
1027
|
+
console.log(colors.green(`+ Connected: ${client.id}`));
|
|
1028
|
+
});
|
|
1029
|
+
server.on('disconnect', (client) => {
|
|
1030
|
+
console.log(colors.red(`- Disconnected: ${client.id}`));
|
|
1031
|
+
});
|
|
1032
|
+
const rl = readline.createInterface({
|
|
1033
|
+
input: process.stdin,
|
|
1034
|
+
output: process.stdout,
|
|
1035
|
+
});
|
|
1036
|
+
rl.on('line', (line) => {
|
|
1037
|
+
if (line.trim()) {
|
|
1038
|
+
const sent = server.sendData(line.trim());
|
|
1039
|
+
console.log(colors.gray(`Broadcast to ${sent} client(s): ${line.trim()}`));
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
process.on('SIGINT', async () => {
|
|
1043
|
+
console.log(colors.yellow('\nShutting down...'));
|
|
1044
|
+
rl.close();
|
|
1045
|
+
await server.stop();
|
|
1046
|
+
process.exit(0);
|
|
1047
|
+
});
|
|
1048
|
+
});
|
|
1049
|
+
serve
|
|
1050
|
+
.command('hls')
|
|
1051
|
+
.description('Start a mock HLS streaming server')
|
|
1052
|
+
.option('-p, --port <number>', 'Port to listen on', '8082')
|
|
1053
|
+
.option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
|
|
1054
|
+
.option('--mode <type>', 'Stream mode: vod, live, event', 'vod')
|
|
1055
|
+
.option('--segments <number>', 'Number of segments (VOD mode)', '10')
|
|
1056
|
+
.option('--duration <seconds>', 'Segment duration in seconds', '6')
|
|
1057
|
+
.option('--qualities <list>', 'Comma-separated quality variants', '720p,480p,360p')
|
|
1058
|
+
.addHelpText('after', `
|
|
1059
|
+
${colors.bold(colors.yellow('Examples:'))}
|
|
1060
|
+
${colors.green('$ rek serve hls')} ${colors.gray('Start VOD server')}
|
|
1061
|
+
${colors.green('$ rek serve hls --mode live')} ${colors.gray('Start live stream')}
|
|
1062
|
+
${colors.green('$ rek serve hls --segments 20')} ${colors.gray('VOD with 20 segments')}
|
|
1063
|
+
${colors.green('$ rek serve hls --qualities 1080p,720p,480p')}
|
|
1064
|
+
|
|
1065
|
+
${colors.bold(colors.yellow('Endpoints:'))}
|
|
1066
|
+
${colors.cyan('/master.m3u8')} Master playlist (multi-quality)
|
|
1067
|
+
${colors.cyan('/playlist.m3u8')} Single quality playlist
|
|
1068
|
+
${colors.cyan('/<quality>/playlist.m3u8')} Quality-specific playlist
|
|
1069
|
+
`)
|
|
1070
|
+
.action(async (options) => {
|
|
1071
|
+
const { MockHlsServer } = await import('../testing/mock-hls-server.js');
|
|
1072
|
+
const http = await import('node:http');
|
|
1073
|
+
const port = parseInt(options.port);
|
|
1074
|
+
const host = options.host;
|
|
1075
|
+
const qualities = options.qualities.split(',').map(q => q.trim());
|
|
1076
|
+
const resolutions = ['1920x1080', '1280x720', '854x480', '640x360', '426x240'];
|
|
1077
|
+
const bandwidths = [5000000, 2500000, 1400000, 800000, 500000];
|
|
1078
|
+
const variants = qualities.map((name, i) => ({
|
|
1079
|
+
name,
|
|
1080
|
+
bandwidth: bandwidths[i] || 500000,
|
|
1081
|
+
resolution: resolutions[i] || '640x360',
|
|
1082
|
+
}));
|
|
1083
|
+
const baseUrl = `http://${host}:${port}`;
|
|
1084
|
+
const hlsServer = await MockHlsServer.create({
|
|
1085
|
+
baseUrl,
|
|
1086
|
+
mode: options.mode,
|
|
1087
|
+
segmentCount: parseInt(options.segments),
|
|
1088
|
+
segmentDuration: parseInt(options.duration),
|
|
1089
|
+
multiQuality: variants.length > 1,
|
|
1090
|
+
variants: variants.length > 1 ? variants : undefined,
|
|
1091
|
+
});
|
|
1092
|
+
const httpServer = http.createServer(async (req, res) => {
|
|
1093
|
+
const url = `${baseUrl}${req.url}`;
|
|
1094
|
+
try {
|
|
1095
|
+
const response = await hlsServer.transport.dispatch({ url, method: req.method || 'GET' });
|
|
1096
|
+
res.statusCode = response.status;
|
|
1097
|
+
response.headers.forEach((value, key) => {
|
|
1098
|
+
res.setHeader(key, value);
|
|
1099
|
+
});
|
|
1100
|
+
const body = await response.arrayBuffer();
|
|
1101
|
+
res.end(Buffer.from(body));
|
|
1102
|
+
}
|
|
1103
|
+
catch {
|
|
1104
|
+
res.statusCode = 404;
|
|
1105
|
+
res.end('Not Found');
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
httpServer.listen(port, host, () => {
|
|
1109
|
+
console.log(colors.green(`
|
|
1110
|
+
┌─────────────────────────────────────────────┐
|
|
1111
|
+
│ ${colors.bold('Recker Mock HLS Server')} │
|
|
1112
|
+
├─────────────────────────────────────────────┤
|
|
1113
|
+
│ Master: ${colors.cyan((hlsServer.manifestUrl).padEnd(34))}│
|
|
1114
|
+
│ Mode: ${colors.yellow(options.mode.padEnd(36))}│
|
|
1115
|
+
│ Segments: ${colors.gray(options.segments.padEnd(32))}│
|
|
1116
|
+
│ Duration: ${colors.gray((options.duration + 's').padEnd(32))}│
|
|
1117
|
+
│ Qualities: ${colors.cyan(qualities.join(', ').padEnd(31))}│
|
|
1118
|
+
├─────────────────────────────────────────────┤
|
|
1119
|
+
│ Press ${colors.bold('Ctrl+C')} to stop │
|
|
1120
|
+
└─────────────────────────────────────────────┘
|
|
1121
|
+
`));
|
|
1122
|
+
});
|
|
1123
|
+
process.on('SIGINT', async () => {
|
|
1124
|
+
console.log(colors.yellow('\nShutting down...'));
|
|
1125
|
+
httpServer.close();
|
|
1126
|
+
await hlsServer.stop();
|
|
1127
|
+
process.exit(0);
|
|
1128
|
+
});
|
|
1129
|
+
});
|
|
1130
|
+
serve
|
|
1131
|
+
.command('udp')
|
|
1132
|
+
.description('Start a mock UDP server')
|
|
1133
|
+
.option('-p, --port <number>', 'Port to listen on', '9000')
|
|
1134
|
+
.option('-h, --host <string>', 'Host to bind to', '127.0.0.1')
|
|
1135
|
+
.option('--echo', 'Echo messages back (default: true)', true)
|
|
1136
|
+
.option('--no-echo', 'Disable echo mode')
|
|
1137
|
+
.addHelpText('after', `
|
|
1138
|
+
${colors.bold(colors.yellow('Examples:'))}
|
|
1139
|
+
${colors.green('$ rek serve udp')} ${colors.gray('Start on port 9000')}
|
|
1140
|
+
${colors.green('$ rek serve udp -p 5353')} ${colors.gray('Start on port 5353')}
|
|
1141
|
+
${colors.green('$ rek serve udp --no-echo')} ${colors.gray('Disable echo')}
|
|
1142
|
+
`)
|
|
1143
|
+
.action(async (options) => {
|
|
1144
|
+
const { MockUDPServer } = await import('../testing/mock-udp-server.js');
|
|
1145
|
+
const server = new MockUDPServer({
|
|
1146
|
+
port: parseInt(options.port),
|
|
1147
|
+
host: options.host,
|
|
1148
|
+
echo: options.echo,
|
|
1149
|
+
});
|
|
1150
|
+
await server.start();
|
|
1151
|
+
console.log(colors.green(`
|
|
1152
|
+
┌─────────────────────────────────────────────┐
|
|
1153
|
+
│ ${colors.bold('Recker Mock UDP Server')} │
|
|
1154
|
+
├─────────────────────────────────────────────┤
|
|
1155
|
+
│ Address: ${colors.cyan(`${options.host}:${options.port}`.padEnd(33))}│
|
|
1156
|
+
│ Echo: ${colors.yellow((options.echo ? 'Enabled' : 'Disabled').padEnd(36))}│
|
|
1157
|
+
├─────────────────────────────────────────────┤
|
|
1158
|
+
│ Press ${colors.bold('Ctrl+C')} to stop │
|
|
1159
|
+
└─────────────────────────────────────────────┘
|
|
1160
|
+
`));
|
|
1161
|
+
server.on('message', (msg) => {
|
|
1162
|
+
const data = msg.data.toString().slice(0, 50);
|
|
1163
|
+
console.log(colors.gray(`${new Date().toISOString()} `) + colors.cyan(`${msg.rinfo.address}:${msg.rinfo.port}`) + ` ${data}${msg.data.toString().length > 50 ? '...' : ''}`);
|
|
1164
|
+
});
|
|
1165
|
+
process.on('SIGINT', async () => {
|
|
1166
|
+
console.log(colors.yellow('\nShutting down...'));
|
|
1167
|
+
await server.stop();
|
|
1168
|
+
process.exit(0);
|
|
1169
|
+
});
|
|
1170
|
+
});
|
|
883
1171
|
program
|
|
884
1172
|
.command('mcp')
|
|
885
1173
|
.description('Start MCP server for AI agents to access Recker documentation')
|
package/dist/cli/tui/shell.js
CHANGED
|
@@ -1716,7 +1716,7 @@ ${colors.bold('Network:')}
|
|
|
1716
1716
|
console.log(colors.gray(` Names: ${mapData.names.length}`));
|
|
1717
1717
|
console.log(colors.bold('\nOriginal sources:'));
|
|
1718
1718
|
mapData.sources.forEach((source, i) => {
|
|
1719
|
-
const hasContent = mapData.sourcesContent
|
|
1719
|
+
const hasContent = mapData.sourcesContent?.[i];
|
|
1720
1720
|
const sizeInfo = hasContent
|
|
1721
1721
|
? colors.green(`[${(mapData.sourcesContent[i].length / 1024).toFixed(1)}kb]`)
|
|
1722
1722
|
: colors.yellow('[no content]');
|
package/dist/plugins/cache.js
CHANGED
package/dist/plugins/retry.js
CHANGED
|
@@ -83,7 +83,7 @@ export function retry(options = {}) {
|
|
|
83
83
|
if (onRetry) {
|
|
84
84
|
onRetry(attempt, err, delayMs);
|
|
85
85
|
}
|
|
86
|
-
if (client.hooks
|
|
86
|
+
if (client.hooks?.onRetry) {
|
|
87
87
|
for (const hook of client.hooks.onRetry) {
|
|
88
88
|
await hook(err, attempt, delayMs, req);
|
|
89
89
|
}
|
|
@@ -99,7 +99,7 @@ export function retry(options = {}) {
|
|
|
99
99
|
if (onRetry) {
|
|
100
100
|
onRetry(attempt, error, delayMs);
|
|
101
101
|
}
|
|
102
|
-
if (client.hooks
|
|
102
|
+
if (client.hooks?.onRetry) {
|
|
103
103
|
for (const hook of client.hooks.onRetry) {
|
|
104
104
|
await hook(error, attempt, delayMs, req);
|
|
105
105
|
}
|
package/dist/transport/undici.js
CHANGED
|
@@ -23,7 +23,7 @@ undiciRequestChannel.subscribe((message) => {
|
|
|
23
23
|
});
|
|
24
24
|
undiciBodySentChannel.subscribe((message) => {
|
|
25
25
|
const store = requestStorage.getStore();
|
|
26
|
-
if (store
|
|
26
|
+
if (store?.hooks && store.hooks.onRequestSent) {
|
|
27
27
|
store.hooks.onRequestSent();
|
|
28
28
|
}
|
|
29
29
|
});
|
|
@@ -88,7 +88,7 @@ export async function getSecurityRecords(domain) {
|
|
|
88
88
|
try {
|
|
89
89
|
const dmarcRecords = await dns.resolveTxt(`_dmarc.${domain}`);
|
|
90
90
|
const dmarcTxt = dmarcRecords.map(chunks => chunks.join(''))[0];
|
|
91
|
-
if (dmarcTxt
|
|
91
|
+
if (dmarcTxt?.startsWith('v=DMARC1')) {
|
|
92
92
|
results.dmarc = dmarcTxt;
|
|
93
93
|
}
|
|
94
94
|
}
|
package/dist/utils/dns.js
CHANGED
|
@@ -3,7 +3,7 @@ import { promisify } from 'node:util';
|
|
|
3
3
|
const lookupAsync = promisify(lookup);
|
|
4
4
|
export function createLookupFunction(options) {
|
|
5
5
|
return (hostname, opts, callback) => {
|
|
6
|
-
if (options.override
|
|
6
|
+
if (options.override?.[hostname]) {
|
|
7
7
|
const ip = options.override[hostname];
|
|
8
8
|
const family = ip.includes(':') ? 6 : 4;
|
|
9
9
|
return callback(null, ip, family);
|
|
@@ -12,7 +12,7 @@ export function createLookupFunction(options) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export async function customDNSLookup(hostname, options = {}) {
|
|
15
|
-
if (options.override
|
|
15
|
+
if (options.override?.[hostname]) {
|
|
16
16
|
const ip = options.override[hostname];
|
|
17
17
|
const family = ip.includes(':') ? 6 : 4;
|
|
18
18
|
return { address: ip, family };
|
|
@@ -55,7 +55,7 @@ export async function requireOptional(packageName, submodule) {
|
|
|
55
55
|
const err = error;
|
|
56
56
|
const isModuleNotFound = err.code === 'ERR_MODULE_NOT_FOUND' ||
|
|
57
57
|
err.code === 'MODULE_NOT_FOUND' ||
|
|
58
|
-
(err.message
|
|
58
|
+
(err.message?.includes('Cannot find module'));
|
|
59
59
|
if (isModuleNotFound) {
|
|
60
60
|
const info = OPTIONAL_DEPENDENCIES[packageName];
|
|
61
61
|
const sub = submodule || info?.submodule || 'this feature';
|
package/dist/webrtc/index.js
CHANGED
|
@@ -246,7 +246,7 @@ export class WebRTCClient extends EventEmitter {
|
|
|
246
246
|
if (message.to !== this.peerId)
|
|
247
247
|
return;
|
|
248
248
|
const pc = this.connections.get(message.from);
|
|
249
|
-
if (pc
|
|
249
|
+
if (pc?.remoteDescription) {
|
|
250
250
|
await pc.addIceCandidate(message.payload);
|
|
251
251
|
}
|
|
252
252
|
else {
|