Skip to content

Conversation

@AWildLeon
Copy link

@AWildLeon AWildLeon commented Aug 28, 2025

This pull request adds support for running the server on a Unix socket in addition to the existing TCP host:port option. The configuration, startup logic, and documentation have been updated to support this new mode while keeping validation strict to ensure only one listening method is used.


Server listening mode enhancements

  • Added support for listening on a Unix socket via the new socket-path configuration property in config.go, with validation to ensure that only one of socket-path or host:port is specified. [1] [2]
  • Modified server startup logic in glance.go to handle Unix socket creation and cleanup, and to select between TCP and Unix socket based on configuration. [1] [2]

Documentation updates

  • Updated docs/configuration.md to document the new socket-path option.
  • Added configuration examples for both TCP and Unix socket modes, and clarified that only one mode may be enabled at a time. [1] [2]

Why Unix sockets?

The main motivation for this feature is to simplify reverse proxy setups. For example, a proxy (such as Caddy or Nginx) can be configured to talk directly to the server over a Unix domain socket instead of a TCP port. This avoids the need to open or manage additional firewall rules, which is especially convenient in NixOS environments or when running in containers.

More generally, Unix sockets provide:

  • No TCP port required → reduced attack surface and simpler firewalling.
  • Lower overhead for local communication (no IP stack traversal).
  • File system–based access control via standard Unix permissions.
  • A good fit for sandboxed/containerized deployments where networking may be restricted.

@AWildLeon AWildLeon changed the title Add: Unix Sockets feat: Unix Sockets Aug 28, 2025
@AWildLeon AWildLeon changed the title feat: Unix Sockets feat: Listen on Unix Socket Aug 28, 2025
@AWildLeon AWildLeon marked this pull request as draft August 29, 2025 13:48
@AWildLeon
Copy link
Author

Any Feedback welcome 😄

@AWildLeon AWildLeon marked this pull request as ready for review September 3, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant