sozu-proxy / sozu

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome!
https://www.sozu.io/
GNU Affero General Public License v3.0
3.11k stars 192 forks source link

Support backends listening on UNIX domain sockets #152

Open KellerFuchs opened 7 years ago

KellerFuchs commented 7 years ago

UNIX sockets are pretty commonly used for backend services which run on the same server, especially when security is a concern, as they make it easy not to give the backend network access and control which services/users may connect to the backend.

As for #151, I would happily contribute the code for this, assuming it is OK and assuming I manage to find my way around the codebase. :)

Geal commented 7 years ago

this is doable, but requires changes in a lot of parts of the system.

Backend instances are defined here: https://github.com/sozu-proxy/sozu/blob/master/lib/src/messages.rs#L42 This would probably become an enum and require changes in the other crates as well, to support the new option in configuration.

The part of the code handling connection to the backend is here: https://github.com/sozu-proxy/sozu/blob/d7b2dbe39143cfcc32d9b64b7e59631262dcb013/lib/src/network/mod.rs#L186-L252 You can use mio-uds to add Unix socket support.

To sum up, it's doable, but you'll spend a lot more time on updating the configuration code than on actual network code. I'll ask that you wait a bit for me to finish #144, since I'm changing a lot of parts of the configuration handling code.

KellerFuchs commented 7 years ago

Sure, thanks.

hongquan commented 4 years ago

Please also support Linux abstract namespace socket (which is like Unix domain socket but doesn't create a file in filesystem).