← 返回
未分类 Key 中文

Gcore FastEdge

Build and deploy WebAssembly applications to Gcore FastEdge edge computing platform. Use when creating, building, or deploying FastEdge HTTP apps with Rust S...
在 Gcore FastEdge 边缘计算平台上构建并部署 WebAssembly 应用。适用于在使用 Rust 等语言创建、构建或部署 FastEdge HTTP 应用的场景。
geri4 geri4 来源
未分类 clawhub v1.0.1 1 版本 100000 Key: 需要
★ 0
Stars
📥 366
下载
💾 0
安装
1
版本
#latest

概述

FastEdge Skill

Build and deploy WebAssembly HTTP applications to Gcore FastEdge.

Quick Start

1. Create a new FastEdge app

Initialize a Rust project with the FastEdge SDK:

mkdir myapp && cd myapp

Create .cargo/config.toml:

[build]
target = "wasm32-wasip1"

Create Cargo.toml:

[package]
name = "myapp"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[dependencies]
fastedge = "0.2"

Create src/lib.rs:

use fastedge::{
    body::Body,
    http::{Request, Response, StatusCode, Error},
};

#[fastedge::http]
fn main(_req: Request<Body>) -> Result<Response<Body>, Error> {
    Response::builder()
        .status(StatusCode::OK)
        .header("content-type", "text/plain")
        .body(Body::from("Hello from FastEdge!"))
}

2. Build the Wasm binary

Requires Rust and wasm32-wasip1 target:

rustup target add wasm32-wasip1
cargo build --release

Binary location: target/wasm32-wasip1/release/myapp.wasm

3. Deploy via CLI

Set your API key (get from https://accounts.gcore.com/account-settings/api-tokens):

export GCORE_API_KEY="your_api_token"

Upload binary:

curl -X POST \
  'https://api.gcore.com/fastedge/v1/binaries/raw' \
  -H 'accept: application/json' \
  -H "Authorization: APIKey $GCORE_API_KEY" \
  -H 'Content-Type: application/octet-stream' \
  --data-binary '@./target/wasm32-wasip1/release/myapp.wasm'

Save the id from response (binary_id).

Create app:

curl -X POST \
  'https://api.gcore.com/fastedge/v1/apps' \
  -H 'accept: application/json' \
  -H 'client_id: 0' \
  -H "Authorization: APIKey $GCORE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "my-app-name",
    "binary": BINARY_ID,
    "status": 1
  }'

Your app will be at: https://my-app-name-XXXX.fastedge.app

Useful Patterns

HTML Response

Response::builder()
    .status(StatusCode::OK)
    .header("content-type", "text/html; charset=utf-8")
    .body(Body::from(html_string))

Access Request Headers

let ip = req.headers()
    .get("x-real-ip")
    .and_then(|v| v.to_str().ok())
    .unwrap_or("unknown");

Common headers provided by FastEdge:

  • x-real-ip - Client IP address
  • x-forwarded-for - Proxied client IP
  • geoip-country-code - Country code
  • geoip-city - City name
  • host - Request host

Update Existing App

curl -X PUT \
  'https://api.gcore.com/fastedge/v1/apps/APP_ID' \
  -H 'accept: application/json' \
  -H "Authorization: APIKey $GCORE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "binary": NEW_BINARY_ID,
    "status": 1,
    "name": "app-name"
  }'

Resources

  • Template project: See assets/rust-template/ for a starter template
  • Build script: See scripts/build_rust.py for automated build/upload
  • API Docs: https://gcore.com/docs/fastedge

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-07 14:32 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,627
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 327,223
dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 41,539