Skip to content

ares-novacom: publish a host port on the device with --reverse - #17

Merged
mariotaku merged 1 commit into
fix/novacom-forward-livenessfrom
feat/novacom-reverse-forward
Aug 27, 2026
Merged

ares-novacom: publish a host port on the device with --reverse#17
mariotaku merged 1 commit into
fix/novacom-forward-livenessfrom
feat/novacom-reverse-forward

Conversation

@mariotaku

@mariotaku mariotaku commented Aug 27, 2026

Copy link
Copy Markdown
Member

Stacked on #18 — that PR carries two fixes to --forward as it ships today (throughput, and a forward that can't tell a dead tunnel from an idle one). This one is the feature alone. Merge #18 first and this retargets to main cleanly.

--forward only carries connections one way. This adds --reverse for the other: the device listens, and every connection it accepts is pumped to a port on this machine, so an app under development can reach a dev server on the host at localhost:<device port>.

# TV apps/scripts reach the host's dev server at http://localhost:9977
ares-novacom -d tv --reverse --port 9977:18080

--port keeps its shape — device port first, host port second. Which end listens is what the direction flag decides. The device is asked to bind its own loopback rather than every interface, so a published port stays off the network the device sits on.

The accept loop

libssh holds the session lock for the whole timeout a poll is given, so an accept loop that asks for it again straight away starves the threads pumping the connections already open. The first test carried an HTTP request to the host and logged a 200 there, but the reply never went back. The loop glances for 10 ms and stands back for 40 ms instead.

bridge splits into the channel setup each direction needs and the pump they share. A session that has gone away usually leaves TryAgain behind as its last error, so the loop reports the loss without that meaningless suffix.

Verified on a UP7560

  • content matches through a reverse forward
  • a 5 MB transfer keeps its checksum
  • three concurrent downloads all match
  • 5 MB chained host → --forward → device → --reverse → host arrives intact in 5.2 s

Also works against stock OpenSSH, not only a device.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gde2tcn5SbUHKhesuTNB7a

--forward only carries connections one way. Add --reverse for the other:
the device listens, and every connection it accepts is pumped to a port on
this machine, so an app under development can reach a dev server on the
host at localhost:<device port>.

--port keeps its shape, device port first. Which end listens is what the
direction flag decides. The device is asked to bind its own loopback
rather than every interface, so a published port stays off the network the
device sits on.

libssh holds the session lock for the whole timeout a poll is given, so an
accept loop that asks for it again straight away starves the threads
pumping the connections already open. The first test carried an HTTP
request to the host and logged a 200 there, but the reply never went back.
The loop glances for 10ms and stands back for 40ms instead.

`bridge` splits into the channel setup each direction needs and the `pump`
they share. A session that has gone away usually leaves `TryAgain` behind
as its last error, so the loop reports the loss without that meaningless
suffix.

Verified on a UP7560: content matches through a reverse forward, a 5MB
transfer keeps its checksum, three concurrent downloads all match, and 5MB
chained host -> --forward -> device -> --reverse -> host arrives intact in
5.2s. Also works against stock OpenSSH, not only a device.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gde2tcn5SbUHKhesuTNB7a
@mariotaku
mariotaku force-pushed the feat/novacom-reverse-forward branch from 6194de8 to 8c84316 Compare August 27, 2026 04:50
@mariotaku mariotaku changed the title ares-novacom: forward a host port to the device with --reverse ares-novacom: publish a host port on the device with --reverse Aug 27, 2026
@mariotaku
mariotaku changed the base branch from main to fix/novacom-forward-liveness August 27, 2026 04:50
@mariotaku
mariotaku merged commit 0201d2b into main Aug 27, 2026
4 checks passed
@mariotaku
mariotaku deleted the feat/novacom-reverse-forward branch August 27, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant