|
Mosh is a truly impressive feat of thought and, perhaps more
importantly, engineering. The thinking behind Mosh is substantial, the
paradigms are fresh. Reading about mosh on its excellent website,
I always leave with a profound feeling of enthusiasm. Mosh belongs a
school of software development ethics that I'm sorely missing in the
world. However, I do concur that, perhaps, Mosh solves a deep problem on the
wrong level or, even, in the wrong domain. The feeling, already
expressed here, that "tmux oughta do it" never leaves me. Why is that? Because I know that ssh, by itsself, can handle connection loss quite
well[0]. Rather, I suspect, ssh can't deal with IP changes or the
destruction of the underlying interface. So, here's the rub: Why is a stable, somehow-abstract, network interface
with a local IP, sitting on top of the actual network interfaces, be
they wired or wireless, not the answer? Over the years, on and off,
I tried to get the Linux ethernet bonding stack (ifenslave) to provide
me with just that solution, but was never able to. Hence, I keep revisiting mosh, then revisiting ifenslave... [0] On a machine that doesn't dynamically switch network interfaces on
demand, just unplug an ethernet cable, wait a while and plug it back
in: your ssh session will resume. |
The other half of the problem remains: SSH transfers unmodified byte streams between client and server over TCP. On networks with high latency or high packet loss this design doesn't work. Mosh fixes this part of the problem by redefining the problem. Instead of transferring every byte in both directions it runs a terminal emulator on both sides and the problem turn into: keep the terminal emulator states in sync. The server sends patches from the last confirmed client state to the current server state to the last known client address:port pair via UDP. The client sends the user input (and pings) to the server via UDP. This design allows Mosh to skip over lost messages.