caddy
caddy copied to clipboard
Feature Request: Windows named-pipe or file-mapping support, windows non-net IPC counterpart to unix sockets
I've been looking at trying to build a windows application that manages multiple applications and handles the networking through Caddy; but I figured, depending on the level of integration the applications require, non-network sockets like unix sockets are the most efficient since, from my understanding, they wouldn't hit the network controller for every proxied app. I tried looking into Winsocks and quickly realized why Caddy doesn't use those, it's non-trivially different, and is hard to avoid still going out to the network controller, defeating the purpose. But looking at other Windows IPC methods like Named Pipes, and File Mapping, I'm curious if one of those can be implemented as a non-networking interface for windows to provide for reverse proxying applications on windows with the same or similar performance and access control benefits that unix sockets provide.
Apparently there's os.ModeNamedPipe
and windows.CreateFileMapping
for these ideas. Possibly would require https://github.com/Microsoft/go-winio for named pipes.
I don't think @mholt or I have the time or want to tackle this (Matt doesn't run Windows; I do, but I don't really want to spend the time diving into this concept, doesn't benefit me to do so), so it would be best if someone else tries to implement this.
The relevant code for this is in https://github.com/caddyserver/caddy/blob/03b5debd958a324d5c00cc37f887130b0198e747/listeners.go. You can see that we currently only support TCP and unix sockets for network addresses. More network types could probably be added in here.
I don't have time to dig into it but if anyone does it might be worth investigating if the unix sockets can work on windows, supposedly back in 2017 they anonunced Build 17063 brings native support for the unix socket to Windows.
It would be nice if it ended up not being a large change.
@randomchance I did try to play around with that idea last year, which led to me try doing it with curl in https://github.com/curl/curl/issues/5162. I couldn't really get it to work, but I was pretty out of my depth on it. Someone else may take the baton and try again to see if they can get further.
In https://github.com/caddyserver/caddy/pull/5114, @ueffel confirmed that unix sockets do indeed work with Caddy on Windows, so I don't think there's anything to do here. Closing!