Documentation
¶
Overview ¶
Package socket is where the per-user Blitz service listens and how clients reach it: a Unix socket that only its user can open. The service runs shell commands, so it is never on a network port by default.
Index ¶
Constants ¶
const BaseURL = "http://blitz"
BaseURL is the URL clients use over the socket (the host is ignored).
const ClientHeader = "Blitz-Client"
ClientHeader names the front end a request to the service comes from (spec_054_active_installs AI-02).
Variables ¶
var ErrRunning = errors.New("a Blitz service is already running")
ErrRunning reports a service already answering on the socket.
var Front string
Front is the front end this program is (activity.CLI, activity.Desktop), set once in its main: each request Client makes carries it as ClientHeader, unless the request names another (a page's, proxied).
Functions ¶
func Client ¶
Client returns an HTTP client that reaches the service on the socket; use it with BaseURL.
func DefaultSocket ¶
func DefaultSocket() string
DefaultSocket is where the per-user service listens: $BLITZ_SOCKET, or ~/.blitz/run/blitz.sock.
func Listen ¶
Listen opens the Unix socket at path for this user only. It refuses when a service already answers there, and replaces a socket left by one that died, never another kind of file. It makes the folder private (0700) when it creates it, and always ~/.blitz/run; a folder of the user's own, such as their home for $BLITZ_SOCKET=~/blitz.sock, keeps its mode.
The 0600 mode (and the folder's 0700) is the only gate: there is no peer check, so anything running as the user may connect. The model's commands run as the user too; the OS sandbox keeps sandboxed processes away from the socket (tools.GuardSocket, spec_007 SH-23a).
On Windows, permission bits mean nothing (Chmod only sets read-only); there the socket is as private as the folder it's in, whose access control list the user's profile gives it: ~/.blitz/run is only the user's (and the system's, and administrators').
Types ¶
This section is empty.