Remove native-host shims (host.js, holesail-manager.js)
CI / Build & Test (push) Successful in 3m10s

- Import host/message-router.js and holesail-manager/index.js directly
- Delete host.js and holesail-manager.js
- Drop shim entries from CI syntax checks
- Update ARCHITECTURE.md diagram and file table
This commit is contained in:
Raven Scott
2026-03-03 23:43:40 -05:00
parent e2518f8c38
commit 6c981f708f
6 changed files with 11 additions and 25 deletions
-2
View File
@@ -67,8 +67,6 @@ jobs:
- name: Lint — syntax check native host
run: |
node --check native-host/host.js
node --check native-host/holesail-manager.js
node --check native-host/ssh-manager.js
node --check native-host/rdp-manager.js
node --check native-host/backup-manager.js
+9 -10
View File
@@ -22,10 +22,11 @@ Holesail Browser is composed of three parts: a browser extension, a native host
┌─────────────────────────────────────────────────────────────────┐
│ Native Host (~/.holesail-browser/holesail-browser-host) │
│ │
│ ┌──────────┐ ┌──────────────────┐ ┌──────────────────────┐ │
│ │ host.js │ │ holesail- │ │ certificate- │ │
│ │ (command │ │ manager.js │ │ authority.js │ │
│ │ dispatch)│ │ (tunnel lifecycle│ │ (root CA + per-TLD │ │
│ ┌──────────────┐ ┌──────────────────┐ ┌──────────────────────┐ │
│ │ message- │ │ holesail- │ │ certificate- │ │
│ │ router.js │ │ manager/ │ │ authority.js │ │
│ │ (command │ │ (tunnel lifecycle│ │ (root CA + per-TLD │ │
│ │ dispatch) │ │ + state.json) │ │ wildcard certs, │ │
│ └────┬─────┘ │ + state.json) │ │ wildcard certs, │ │
│ │ └────────┬─────────┘ │ keychain install) │ │
│ │ │ └──────────────────────┘ │
@@ -59,10 +60,8 @@ Holesail Browser is composed of three parts: a browser extension, a native host
| File | Purpose |
|------|---------|
| `index.mjs` | Entry point. Bootstraps Bare globals, creates the native messaging `messenger`, wires `handleMessage` from `host.js`. Handles `SIGTERM`/`SIGINT` for graceful shutdown. |
| `index.mjs` | Entry point. Bootstraps Bare globals, creates the native messaging `messenger`, wires `handleMessage` from `host/message-router.js`. Handles `SIGTERM`/`SIGINT` for graceful shutdown. |
| `messenger.js` | Chrome/Firefox native messaging framing: 4-byte little-endian length prefix + UTF-8 JSON body. Max 1 MB per message. |
| `host.js` | Thin shim — re-exports `handleMessage` and `cleanup` from `host/message-router.js`. Kept at the top level so `index.mjs` requires it unchanged. |
| `holesail-manager.js` | Thin shim — re-exports the full API from `holesail-manager/index.js`. Kept at the top level so `host/message-router.js` requires it unchanged. |
| `https-proxy.js` | SNI-aware HTTPS reverse proxy on `127.0.0.1:8443`. Uses a pure-JS TLS ClientHello parser to extract the SNI hostname from each incoming connection, derives the wildcard parent domain, and presents a per-TLD wildcard cert. Supports any hostname depth (e.g. `i.love.hole.sail`). Returns a 502 HTML page for unknown hostnames. |
| `connect-proxy.js` | HTTP CONNECT proxy on `127.0.0.1:8442`. Accepts `CONNECT hostname:443`, replies `200 Connection established`, then pipes the raw TCP stream to `127.0.0.1:8443`. |
| `certificate-authority.js` | Generates a 2048-bit RSA root CA (10-year validity) using `node-forge`. Signs per-TLD wildcard domain certs on demand (1-year). Installs the CA into the OS trust store. Fingerprint-verifies to detect stale entries. |
@@ -90,7 +89,7 @@ Holesail Browser is composed of three parts: a browser extension, a native host
| `servers.js` | `startServer()`, `stopServer()`, `getServers()`. Manages Holesail server tunnels (server mode — exposes a local port to the P2P network). |
| `virtual-hosts.js` | `setVirtualHost()`, `removeVirtualHost()`, `getVirtualHosts()`, `getLocalBackend()`, `getLocalPortForHostname()`, `getVirtualHostMap()`. Manages virtual host client tunnels routed through the HTTPS proxy. |
| `service-tunnels.js` | `startServiceTunnel()`, `stopServiceTunnel()`, `getServiceTunnels()`. Manages direct TCP client tunnels (not HTTP-proxied). |
| `index.js` | Assembles all sub-modules, injects shared `saveState` and `emit` callbacks, exposes `restorePersistedState()` and `cleanup()`, and re-exports the complete original `holesail-manager.js` API. |
| `index.js` | Assembles all sub-modules, injects shared `saveState` and `emit` callbacks, exposes `restorePersistedState()` and `cleanup()`, and re-exports the complete holesail-manager API. |
### Extension (`extension/`)
@@ -193,7 +192,7 @@ HTTPS proxy (https-proxy.js) 127.0.0.1:8443
│ → { host: '127.0.0.1', port: 19042 }
│ Proxies HTTP request to 127.0.0.1:19042
Holesail client tunnel (holesail-manager.js) 127.0.0.1:19042
Holesail client tunnel (holesail-manager) 127.0.0.1:19042
│ P2P connection via Noise protocol over Holesail DHT
Remote peer (HTTP server)
@@ -276,7 +275,7 @@ See [NATIVE-HOST.md](NATIVE-HOST.md) for the full message type reference.
|------|-----------|-------------|
| 8443 | `https-proxy.js` | HTTPS proxy (SNI-aware TLS termination) |
| 8442 | `connect-proxy.js` | CONNECT proxy (PAC target) |
| 19000+ | `holesail-manager.js` | Virtual host and service tunnel client ports |
| 19000+ | `holesail-manager/` | Virtual host and service tunnel client ports |
| 20000+ | `ssh-manager.js` | SSH Holesail client tunnel ports |
| 21000+ | `ssh-manager.js` | SSH WebSocket server ports |
| 22000+ | `rdp-manager.js` | RDP/VNC Holesail client tunnel ports |
-5
View File
@@ -1,5 +0,0 @@
/**
* Entry-point shim — delegates to holesail-manager/index.js.
* Kept at the top level so host.js require('./holesail-manager.js') continues to work.
*/
module.exports = require('./holesail-manager/index.js');
-6
View File
@@ -1,6 +0,0 @@
/**
* Entry-point shim — delegates to host/message-router.js.
* Kept at the top level so index.mjs require('./host.js') continues to work.
*/
const { handleMessage, cleanup } = require('./host/message-router.js');
module.exports = { handleMessage, cleanup };
+1 -1
View File
@@ -10,7 +10,7 @@ const { log, debugLog } = require('./logger.js');
const { initStartup, getProxiesReadyPromise, getTunnelsRestoredPromise, setTunnelsRestoredPromise, restorePersistedTunnels } = require('./startup.js');
const holesailManager = require('../holesail-manager.js');
const holesailManager = require('../holesail-manager/index.js');
holesailManager.setStoragePath(STORAGE_PATH);
const certificateAuthority = require('../certificate-authority.js');
+1 -1
View File
@@ -9,7 +9,7 @@
import 'bare-process/global';
import _messenger from './messenger.js';
import _host from './host.js';
import _host from './host/message-router.js';
const { createMessenger } = _messenger;
const { handleMessage, cleanup } = _host;