private-connect 0.3.3 → 0.3.5
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/index.js +26 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,26 @@ const c = {
|
|
|
31
31
|
const ok = `${c.green}✓${c.reset}`;
|
|
32
32
|
const fail = `${c.red}✗${c.reset}`;
|
|
33
33
|
const warn = `${c.yellow}⚠${c.reset}`;
|
|
34
|
+
// Track usage (fire and forget, don't block)
|
|
35
|
+
function trackUsage(command) {
|
|
36
|
+
const data = JSON.stringify({
|
|
37
|
+
os: process.platform,
|
|
38
|
+
arch: process.arch === 'arm64' ? 'arm64' : 'x64',
|
|
39
|
+
version: 'npx',
|
|
40
|
+
source: 'npx',
|
|
41
|
+
});
|
|
42
|
+
const req = https.request('https://api.privateconnect.co/v1/events/install', {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
headers: {
|
|
45
|
+
'Content-Type': 'application/json',
|
|
46
|
+
'Content-Length': Buffer.byteLength(data),
|
|
47
|
+
},
|
|
48
|
+
timeout: 3000,
|
|
49
|
+
});
|
|
50
|
+
req.on('error', () => { }); // Silently ignore errors
|
|
51
|
+
req.write(data);
|
|
52
|
+
req.end();
|
|
53
|
+
}
|
|
34
54
|
async function testTcp(host, port, timeout = 5000) {
|
|
35
55
|
return new Promise((resolve) => {
|
|
36
56
|
const start = Date.now();
|
|
@@ -225,7 +245,8 @@ function printHelp() {
|
|
|
225
245
|
${c.bold}Private Connect${c.reset} - Zero-friction connectivity tools
|
|
226
246
|
|
|
227
247
|
${c.bold}Commands:${c.reset}
|
|
228
|
-
|
|
248
|
+
check <target> Test connectivity to any service
|
|
249
|
+
test <target> Alias for check
|
|
229
250
|
tunnel <port> Create a temporary public tunnel
|
|
230
251
|
|
|
231
252
|
${c.bold}Examples:${c.reset}
|
|
@@ -510,10 +531,12 @@ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
|
|
|
510
531
|
printHelp();
|
|
511
532
|
process.exit(0);
|
|
512
533
|
}
|
|
513
|
-
|
|
534
|
+
// Track usage (non-blocking)
|
|
535
|
+
trackUsage(args[0] || 'help');
|
|
536
|
+
if (args[0] === 'test' || args[0] === 'check') {
|
|
514
537
|
if (!args[1]) {
|
|
515
538
|
console.error(`${c.red}Error: Target required${c.reset}`);
|
|
516
|
-
console.error(`Usage: npx private-connect
|
|
539
|
+
console.error(`Usage: npx private-connect ${args[0]} <host:port>`);
|
|
517
540
|
process.exit(1);
|
|
518
541
|
}
|
|
519
542
|
runTest(args[1]).catch(console.error);
|