- 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
33 lines
817 B
PowerShell
33 lines
817 B
PowerShell
# Build StreamCore Edge Agent for Windows
|
|
# Prerequisites: Go 1.19+
|
|
|
|
param(
|
|
[string]$Platform = "windows"
|
|
)
|
|
|
|
$VERSION = if ($env:VERSION) { $env:VERSION } else { "0.1.0" }
|
|
$OUTDIR = "dist"
|
|
$APP = "streamcore-edge"
|
|
|
|
$env:GO111MODULE = "on"
|
|
$env:GOPROXY = if ($env:GOPROXY) { $env:GOPROXY } else { "https://goproxy.cn,direct" }
|
|
|
|
if (-not (Test-Path $OUTDIR)) {
|
|
New-Item -ItemType Directory -Path $OUTDIR | Out-Null
|
|
}
|
|
|
|
if ($Platform -eq "windows") {
|
|
Write-Host "Building Windows (amd64)..."
|
|
$env:GOOS = "windows"
|
|
$env:GOARCH = "amd64"
|
|
$env:CGO_ENABLED = "0"
|
|
|
|
go build -ldflags "-s -w -H windowsgui -X main.Version=$VERSION" -o "$OUTDIR/$APP-windows-amd64.exe" .
|
|
Write-Host " -> $OUTDIR/$APP-windows-amd64.exe"
|
|
}
|
|
else {
|
|
Write-Host "Usage: .\build.ps1 [windows]"
|
|
}
|
|
|
|
Write-Host "Done."
|