diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ba3cb8..35d206d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,14 @@ Versions after 2.17 are `MAJOR.MINOR.PATCH` (2.17 is followed by 2.17.1 or 2.18. `docs/testing.md`, "Versions and releases"); the headings below keep the numbers as they were released. +## 2.24.3 — 2026-11-18 + +- The camex tunnel is built from camex 4.0.1 (was 4.0.0), which fixes the tunnel over TCP: + a frame body read in pieces lost its first piece, so traffic from the server to the box + stalled at about 10 KB/s (OpenIPC/camex#180). The client library had the bug too, so a + TCP tunnel needs this build as well as a 4.0.1 server. UDP is unaffected. +- `tests/e2e.sh` takes `TRANSPORT=TCP` and checks the video rate through the tunnel. + ## 2.24.2 — 2026-11-17 - The camex tunnel is built from camex 4.0.0 (was 3.19.0). The Android library is unchanged: diff --git a/README.md b/README.md index f6d9ae0..35a6486 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Every item, the remote, sharing a URL from another app and **Reset**: [Usage](do ## Network (a tunnel to the cameras) -Decoder has a tunnel built in, [OpenIPC camex](https://github.com/OpenIPC/camex) 4.0.0: cameras that are clients of the same camex server are watched from anywhere, without a separate VPN app. **Network** in the menu (a row under the grid) holds the server (`host:port`), the client name (the box's ID on the server), UDP or TCP, the server's public key, the pre-shared key, the server timeout, the password of the debug page and **On**: connect now and at every start. Off by default. The server gives the address, MTU and routes; only the tunnel network and the server's routes (none wider than a /8) go through it, the local network is reached as before. The state is shown in the dialog (Connecting, Connected with the address, VPN consent needed, Failed) and in a notification. A camera reached through the tunnel plays over TCP with Auto. Decoder tells the server its web page is on port 8085 (for nginx there; a camex server 3.19.0 or later). The password, when set, guards that page from the local network and through the tunnel alike; empty (the default), the page is open. +Decoder has a tunnel built in, [OpenIPC camex](https://github.com/OpenIPC/camex) 4.0.1: cameras that are clients of the same camex server are watched from anywhere, without a separate VPN app. **Network** in the menu (a row under the grid) holds the server (`host:port`), the client name (the box's ID on the server), UDP or TCP, the server's public key, the pre-shared key, the server timeout, the password of the debug page and **On**: connect now and at every start. Off by default. The server gives the address, MTU and routes; only the tunnel network and the server's routes (none wider than a /8) go through it, the local network is reached as before. The state is shown in the dialog (Connecting, Connected with the address, VPN consent needed, Failed) and in a notification. A camera reached through the tunnel plays over TCP with Auto. Decoder tells the server its web page is on port 8085 (for nginx there; a camex server 3.19.0 or later). The password, when set, guards that page from the local network and through the tunnel alike; empty (the default), the page is open.

The Network dialog on a TV box: connected, the server and the client name diff --git a/README.ru.md b/README.ru.md index 80f4f16..70bcb03 100644 --- a/README.ru.md +++ b/README.ru.md @@ -89,7 +89,7 @@ ## Network (туннель к камерам) -В Decoder встроен туннель [OpenIPC camex](https://github.com/OpenIPC/camex) 4.0.0: камеры, подключённые клиентами к тому же серверу camex, видны откуда угодно, без отдельного VPN-приложения. Пункт **Network** в меню (ряд под сеткой): сервер (`host:port`), имя клиента (идентификатор приставки на сервере), UDP или TCP, открытый ключ сервера, общий ключ (psk), таймаут сервера, пароль отладочной страницы и **On** — подключиться сейчас и при каждом запуске. По умолчанию выключено. Адрес, MTU и маршруты выдаёт сервер; через туннель идут только его сеть и маршруты сервера (не шире /8), локальная сеть доступна как прежде. Состояние видно в окне (Connecting, Connected с адресом, VPN consent needed, Failed) и в уведомлении. Камера за туннелем в режиме Auto идёт по TCP. Decoder сообщает серверу, что его веб-страница на порту 8085 (для nginx на сервере; нужен сервер camex 3.19.0 или новее). Пароль, если задан, закрывает эту страницу одинаково из локальной сети и через туннель; пустой (по умолчанию) — страница открыта. +В Decoder встроен туннель [OpenIPC camex](https://github.com/OpenIPC/camex) 4.0.1: камеры, подключённые клиентами к тому же серверу camex, видны откуда угодно, без отдельного VPN-приложения. Пункт **Network** в меню (ряд под сеткой): сервер (`host:port`), имя клиента (идентификатор приставки на сервере), UDP или TCP, открытый ключ сервера, общий ключ (psk), таймаут сервера, пароль отладочной страницы и **On** — подключиться сейчас и при каждом запуске. По умолчанию выключено. Адрес, MTU и маршруты выдаёт сервер; через туннель идут только его сеть и маршруты сервера (не шире /8), локальная сеть доступна как прежде. Состояние видно в окне (Connecting, Connected с адресом, VPN consent needed, Failed) и в уведомлении. Камера за туннелем в режиме Auto идёт по TCP. Decoder сообщает серверу, что его веб-страница на порту 8085 (для nginx на сервере; нужен сервер camex 3.19.0 или новее). Пароль, если задан, закрывает эту страницу одинаково из локальной сети и через туннель; пустой (по умолчанию) — страница открыта.

Окно Network на ТВ-приставке: подключено, сервер и имя клиента diff --git a/README.zh-CN.md b/README.zh-CN.md index 02047e2..2ab77e5 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -89,7 +89,7 @@ ## Network(通往摄像头的隧道) -Decoder 内置 [OpenIPC camex](https://github.com/OpenIPC/camex) 4.0.0 隧道:作为客户端接入同一台 camex 服务器的摄像头,可以在任何地方观看,无需另装 VPN 应用。菜单中的 **Network**(网格下方一行)包含:服务器(`host:port`)、客户端名称(设备在服务器上的 ID)、UDP 或 TCP、服务器公钥、预共享密钥、服务器超时、调试页面密码,以及 **On**:立即连接并在每次启动时连接。默认关闭。地址、MTU 和路由由服务器下发;只有隧道网络和服务器的路由(不宽于 /8)经过隧道,本地网络照常访问。状态显示在对话框(Connecting、Connected 及地址、VPN consent needed、Failed)和通知中。经隧道访问的摄像头在 Auto 模式下走 TCP。Decoder 告知服务器其网页位于 8085 端口(供服务器上的 nginx 使用;需 camex 服务器 3.19.0 或更新版本)。设置密码后,无论从本地网络还是经隧道访问,该页面都需要密码;为空(默认)时页面开放。 +Decoder 内置 [OpenIPC camex](https://github.com/OpenIPC/camex) 4.0.1 隧道:作为客户端接入同一台 camex 服务器的摄像头,可以在任何地方观看,无需另装 VPN 应用。菜单中的 **Network**(网格下方一行)包含:服务器(`host:port`)、客户端名称(设备在服务器上的 ID)、UDP 或 TCP、服务器公钥、预共享密钥、服务器超时、调试页面密码,以及 **On**:立即连接并在每次启动时连接。默认关闭。地址、MTU 和路由由服务器下发;只有隧道网络和服务器的路由(不宽于 /8)经过隧道,本地网络照常访问。状态显示在对话框(Connecting、Connected 及地址、VPN consent needed、Failed)和通知中。经隧道访问的摄像头在 Auto 模式下走 TCP。Decoder 告知服务器其网页位于 8085 端口(供服务器上的 nginx 使用;需 camex 服务器 3.19.0 或更新版本)。设置密码后,无论从本地网络还是经隧道访问,该页面都需要密码;为空(默认)时页面开放。

电视盒子上的 Network 对话框:已连接、服务器和客户端名称 diff --git a/android/app/build.gradle b/android/app/build.gradle index a7dba68..ca4bdbf 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,8 +26,8 @@ android { applicationId "com.openipc.decoder" minSdk 21 targetSdk 36 - versionCode 59 - versionName "2.24.2" + versionCode 60 + versionName "2.24.3" // Keep only these locales of the libraries' resources, as in the other OpenIPC apps resourceConfigurations += ['en', 'ru', 'zh-rCN'] diff --git a/bundles/camex b/bundles/camex index 0712dcb..9e721e5 160000 --- a/bundles/camex +++ b/bundles/camex @@ -1 +1 @@ -Subproject commit 0712dcb177442584fdc27f7f76421fc433a5c383 +Subproject commit 9e721e58ffedcda7a72750a0056be5298f68231c diff --git a/docs/testing.md b/docs/testing.md index 9037b50..ca71914 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -138,7 +138,7 @@ cd android The native code is built for arm64-v8a and armeabi-v7a by default; `-PdecoderAbis` takes a list of `arm64-v8a`, `armeabi-v7a`, `x86_64`, `x86` (an empty or unknown one fails the build). -`tests/e2e.sh [API]` plays a camera through a camex server and the tunnel on an x86_64 emulator in Docker (API 21 and 34 are checked): 14 checks, from no camera with Network off to the password of the debug page through the tunnel and a restart of the tunnel with Network → Save. Its output is in `tests/out/` (ignored by git). +`tests/e2e.sh [API]` plays a camera through a camex server and the tunnel on an x86_64 emulator in Docker (API 21 and 34 are checked): 15 checks (16 with `TRANSPORT=TCP`, the tunnel over TCP), from no camera with Network off to the password of the debug page through the tunnel and a restart of the tunnel with Network → Save. Its output is in `tests/out/` (ignored by git). A release build needs a keystore at `android/key.jks` and `KEYSTORE_PASS`, `KEY_ALIAS`, `KEY_PASS` in the environment (`./gradlew assembleRelease`). Debug and release builds are signed with different keys: to switch, uninstall first, which removes the saved camera URLs. diff --git a/tests/e2e.sh b/tests/e2e.sh index 7546c2e..a28407b 100755 --- a/tests/e2e.sh +++ b/tests/e2e.sh @@ -30,6 +30,8 @@ # (default ~/.cache/compot/toolchains/android-emulator) # GRADLE_CACHE Gradle cache (default ~/.gradle) # KVM_GROUP group id of /dev/kvm on the Docker host (default 992) +# TRANSPORT the tunnel's transport in Network: UDP or TCP (default UDP); the hub takes +# both on one port, the Linux edge stays on UDP # SHOTS 1: slot 1 over TCP, a lighter camera stream and screenshots in tests/out/shots # (the picture through the tunnel, the menu, the Network dialog); the emulator's # software decoder still drops some frames: README pictures come from a TV box @@ -50,6 +52,8 @@ EMULATOR_DIR=${EMULATOR_DIR:-$HOME/.cache/compot/toolchains/android-emulator} GRADLE_CACHE=${GRADLE_CACHE:-$HOME/.gradle} KVM_GROUP=${KVM_GROUP:-992} SHOTS=${SHOTS:-} +TRANSPORT=${TRANSPORT:-UDP} +case $TRANSPORT in UDP|TCP) ;; *) echo "TRANSPORT must be UDP or TCP"; exit 2 ;; esac TUNNEL=camex RESTART_MARK="Tunnel initialized" # camex's log line of each new run (bundles/camex/src/camex.c) NAME=decoder-e2e-$$ @@ -142,7 +146,7 @@ until LINUX_IP=$(docker exec "$PEER" cat /proc/net/fib_trie 2>/dev/null | i=$((i + 1)); [ $i -lt 30 ] || { echo "the camex client got no address"; exit 1; } sleep 1 done -echo "hub ($TUNNEL): $HUB_IP:$HUB_PORT, Linux client: $LINUX_IP" +echo "hub ($TUNNEL, Decoder on $TRANSPORT): $HUB_IP:$HUB_PORT, Linux client: $LINUX_IP" # the camera: an RTSP server in the Linux edge's network namespace, a 1280x720 test picture # (screenshots: a lighter stream, the emulator's software decoder keeps up with it) @@ -174,7 +178,7 @@ WEB_PASSWORD=e2e-pass # the tunnel's values as the Network screen keeps them (tunnel__) TUNNEL_SETTINGS="$HUB_IP:5800\ decoder\ -UDP\ +$TRANSPORT\ $CAMEX_PUBKEY\ $KEY\ $WEB_PASSWORD" @@ -245,7 +249,10 @@ fi # a few rounds: the edges find each other through the hub first (slow on Android 5) pinged="" for _ in 1 2 3 4 5; do - if $ADB shell ping -c 3 -W 2 "$LINUX_IP" | grep -q ' [123] received'; then pinged=1; break; fi + P=$($ADB shell ping -c 3 -W 2 "$LINUX_IP" || true) + if printf '%s\n' "$P" | grep -q ' [123] received'; then + pinged=1; printf '%s\n' "$P" | grep 'min/avg' || true; break + fi done if [ -n "$pinged" ]; then ok "ping through the tunnel to $LINUX_IP"; else bad "no ping to $LINUX_IP"; fi @@ -291,6 +298,21 @@ else fi $ADB exec-out screencap -p > "$OUT/decoder.png" 2>/dev/null || true +# the tunnel's transport: on TCP the app keeps a connection to the hub's port (state 01) +if [ "$TRANSPORT" = TCP ]; then + if $ADB shell cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | + awk -v p=":$(printf '%04X' $HUB_PORT)" '$3 ~ p "$" && $4 == "01" { f = 1 } END { exit !f }'; then + ok "the tunnel runs over TCP to the hub" + else bad "no TCP connection to the hub's port $HUB_PORT"; fi +fi +# the video keeps coming through the tunnel, hub to box; the Docker network has no real round +# trip, so this does not catch camex#180 (TCP at ~10 KB/s with 60 ms RTT; camex has its own test) +rx() { $ADB shell cat /proc/net/dev | awk -F'[: ]+' '$2 == "tun0" { print $3 }'; } +r1=$(rx); sleep 10; r2=$(rx) +RATE_KB=$(( (${r2:-0} - ${r1:-0}) / 10240 )) +if [ "$RATE_KB" -ge 100 ]; then ok "video through the tunnel at $RATE_KB KB/s"; else + bad "video through the tunnel at $RATE_KB KB/s (want 100 or more)"; fi + # the debug page through the tunnel, from the Linux client: the password set in Network is asked code() { docker exec "$PEER" curl -s -o /dev/null -m 10 -w '%{http_code}' "$@" "http://$TUN:8085/stats.json"; } c0=$(code) c1=$(code -u "x:wrong") c2=$(code -u "anyone:$WEB_PASSWORD")