mobile-shell / mobile-shell/mosh

allow client-side port or port range to be specified

Open
#365 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
14.5k
Forks
865
PR merge metrics
No merged PRs in 30d

Description

It would be useful if mosh allowed the client port, or port range, to be specified. The envisaged scenario is something like:

  1. set up firewall to pass through UDP port 60001
  2. mosh -p 60001 -P 60001 server.example.com.

or with port ranges:

  1. set up firewall to pass through UDP ports 6[01]000
  2. mosh -p 60000:61000 -P 60000:61000

Mosh currently uses a system-assigned port number for mosh-client. It is therefore not possible to tunnel mosh through stateless firewalls, unless they are set up to allow essentially all UDP through.

(This scenario is common for DNS. For instance, a BIND name server can be configured to always use source port 53 when acting as a client, allowing a port 53-only UDP pass-through on the firewall.)

The code for server-side port ranges is already in place, via try_bind(), although this is not currently exposed to the user. What seems to be required is a modification to the client's Connect() to call try_bind() with a port or port range, if specified.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the client's Connect() path and compare it with the existing server-side try_bind() support. Trace how client port options are parsed, then verify that a single port or range can be passed to mosh-client and used through a matching UDP firewall configuration. Done means both forms work without relying on a system-assigned client port.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.