openclaw-cloudflare 0.2.1 → 0.3.1
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 +105 -83
- package/openclaw.plugin.json +4 -15
- package/package.json +6 -1
- package/src/index.ts +15 -69
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.github/workflows/changeset-check.yml +0 -25
- package/.github/workflows/ci.yml +0 -25
- package/.github/workflows/release.yml +0 -39
- package/CHANGELOG.md +0 -17
- package/CLAUDE.md +0 -81
- package/src/index.test.ts +0 -395
- package/src/tunnel/access.test.ts +0 -280
- package/src/tunnel/cloudflared.test.ts +0 -324
- package/src/tunnel/cloudflared.ts +0 -273
- package/src/tunnel/exposure.test.ts +0 -113
- package/src/tunnel/exposure.ts +0 -45
- package/tsconfig.json +0 -16
- package/vitest.config.ts +0 -7
package/src/tunnel/exposure.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { startCloudflaredTunnel } from "./cloudflared.js";
|
|
2
|
-
|
|
3
|
-
export async function startGatewayCloudflareExposure(params: {
|
|
4
|
-
cloudflareMode: "off" | "managed" | "access-only";
|
|
5
|
-
tunnelToken?: string;
|
|
6
|
-
logCloudflare: {
|
|
7
|
-
info: (msg: string) => void;
|
|
8
|
-
warn: (msg: string) => void;
|
|
9
|
-
error: (msg: string) => void;
|
|
10
|
-
};
|
|
11
|
-
}): Promise<(() => Promise<void>) | null> {
|
|
12
|
-
if (params.cloudflareMode === "off") {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (params.cloudflareMode === "access-only") {
|
|
17
|
-
params.logCloudflare.info(
|
|
18
|
-
"access-only mode: Cloudflare Access JWT verification active (external cloudflared expected)",
|
|
19
|
-
);
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// managed mode — spawn cloudflared tunnel run
|
|
24
|
-
if (!params.tunnelToken) {
|
|
25
|
-
params.logCloudflare.error("managed mode: no tunnel token provided, skipping tunnel start");
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
const tunnel = await startCloudflaredTunnel({
|
|
31
|
-
token: params.tunnelToken,
|
|
32
|
-
timeoutMs: 30_000,
|
|
33
|
-
logger: params.logCloudflare,
|
|
34
|
-
});
|
|
35
|
-
params.logCloudflare.info(
|
|
36
|
-
`managed tunnel running (connectorId=${tunnel.connectorId ?? "unknown"}, pid=${tunnel.pid ?? "unknown"})`,
|
|
37
|
-
);
|
|
38
|
-
return tunnel.stop;
|
|
39
|
-
} catch (err) {
|
|
40
|
-
params.logCloudflare.error(
|
|
41
|
-
`managed tunnel failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
42
|
-
);
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"outDir": "dist",
|
|
10
|
-
"rootDir": "src",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"sourceMap": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src"],
|
|
15
|
-
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
16
|
-
}
|