Go边缘代理: 单文件可执行+嵌入式MediaMTX+监控+注册
- edge-agent/: Go项目, 支持Windows托盘/Linux无头两种模式 - 使用go:embed将MediaMTX二进制嵌入单一可执行文件 - 首次运行自动释放MediaMTX并生成边缘节点配置 - 自动注册到origin (POST /api/nodes/register) - 10秒心跳上报CPU/RAM/带宽/连接数 (gopsutil采集) - Windows: getlantern/systray托盘菜单(状态/CPU/MEM/带宽/退出) - Linux: headless模式,适合systemd守护 - build.sh/build.ps1: 交叉编译脚本(Linux/Windows) - 更新start.sh/品牌名StreamCore
This commit is contained in:
1 parent
980b91f41f
commit
409e5d314e
14 files changed
+800
-11
No files matched your search
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
# Build StreamCore Edge Agent
|
||||
# Prerequisites: Go 1.19+, mediamtx binary in mediamtx/
|
||||
#
|
||||
# Build for Linux:
|
||||
# ./build.sh linux
|
||||
# Build for Windows:
|
||||
# ./build.sh windows
|
||||
# Build both:
|
||||
# ./build.sh all
|
||||
|
||||
set -e
|
||||
|
||||
PLATFORM="${1:-linux}"
|
||||
VERSION="${VERSION:-0.1.0}"
|
||||
OUTDIR="dist"
|
||||
APP="streamcore-edge"
|
||||
|
||||
export GO111MODULE=on
|
||||
export GOPROXY="${GOPROXY:-https://goproxy.cn,direct}"
|
||||
|
||||
build_linux() {
|
||||
echo "Building Linux (amd64)..."
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-o "${OUTDIR}/${APP}-linux-amd64" \
|
||||
.
|
||||
echo " -> ${OUTDIR}/${APP}-linux-amd64"
|
||||
}
|
||||
|
||||
build_windows() {
|
||||
echo "Building Windows (amd64)..."
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build \
|
||||
-ldflags="-s -w -H windowsgui -X main.Version=${VERSION}" \
|
||||
-o "${OUTDIR}/${APP}-windows-amd64.exe" \
|
||||
.
|
||||
echo " -> ${OUTDIR}/${APP}-windows-amd64.exe"
|
||||
}
|
||||
|
||||
mkdir -p "${OUTDIR}"
|
||||
|
||||
case "${PLATFORM}" in
|
||||
linux) build_linux ;;
|
||||
windows) build_windows ;;
|
||||
all)
|
||||
build_linux
|
||||
build_windows
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {linux|windows|all}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Done."
|
||||
Reference in new issue
Block a user