Skip to content

Add unix+tcp: ingress service scheme#1611

Open
ikruglov wants to merge 2 commits intocloudflare:masterfrom
ikruglov:support-unix-tcp
Open

Add unix+tcp: ingress service scheme#1611
ikruglov wants to merge 2 commits intocloudflare:masterfrom
ikruglov:support-unix-tcp

Conversation

@ikruglov
Copy link

@ikruglov ikruglov commented Mar 15, 2026

  • Introduces a new unix+tcp: ingress service scheme that forwards raw bytes bidirectionally over a unix domain socket, bypassing HTTP entirely

  • Completes the unix socket scheme family alongside the existing unix: (HTTP) and unix+tls: (HTTPS) — unix+tcp: is their stream-based counterpart, analogous to ssh:// / tcp:// but targeting a unix socket instead of a TCP port

  • The scheme name follows the existing modifier pattern: unix = socket type, +tcp = transport style (raw stream), not application protocol — so it works for SSH, RDP, SMB, or any other stream-based daemon listening on a unix socket

  • Adds necessary tests to validate implementaiton

    Example config:

  ingress:
    - hostname: ssh.example.com
      service: unix+tcp:/run/sshd.sock

implements #439

ikruglov and others added 2 commits March 15, 2026 10:53
…sockets

Introduce unixSocketTCPService, a new OriginService that dials a unix
socket and forwards raw bytes bidirectionally via WebSocket, without any
HTTP wrapping.  This is the unix-socket analogue of tcpOverWSService.

A new ingress URL scheme unix+tcp:<path> is recognised during ingress
validation and maps to this service type.  Example config:

  ingress:
    - hostname: ssh.example.com
      service: unix+tcp:/run/sshd.sock

The scheme name unix+tcp mirrors the existing unix+tls modifier pattern:
the suffix describes the transport style, not the application protocol,
so the service works equally well for SSH, RDP, or any other stream-based
protocol whose daemon listens on a unix socket.

The implementation reuses the existing tcpOverWSConnection and
DefaultStreamHandler machinery; the only difference from ssh:// (TCP) is
that the underlying net.Conn is obtained via net.Dial("unix", path).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- TestParseUnixSocketTCP: standalone parse test verifying the
  unixSocketTCPService type and path extraction
- TestParseIngress/Unix+TCP_service: table-driven parse test alongside
  existing ssh://, tcp://, unix://, etc. entries
- TestUnixSocketTCPServiceEstablishConnection: verifies successful dial
  to a real unix socket and error on closed listener; uses /tmp to stay
  within the macOS 104-char unix socket path limit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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