hivedesk 1.0.1 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hivedesk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A crew of AI workers that plan, talk and build real files on your machine with a local model.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/p2p/doctor.js CHANGED
@@ -121,7 +121,10 @@ export function probeBroker(url, { timeoutMs = 4000, tlsOptions = {} } = {}) {
121
121
  socket.destroy();
122
122
  resolve({ url, ok, ms: Date.now() - started, detail });
123
123
  };
124
- const socket = tls.connect({ host: u.hostname, port: Number(u.port) || 443, servername: u.hostname, ...tlsOptions }, () => {
124
+ // SNI takes a host name only: an IP address as the server name is deprecated (DEP0123) and ignored.
125
+ const host = u.hostname.replace(/^\[|\]$/g, '');
126
+ const sni = net.isIP(host) ? {} : { servername: host };
127
+ const socket = tls.connect({ host, port: Number(u.port) || 443, ...sni, ...tlsOptions }, () => {
125
128
  const key = crypto.randomBytes(16).toString('base64');
126
129
  socket.write(`GET ${u.pathname || '/'} HTTP/1.1\r\nHost: ${u.host}\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: ${key}\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Protocol: mqtt\r\n\r\n`);
127
130
  });