No description
Find a file
Renovate c5e31336d4
All checks were successful
Go check / check-go (push) Successful in 58s
Nix check / check-nix (push) Successful in 2m6s
fix(deps): update git.foxden.network/foxden/peercred digest to d3aa00d (#37)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| git.foxden.network/FoxDen/peercred | require | digest | `6ad453d` -> `d3aa00d` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4yNy4xIiwidXBkYXRlZEluVmVyIjoiNDIuMjcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: #37
Co-authored-by: Renovate <renovate@foxden.network>
Co-committed-by: Renovate <renovate@foxden.network>
2025-12-08 10:50:41 -08:00
.forgejo/workflows chore(reposyncer): update repo baseline (#34) 2025-11-28 23:44:44 -08:00
cmd/uds-proxy Fully local 2025-11-12 11:58:24 -08:00
proxy Fix errcheck 2025-11-14 10:56:22 -08:00
.gitignore Fixups 2025-09-26 19:35:50 -07:00
compute-vendor-hash.sh Load vendor hash from file to auto-compute it 2025-11-13 18:26:55 -08:00
flake.lock update 2025-10-01 21:47:42 -07:00
flake.nix Dont 100 nix 2025-11-17 21:30:13 -08:00
go.mod fix(deps): update git.foxden.network/foxden/peercred digest to d3aa00d (#37) 2025-12-08 10:50:41 -08:00
go.sum fix(deps): update git.foxden.network/foxden/peercred digest to d3aa00d (#37) 2025-12-08 10:50:41 -08:00
LICENSE Initial commit 2019-05-26 18:34:11 +02:00
README.md Fully local 2025-11-12 11:58:24 -08:00
renovate.json chore(reposyncer): update repo baseline (#27) 2025-11-16 20:48:10 -08:00
vendor-hash.txt fix(deps): update git.foxden.network/foxden/peercred digest to d3aa00d (#37) 2025-12-08 10:50:41 -08:00

uds-proxy

uds-proxy provides a UNIX domain socket and forwards traffic to HTTP(S) remotes through a customizable connection pool (i.e. using persistent connections).

what for? why? how?

Interacting with microservices often involves communication overhead: Every contact with another service may involve DNS lookups and establishment of a TCP connection plus, most likely, a HTTPS handshake.

This overhead can be costly and especially hard to circumvent for legacy applications -- thus uds-proxy.

uds-proxy creates a UNIX domain socket and forwards communication to one or more remote web servers. In a way, uds-proxy aims a bit at reducing application/API complexity by providing a generic and simple solution for connection pooling.

uds-proxy is implemented in Go, so it runs as native application on any OS supporting Go and UNIX domain sockets (i.e. not on Windows). Critical performance metrics of uds-proxy (request latencies, response codes...) and Go process statistics are exposed through Prometheus client library.

It also provides a way to use UNIX socket authentication on TCP-only services. For this, uds-proxy provides the X-Auth-User and X-Auth-Group headers.

building / installing uds-proxy

Building requires a local Go 1.11+ installation:

go get -v git.foxden.network/FoxDen/uds-proxy/cmd/uds-proxy

usage

Usage of ./uds-proxy:
  -client-timeout int
        http client connection timeout [ms] for proxy requests (default 5000)
  -force-remote-host string
        force all requests to be sent to this host (name or ip)
  -idle-timeout int
        connection timeout [ms] for idle backend connections (default 90000)
  -max-conns-per-host int
        maximum number of connections per backend host (default 20)
  -max-idle-conns int
        maximum number of idle HTTP(S) connections (default 100)
  -max-idle-conns-per-host int
        maximum number of idle conns per backend (default 15)
  -no-log-timestamps
        disable timestamps in log messages
  -remote-https
        remote uses https://
  -socket string
        path of socket to create
  -socket-read-timeout int
        read timeout [ms] for -socket (default 5500)
  -socket-write-timeout int
        write timeout [ms] for -socket (default 5500)
  -version
        print uds-proxy version

using bash / curl

# without uds-proxy, you would...
time curl -I https://www.google.com/

# with uds-proxy, always ...
# a) talk through socket and
# b) use http:// and let `-remote-https` ensure https is used to connect to remote hosts
time curl -I --unix-socket /tmp/proxied-svc.sock http://www.google.com/
# ... or using socket provided by dockerized uds-proxy:
time curl -I --unix-socket /tmp/mysock_dir/uds-proxy-docker.sock http://www.google.com/

using php / curl

<?php
// without uds-proxy
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/");
curl_exec($ch);

// with uds-proxy
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.google.com/");
curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, "/tmp/proxied-svc.sock");
curl_exec($ch);

further socket testing

Mac's (i.e. BSD's) netcat allows to talk to unix domain sockets. It can be used to e.g. ensure correct behaviour of uds-proxy's -socket-(read|write)-timeout options. Try nc -U /path/to/uds-proxy.sock.

alternatives

Obviously, uds-proxy is a kludge. Simply use connection pooling if available!

Maybe look at phantom?

You can also use NGINX to create a UDS HTTP/S pooling forward proxy like uds-proxy. It seems that neither Apache nor Squid (?) are able to do that.

license

MIT