unixhttp

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package unixhttp runs private HTTP surfaces — listeners that carry server-side rendering traffic and are never reachable from outside the host.

Production uses a Unix domain socket, which is private by construction: it has no port and no interface. Development uses a loopback port instead, because `nuxt dev` runs under Node, whose fetch has no way to dial a socket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is an HTTP server on one private listener.

func Listen

func Listen(socket string, handler http.Handler) (*Server, error)

Listen binds socket and starts serving handler. An existing socket is treated as stale and replaced; an ordinary file is never removed.

func ListenLoopback added in v0.1.1

func ListenLoopback(address string, handler http.Handler) (*Server, error)

ListenLoopback binds a loopback TCP address and starts serving handler.

This is the development counterpart to Listen. It refuses any address that is not loopback: this listener carries the same authenticated surface as the public one but without the edge in front of it, so binding it to a routable interface would publish an unguarded copy of the whole site.

func (*Server) Addr added in v0.1.1

func (s *Server) Addr() string

Addr returns the address the server is reachable at: a socket path, or a resolved host:port.

func (*Server) Close

func (s *Server) Close() error

Close gracefully drains the server and removes its socket.

func (*Server) Done

func (s *Server) Done() <-chan struct{}

Done closes if the private HTTP server stops.

func (*Server) Err

func (s *Server) Err() error

Err reports why the server stopped. It is intended to be read after Done.

func (*Server) Socket

func (s *Server) Socket() string

Socket returns the absolute socket path, or the empty string for a loopback listener.

Jump to

Keyboard shortcuts

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