4ward 0.1.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/Cargo.lock +4321 -0
- package/Cargo.toml +8 -0
- package/LICENSE +201 -0
- package/README.md +119 -0
- package/bin/run.js +40 -0
- package/crates/4ward-cli/Cargo.toml +29 -0
- package/crates/4ward-cli/src/commands/alias.rs +55 -0
- package/crates/4ward-cli/src/commands/deploy.rs +267 -0
- package/crates/4ward-cli/src/commands/dns.rs +60 -0
- package/crates/4ward-cli/src/commands/init.rs +38 -0
- package/crates/4ward-cli/src/commands/keys.rs +113 -0
- package/crates/4ward-cli/src/commands/mod.rs +14 -0
- package/crates/4ward-cli/src/commands/request_prod.rs +38 -0
- package/crates/4ward-cli/src/commands/status.rs +21 -0
- package/crates/4ward-cli/src/main.rs +45 -0
- package/crates/4ward-cli/templates/template.yaml +388 -0
- package/crates/4ward-core/Cargo.toml +15 -0
- package/crates/4ward-core/src/config.rs +261 -0
- package/crates/4ward-core/src/dns.rs +126 -0
- package/crates/4ward-core/src/lib.rs +5 -0
- package/docs/assets/arch.svg +44 -0
- package/docs/assets/banner-lockup.jpg +0 -0
- package/docs/assets/icon.jpg +0 -0
- package/lambdas/api/Cargo.toml +22 -0
- package/lambdas/api/src/main.rs +360 -0
- package/lambdas/forwarder/Cargo.toml +29 -0
- package/lambdas/forwarder/src/arc.rs +258 -0
- package/lambdas/forwarder/src/main.rs +369 -0
- package/package.json +50 -0
- package/scripts/install-binary.js +30 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// postinstall: download the matching release binary from GitHub into ./binaries/.
|
|
2
|
+
const https = require("https");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const VERSION = require("../package.json").version;
|
|
7
|
+
const plat = process.platform;
|
|
8
|
+
const arch = process.arch;
|
|
9
|
+
const ext = plat === "win32" ? ".exe" : "";
|
|
10
|
+
const asset = `4ward-${plat}-${arch}${ext}`;
|
|
11
|
+
const url = `https://github.com/tljohnsilver/4ward/releases/download/v${VERSION}/${asset}`;
|
|
12
|
+
const dest = path.join(__dirname, "..", "binaries", asset);
|
|
13
|
+
|
|
14
|
+
if (fs.existsSync(dest)) process.exit(0);
|
|
15
|
+
if (process.env.FOURWARD_SKIP_DOWNLOAD) {
|
|
16
|
+
console.log("4ward: skipping binary download (FOURWARD_SKIP_DOWNLOAD set)");
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
20
|
+
console.log(`4ward: downloading ${url}`);
|
|
21
|
+
https.get(url, (res) => {
|
|
22
|
+
if (res.statusCode !== 200) {
|
|
23
|
+
console.log(`4ward: no prebuilt binary yet (${res.statusCode}); use source via cargo. Skipping.`);
|
|
24
|
+
res.resume();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const out = fs.createWriteStream(dest, { mode: 0o755 });
|
|
28
|
+
res.pipe(out);
|
|
29
|
+
out.on("finish", () => { fs.chmodSync(dest, 0o755); console.log("4ward: binary installed"); });
|
|
30
|
+
}).on("error", (e) => console.log(`4ward: download skipped: ${e.message}`));
|