DEV Community

Chop TRAN
Chop TRAN

Posted on

Locho: Access a Private Service on Another Machine as if it Were Local

local + echo = locho

Sometimes you don't need access to a machine.

You don't need a shell.

You don't need the whole network.

You just need to call one service.

Access a Private Service as if It Were Local


The situation

I ran into this while working with services inside a private network - a friend's homelab.

Here’s what I had:

  • an API running inside that private network (on my friend’s homelab)
  • a host with access to that network (my laptop)
  • another machine, located elsewhere (my desktop), without access

What I wanted was simple:

Call that API from my machine as if I were inside the private network.


The usual options (and why they didn't fit)

There are plenty of ways to solve this - but they all felt like overkill for this specific need.

1. SSH port forwarding

Using:

ssh -L 8765:localhost:8080 user@host
Enter fullscreen mode Exit fullscreen mode

This works, but:

  • requires managing SSH access
  • gives full shell access (more than needed)
  • not very ergonomic if you just want a quick service call

2. VPNs

Tools like Tailscale give you full network access.

But:

  • you join the entire network
  • you expose more than just one service
  • setup can be heavier than necessary

3. Public tunneling

Tools like ngrok expose your service publicly.

But:

  • the service becomes publicly reachable
  • requires an external service
  • not ideal for private/internal APIs

The gap

All of these tools operate at a broader level:

  • machine-level (SSH)
  • network-level (VPN)
  • public endpoint (tunnels)

But my need was narrower:

I only want access to one specific service—nothing else.


A simpler approach

So I built locho.

locho is a simple way to access a private service on another machine as if it were local.

Instead of giving access to a machine or network, locho gives you access to a single service, and binds it to your localhost.

Why Locho is different


How it works

You define services on the host:

[[services]]
name = "api"
type = "tcp"
endpoint = "192.168.0.10:8080"
Enter fullscreen mode Exit fullscreen mode

Start the host:

locho host --config locho.toml
Enter fullscreen mode Exit fullscreen mode

Then from your remote machine:

locho attach <host-id> api <capability> --listen 127.0.0.1:8765
Enter fullscreen mode Exit fullscreen mode

Now you can call it like this:

curl http://127.0.0.1:8765
Enter fullscreen mode Exit fullscreen mode

And it hits the remote service.


Try it

👉 https://github.com/trchopan/locho

I'd love to hear how you'd use it.

Top comments (3)

Collapse
 
immortals_vietnams_92b86 profile image
Immortals Vietnam's

Nice. Just what I needed.

Collapse
 
bachoptr profile image
Ba Chop

Cool project. Keep up good work.

Collapse
 
matt_a73c239581a38ccd21ca profile image
Matt

Tried it. It is a great option when you need secure access to one private service without exposing the whole machine or network.