Skip to content

Add client-side local TCP forwarding #14

Description

@changhoon-sung

Add client-side local TCP forwarding

Would it make sense for Tailcat to support exposing a served remote port as a local loopback TCP listener?

Tailcat currently supports connecting to a remote served port through stdin/stdout:

tailcat <token> 8080

and applications with SOCKS support can use:

tailcat socks <token> <command>

For applications that cannot use Tailcat's stdio or SOCKS proxy modes, it would be useful to expose a served remote port as an ordinary local TCP listener.

Following the existing CLI style, perhaps something like:

tailcat forward <token> 8080

which would mean:

127.0.0.1:8080 -> Tailcat -> remote localhost:8080

and optionally:

tailcat forward <token> 3000:8080

for:

127.0.0.1:3000 -> Tailcat -> remote localhost:8080

This would be useful for tools that expect to connect to a normal host:port and do not provide SOCKS or stdio proxy integration. Some examples are:

  • database clients and GUI tools connecting to PostgreSQL, MySQL, Redis, etc.
  • IDE extensions or development tools that only accept a hostname and port
  • local applications that need to reach a remote development server or admin interface
  • legacy or third-party software where proxy configuration is unavailable or difficult
  • scripts and test environments that expect a service to exist on localhost

For example:

tailcat forward home.example.com 15432:5432
psql -h 127.0.0.1 -p 15432

or:

tailcat forward home.example.com 3000:8080

after which any application can use:

http://127.0.0.1:3000

without needing Tailcat-specific support.

This can currently be approximated with socat by having it execute tailcat <token> <port> for each accepted connection, but that requires an external dependency and starts a new Tailcat client for each connection.

A native implementation could keep one Tailcat client alive and call DialTCPPort for each accepted local connection.

Does client-side local forwarding fit the intended scope of the project? Happy to work on an implementation if so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions