streamd: serve start/stop/update, streamd.yaml, egress, module panel fixes

- Add streamd serve start|stop|restart|status|update with auto-written streamd.yaml
- Panel modules: STREAMD_MODULES_DIR for describe, YAML channel fallback, textarea value fix
- Per-stream WireGuard/SOCKS egress profiles + Settings UI
- Drop drm-* from release builds; track streamd-bg.sh / streamd-update.sh wrappers
- Docs: streamd-server-setup lifecycle and update flow
This commit is contained in:
404errordeveloper 2026-10-10 18:05:51 +02:00
parent da8e1123ec
commit 8fc7e4c0b8
57 changed files with 4031 additions and 257 deletions

View file

@ -1,5 +1,4 @@
# Cross-compile host streamd (+ drm compat copy) and on-device proxy-android-arm64
# into dist/release/.
# Cross-compile host streamd and on-device proxy-android-arm64 into dist/release/.
# Usage:
# .\scripts\build-release.ps1
# .\scripts\build-release.ps1 -Version v1.2.3
@ -43,8 +42,7 @@ Get-ChildItem $Out -ErrorAction SilentlyContinue | Where-Object { $_.Name -match
function Build-Host([string]$Goos, [string]$Goarch, [string]$Ext = "") {
$name = "streamd-$Goos-$Goarch$Ext"
$compat = "drm-$Goos-$Goarch$Ext"
Write-Host " - $name (+ $compat)"
Write-Host " - $name"
$env:GOOS = $Goos
$env:GOARCH = $Goarch
$env:CGO_ENABLED = "0"
@ -52,7 +50,6 @@ function Build-Host([string]$Goos, [string]$Goarch, [string]$Ext = "") {
try {
& $GoExe -C apps/cli build -trimpath -ldflags="-s -w" -o (Join-Path $Out $name) .
if ($LASTEXITCODE -ne 0) { throw "go build failed for $name" }
Copy-Item (Join-Path $Out $name) (Join-Path $Out $compat) -Force
} finally {
Pop-Location
Remove-Item Env:GOOS -ErrorAction SilentlyContinue
@ -95,9 +92,8 @@ Copy-Item (Join-Path $Out "proxy-android-arm64") (Join-Path $Root "bin\proxy-and
Copy-Item (Join-Path $Out "proxy-android-arm64") (Join-Path $Root "apps\proxy\proxy-android-arm64") -Force
try {
Copy-Item (Join-Path $Out "streamd-windows-amd64.exe") (Join-Path $Root "bin\streamd.exe") -Force
Copy-Item (Join-Path $Out "streamd-windows-amd64.exe") (Join-Path $Root "bin\drm.exe") -Force
} catch {
Write-Host "WARN: could not refresh bin\streamd.exe / bin\drm.exe (file in use): $($_.Exception.Message)"
Write-Host "WARN: could not refresh bin\streamd.exe (file in use): $($_.Exception.Message)"
}
# Restore tiny embed stub so the 9MB MITM binary is not left in the source tree.
$stub = Join-Path $Root "apps\pkg\bootstrap\embedded\bin\proxy-android-arm64"
@ -107,7 +103,7 @@ Write-Host "==> checksums"
$sumsPath = Join-Path $Out "SHA256SUMS.txt"
$tmpSums = Join-Path $Out "SHA256SUMS.txt.tmp"
$lines = Get-ChildItem $Out -File |
Where-Object { $_.Name -match '^(streamd-|drm-|proxy-android)' } |
Where-Object { $_.Name -match '^(streamd-|proxy-android)' } |
Get-FileHash -Algorithm SHA256 |
ForEach-Object { "{0} {1}" -f $_.Hash.ToLower(), (Split-Path $_.Path -Leaf) }
[System.IO.File]::WriteAllLines($tmpSums, @($lines))
@ -123,10 +119,8 @@ New-Item -ItemType Directory -Force -Path @(
(Join-Path $win "outputs")
) | Out-Null
Copy-Item (Join-Path $Out "streamd-windows-amd64.exe") (Join-Path $win "bin\streamd.exe") -Force
Copy-Item (Join-Path $Out "streamd-windows-amd64.exe") (Join-Path $win "bin\drm.exe") -Force
Copy-Item (Join-Path $Out "proxy-android-arm64") (Join-Path $win "bin\proxy-android-arm64") -Force
Copy-Item (Join-Path $Out "streamd-windows-amd64.exe") (Join-Path $win "streamd.exe") -Force
Copy-Item (Join-Path $Out "streamd-windows-amd64.exe") (Join-Path $win "drm.exe") -Force
Copy-Item (Join-Path $Out "proxy-android-arm64") (Join-Path $win "proxy-android-arm64") -Force
Copy-Item (Join-Path $Root "apps\proxy\device\tproxy_iptables.sh") (Join-Path $win "apps\proxy\device\") -Force
Copy-Item (Join-Path $Root "apps\pkg\go.mod") (Join-Path $win "apps\pkg\") -Force
@ -136,7 +130,6 @@ Streamd — Windows portable
Scaffold (streamd.exe also creates this on first run if you only download the exe):
bin\streamd.exe
bin\drm.exe (identical compatibility copy)
bin\proxy-android-arm64
apps\proxy\device\tproxy_iptables.sh

View file

@ -1,6 +1,5 @@
#!/usr/bin/env bash
# Cross-compile host `streamd` (+ `drm` compat copy) and on-device
# `proxy-android-arm64` into dist/release/.
# Cross-compile host `streamd` and on-device `proxy-android-arm64` into dist/release/.
# Usage:
# ./scripts/build-release.sh # VERSION=git describe
# ./scripts/build-release.sh v1.2.3
@ -48,14 +47,12 @@ echo "==> building host streamd ($VERSION) into $OUT"
build_host() {
local goos="$1" goarch="$2" ext="${3:-}"
local name="streamd-${goos}-${goarch}${ext}"
local compat="drm-${goos}-${goarch}${ext}"
echo " - $name (+ $compat)"
echo " - $name"
(
cd "$ROOT"
GOOS="$goos" GOARCH="$goarch" CGO_ENABLED=0 \
"$GO" -C apps/cli build -trimpath -ldflags="-s -w" -o "$OUT/$name" .
)
cp -f "$OUT/$name" "$OUT/$compat"
}
build_host windows amd64 .exe
@ -80,27 +77,15 @@ case "$(uname -s)" in
Linux)
arch="$(uname -m)"
case "$arch" in
x86_64)
cp -f "$OUT/streamd-linux-amd64" "$ROOT/bin/streamd"
cp -f "$OUT/streamd-linux-amd64" "$ROOT/bin/drm"
;;
aarch64)
cp -f "$OUT/streamd-linux-arm64" "$ROOT/bin/streamd"
cp -f "$OUT/streamd-linux-arm64" "$ROOT/bin/drm"
;;
x86_64) cp -f "$OUT/streamd-linux-amd64" "$ROOT/bin/streamd" ;;
aarch64) cp -f "$OUT/streamd-linux-arm64" "$ROOT/bin/streamd" ;;
esac
;;
Darwin)
arch="$(uname -m)"
case "$arch" in
x86_64)
cp -f "$OUT/streamd-darwin-amd64" "$ROOT/bin/streamd"
cp -f "$OUT/streamd-darwin-amd64" "$ROOT/bin/drm"
;;
arm64)
cp -f "$OUT/streamd-darwin-arm64" "$ROOT/bin/streamd"
cp -f "$OUT/streamd-darwin-arm64" "$ROOT/bin/drm"
;;
x86_64) cp -f "$OUT/streamd-darwin-amd64" "$ROOT/bin/streamd" ;;
arm64) cp -f "$OUT/streamd-darwin-arm64" "$ROOT/bin/streamd" ;;
esac
;;
esac
@ -108,9 +93,9 @@ esac
(
cd "$OUT"
if command -v sha256sum >/dev/null 2>&1; then
sha256sum streamd-* drm-* proxy-android-arm64 > SHA256SUMS.txt
sha256sum streamd-* proxy-android-arm64 > SHA256SUMS.txt
else
shasum -a 256 streamd-* drm-* proxy-android-arm64 > SHA256SUMS.txt
shasum -a 256 streamd-* proxy-android-arm64 > SHA256SUMS.txt
fi
)

View file

@ -85,7 +85,7 @@ function New-TelegramBody {
}
return (
"<b>$Title</b>" + $nl +
"Host CLI ($( & $code 'streamd' ); $( & $code 'drm' ) compat copy) + on-device MITM ($( & $code 'proxy-android-arm64' ))." +
"Host CLI ($( & $code 'streamd' )) + on-device MITM ($( & $code 'proxy-android-arm64' ))." +
$channelLine + $nl + $nl +
"<a href=`"$ReleaseUrl`">Download $Tag</a>"
)

View file

@ -84,7 +84,7 @@ Upload in the streamd Modules page, or unpack into <code>modules/&lt;name&gt;/</
<a href=\"${URL}\">Download ${TAG}</a>"
else
BODY="<b>${TITLE}</b>
Host CLI (<code>streamd</code>; <code>drm</code> compat copy) + on-device MITM (<code>proxy-android-arm64</code>).
Host CLI (<code>streamd</code>) + on-device MITM (<code>proxy-android-arm64</code>).
${CHANNEL_LINE}
<a href=\"${URL}\">Download ${TAG}</a>"

69
scripts/streamd-bg.sh Normal file
View file

@ -0,0 +1,69 @@
#!/usr/bin/env bash
# Thin wrapper around `streamd serve` lifecycle commands.
# Prefer calling the binary directly:
# ./streamd serve start|stop|restart|status
#
# Kept so older docs/curl installs that fetch streamd-bg.sh still work.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
BIN="${STREAMD_BIN:-$ROOT/streamd}"
[[ -x "$BIN" ]] || { echo "streamd-bg: missing executable $BIN" >&2; exit 1; }
cmd="${1:-}"
shift || true
case "$cmd" in
start|stop|restart|status)
exec "$BIN" serve "$cmd" "$@"
;;
log)
# Resolve log file from streamd.yaml when possible; else streamd.log
log="$ROOT/streamd.log"
if [[ -f "$ROOT/streamd.yaml" ]]; then
# shellcheck disable=SC2016
ylog="$(grep -E '^log_file:' "$ROOT/streamd.yaml" | head -1 | sed 's/^log_file:[[:space:]]*//;s/[[:space:]]*$//;s/^["'\'']//;s/["'\'']$//')" || true
if [[ -n "${ylog:-}" ]]; then
if [[ "$ylog" = /* ]]; then log="$ylog"; else log="$ROOT/$ylog"; fi
fi
fi
exec tail -n 100 -f "$log"
;;
start-agent)
cfg="${AGENT_CONFIG:-$ROOT/agent.yaml}"
[[ -f "$cfg" ]] || { echo "streamd-bg: missing $cfg" >&2; exit 1; }
nohup "$BIN" agent run --config "$cfg" >"$ROOT/agent.log" 2>&1 &
echo $! >"$ROOT/agent.pid"
echo "agent started pid=$(cat "$ROOT/agent.pid")"
;;
stop-agent)
if [[ -f "$ROOT/agent.pid" ]]; then
kill "$(cat "$ROOT/agent.pid")" 2>/dev/null || true
rm -f "$ROOT/agent.pid"
echo "agent stopped"
else
echo "agent is not running"
fi
;;
log-agent)
exec tail -n 100 -f "$ROOT/agent.log"
;;
-h|--help|help|"")
cat <<EOF
Usage: $(basename "$0") <command>
Preferred (same machine): ./streamd serve start|stop|restart|status|update
This wrapper still accepts:
start | stop | restart | status | log
start-agent | stop-agent | log-agent
EOF
[[ -n "$cmd" ]] || exit 2
;;
*)
echo "streamd-bg: unknown command: $cmd (try --help)" >&2
exit 1
;;
esac

12
scripts/streamd-update.sh Normal file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Thin wrapper around `streamd serve update`.
# Prefer: ./streamd serve update [--beta] [--tag vX.Y.Z] [--no-restart]
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
BIN="${STREAMD_BIN:-$ROOT/streamd}"
[[ -x "$BIN" ]] || { echo "streamd-update: missing executable $BIN" >&2; exit 1; }
exec "$BIN" serve update "$@"