Skip to content

fix(jetsocat): validate JMUX listener destination at CLI parse time#1823

Merged
Benoît Cortier (CBenoit) merged 1 commit into
masterfrom
fix/jetsocat-fail-loudly-on-invalid-arg
Jun 11, 2026
Merged

fix(jetsocat): validate JMUX listener destination at CLI parse time#1823
Benoît Cortier (CBenoit) merged 1 commit into
masterfrom
fix/jetsocat-fail-loudly-on-invalid-arg

Conversation

@CBenoit

Copy link
Copy Markdown
Member

Previously, a tcp-listen://<addr>/<destination> argument without a port (e.g. a missing :22) was accepted at startup, but every incoming connection was then silently dropped with only a debug-level log. The tunnel appeared to work yet forwarded nothing.

The listener destination is now parsed during CLI argument parsing, so a malformed destination fails immediately and visibly with a clear error, before any listener is bound.

Previously, a `tcp-listen://<addr>/<destination>` argument without a port
(e.g. a missing `:22`) was accepted at startup, but every incoming
connection was then silently dropped with only a debug-level log. The
tunnel appeared to work yet forwarded nothing.

The listener destination is now parsed during CLI argument parsing, so a
malformed destination fails immediately and visibly with a clear error,
before any listener is bound.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves jetsocat jmux-proxy reliability by validating the JMUX TCP listener destination during CLI parsing, so malformed destinations fail fast with a clear error instead of causing silent runtime drops.

Changes:

  • Add a CLI regression test ensuring a missing destination port fails during argument parsing.
  • Parse tcp-listen://<bind>/<destination> destinations into DestinationUrl at CLI parse time (rather than per-connection at runtime).
  • Refactor TCP listener handling to carry a parsed DestinationUrl and emit higher-visibility warnings on JMUX API failures.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
testsuite/tests/cli/jetsocat.rs Adds a regression test asserting missing destination port is rejected during CLI parsing.
jetsocat/src/main.rs Parses/validates TCP listener destination into DestinationUrl during CLI arg parsing.
jetsocat/src/listener.rs Switches TCP listener to use parsed DestinationUrl and removes per-connection destination parsing.
crates/jmux-proto/src/lib.rs Introduces DestinationUrl::with_scheme and refactors parse_str to use it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +88 to +89
Self::with_scheme(scheme, rest)
}
@CBenoit Benoît Cortier (CBenoit) merged commit eeb90df into master Jun 11, 2026
45 checks passed
@CBenoit Benoît Cortier (CBenoit) deleted the fix/jetsocat-fail-loudly-on-invalid-arg branch June 11, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants