# soheilhy/cmux

Connection multiplexer for GoLang: serve different services on the same port!

Repository: https://github.com/soheilhy/cmux
Canonical: https://ross.abutalabs.com/products/soheilhy-cmux
Language: Go
License: Apache-2.0
License Family: permissive
Last push: 2026-06-08T03:39:49+00:00

## Health v2 (maintenance only)
Score: 62/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 86, release rhythm 8, longevity 100
- inputs: {"age_days": 4053, "days_push": 86, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2767, forks 206 (observed 2026-08-28T04:07:18.673807+00:00)

## What it is
cmux is a Go library that multiplexes TCP connections based on their payload, allowing multiple protocols like gRPC, HTTP, HTTPS, and SSH to be served on the same port. It matches the first bytes of each connection and routes it to the appropriate protocol-specific listener.

## Use cases
- serve grpc and http on the same port
- multiplex multiple protocols on one tcp listener
- run ssh and https behind a single port
- route connections by protocol payload in go
- expose rest and grpc apis on one endpoint
- share a port between multiple go servers

## When to choose
- you need to serve multiple protocols on a single port behind a firewall or load balancer
- you want to combine gRPC and HTTP/REST on one endpoint in Go
- you need lightweight protocol sniffing with negligible overhead on long-lived connections

## When to avoid
- you need http.Request.TLS populated in handlers for HTTPS
- a single connection must switch between protocols mid-stream
- you use Java gRPC clients and cannot use MatchWithWriters

## Facets
- artifact type: library
- maturity: maintenance
- function: networking, middleware, http-server, rpc
- domain: networking, backend, developer-tools, apis
- platform: go, cross-platform
- tags: connection-multiplexing, tcp, grpc, protocol-matching, single-port

## Member repositories
- soheilhy/cmux (main) score 62

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:18.673807+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T08:16:44.797143+00:00, confidence not recorded.
  - readme: https://github.com/soheilhy/cmux (fetched 2026-08-28T04:07:18.673807+00:00, sha a6fd152351cc)
- Data as of 2026-08-30T08:39:29.467469+00:00.
