@kadi.build/file-sharing 1.1.2 → 1.2.0
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 +17 -0
- package/package.json +2 -2
- package/src/FileSharingServer.js +7 -0
package/README.md
CHANGED
|
@@ -141,6 +141,8 @@ The `.env` loader supports monorepo layouts: if your `.env` is at the workspace
|
|
|
141
141
|
| `KADI_TUNNEL_PORT` | KĀDI frps server port | `7000` |
|
|
142
142
|
| `KADI_TUNNEL_SSH_PORT` | KĀDI SSH gateway port | `2200` |
|
|
143
143
|
| `KADI_TUNNEL_MODE` | Connection mode: `ssh`, `frpc`, or `auto` | `auto` |
|
|
144
|
+
| `KADI_TUNNEL_TRANSPORT` | Transport protocol: `wss` (via gateway on :443) or `tcp` (direct) | `wss` |
|
|
145
|
+
| `KADI_TUNNEL_WSS_HOST` | WSS gateway hostname (e.g., `tunnel-control.kadi.build`) | — |
|
|
144
146
|
| `KADI_AGENT_ID` | Agent identifier for proxy naming | `kadi` |
|
|
145
147
|
| **Tunnel — Ngrok** | | |
|
|
146
148
|
| `NGROK_AUTHTOKEN` | Ngrok auth token (also accepts `NGROK_AUTH_TOKEN`) | — |
|
|
@@ -162,6 +164,8 @@ KADI_TUNNEL_DOMAIN=tunnel.kadi.build
|
|
|
162
164
|
KADI_TUNNEL_PORT=7000
|
|
163
165
|
KADI_TUNNEL_SSH_PORT=2200
|
|
164
166
|
KADI_TUNNEL_MODE=ssh
|
|
167
|
+
KADI_TUNNEL_TRANSPORT=wss
|
|
168
|
+
KADI_TUNNEL_WSS_HOST=tunnel-control.kadi.build
|
|
165
169
|
KADI_AGENT_ID=my-agent
|
|
166
170
|
|
|
167
171
|
# Optional: Ngrok (fallback)
|
|
@@ -248,6 +252,8 @@ const server = new FileSharingServer({
|
|
|
248
252
|
kadiSshPort: undefined,
|
|
249
253
|
kadiMode: undefined, // 'ssh' | 'frpc' | 'auto'
|
|
250
254
|
kadiAgentId: undefined,
|
|
255
|
+
kadiTransport: undefined, // 'wss' (default) | 'tcp'
|
|
256
|
+
kadiWssControlHost: undefined, // WSS gateway hostname
|
|
251
257
|
// Ngrok-specific
|
|
252
258
|
ngrokAuthToken: undefined,
|
|
253
259
|
// Advanced
|
|
@@ -565,6 +571,17 @@ KĀDI is the default and recommended tunnel service. It supports two connection
|
|
|
565
571
|
|
|
566
572
|
Set `KADI_TUNNEL_MODE=ssh` (or `frpc`) in your `.env` to force a specific mode.
|
|
567
573
|
|
|
574
|
+
### Transport Protocol
|
|
575
|
+
|
|
576
|
+
When using **frpc** mode, the control channel transport can be configured:
|
|
577
|
+
|
|
578
|
+
| Transport | Description | Default |
|
|
579
|
+
|-----------|-------------|---------|
|
|
580
|
+
| **wss** | Routes the frpc control channel through a WSS gateway on port 443. Works reliably on enterprise/campus networks that block non-standard ports. | ✅ Default |
|
|
581
|
+
| **tcp** | Direct TCP connection to the frps server port (typically 7000). | — |
|
|
582
|
+
|
|
583
|
+
Set `KADI_TUNNEL_TRANSPORT=wss` and `KADI_TUNNEL_WSS_HOST=tunnel-control.kadi.build` in your `.env` to use WSS transport. TCP mode can be forced with `KADI_TUNNEL_TRANSPORT=tcp`.
|
|
584
|
+
|
|
568
585
|
If KĀDI credentials are not provided, the tunnel will automatically fall back to free services (serveo → localtunnel → pinggy → localhost.run) unless `autoFallback: false` is set.
|
|
569
586
|
|
|
570
587
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kadi.build/file-sharing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "File sharing service with tunneling and local S3-compatible interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@kadi.build/file-manager": "^1.0.0",
|
|
46
|
-
"@kadi.build/tunnel-services": "^1.0.
|
|
46
|
+
"@kadi.build/tunnel-services": "^1.0.5",
|
|
47
47
|
"chalk": "^5.3.0",
|
|
48
48
|
"cors": "^2.8.5",
|
|
49
49
|
"express": "^4.18.0",
|
package/src/FileSharingServer.js
CHANGED
|
@@ -80,6 +80,8 @@ function _loadEnvFile() {
|
|
|
80
80
|
* KADI_TUNNEL_PORT — KĀDI frpc port (default: 7000)
|
|
81
81
|
* KADI_TUNNEL_SSH_PORT— KĀDI SSH gateway port (default: 2200)
|
|
82
82
|
* KADI_TUNNEL_MODE — ssh | frpc | auto (default: auto)
|
|
83
|
+
* KADI_TUNNEL_TRANSPORT— wss | tcp (default: wss)
|
|
84
|
+
* KADI_TUNNEL_WSS_HOST — WSS gateway hostname (e.g., tunnel-control.kadi.build)
|
|
83
85
|
* KADI_AGENT_ID — Agent identifier for proxy naming
|
|
84
86
|
* NGROK_AUTHTOKEN — Ngrok auth token (also: NGROK_AUTH_TOKEN)
|
|
85
87
|
* KADI_S3_ACCESS_KEY — S3 access key (default: minioadmin)
|
|
@@ -104,6 +106,8 @@ function loadSecrets() {
|
|
|
104
106
|
kadiSshPort: process.env.KADI_TUNNEL_SSH_PORT ? Number(process.env.KADI_TUNNEL_SSH_PORT) : undefined,
|
|
105
107
|
kadiMode: process.env.KADI_TUNNEL_MODE,
|
|
106
108
|
kadiAgentId: process.env.KADI_AGENT_ID,
|
|
109
|
+
kadiTransport: process.env.KADI_TUNNEL_TRANSPORT,
|
|
110
|
+
kadiWssControlHost: process.env.KADI_TUNNEL_WSS_HOST,
|
|
107
111
|
ngrokAuthToken: process.env.NGROK_AUTHTOKEN || process.env.NGROK_AUTH_TOKEN,
|
|
108
112
|
s3AccessKey: process.env.KADI_S3_ACCESS_KEY,
|
|
109
113
|
s3SecretKey: process.env.KADI_S3_SECRET_KEY,
|
|
@@ -251,6 +255,9 @@ export class FileSharingServer extends EventEmitter {
|
|
|
251
255
|
kadiSshPort: tunnelCfg.kadiSshPort || secrets.kadiSshPort,
|
|
252
256
|
kadiMode: tunnelCfg.kadiMode || secrets.kadiMode,
|
|
253
257
|
kadiAgentId: tunnelCfg.kadiAgentId || secrets.kadiAgentId,
|
|
258
|
+
// KĀDI transport (WSS gateway)
|
|
259
|
+
kadiTransport: tunnelCfg.kadiTransport || secrets.kadiTransport,
|
|
260
|
+
kadiWssControlHost: tunnelCfg.kadiWssControlHost || secrets.kadiWssControlHost,
|
|
254
261
|
// Ngrok auth (env vars as fallback)
|
|
255
262
|
ngrokAuthToken: tunnelCfg.ngrokAuthToken || secrets.ngrokAuthToken,
|
|
256
263
|
// Pass through any extra service-specific options
|