socket

package
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const BaseURL = "http://blitz"

BaseURL is the URL clients use over the socket (the host is ignored).

View Source
const ClientHeader = "Blitz-Client"

ClientHeader names the front end a request to the service comes from (spec_054_active_installs AI-02).

Variables

View Source
var ErrRunning = errors.New("a Blitz service is already running")

ErrRunning reports a service already answering on the socket.

View Source
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

func Client(path string) *http.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

func Listen(path string) (net.Listener, error)

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').

func Running

func Running(path string) bool

Running reports whether a service answers on the socket.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL