debug

package
v1.74.12 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 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 debug provides a Unix socket-based HTTP server for runtime debugging and inspection. The server exposes internal state and allows runtime operations via HTTP endpoints over a local 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 provides a Unix socket HTTP server for debugging endpoints. Use Register() to add custom debug endpoints that can be accessed via curl --unix-socket.

func NewServer

func NewServer(logger *log.Logger) *Server

NewServer creates a new debug server with panic recovery middleware. The server won't start listening until Start() is called.

func (*Server) Register

func (s *Server) Register(method string, url string, handler func(http.ResponseWriter, *http.Request))

Register adds a debug endpoint handler for the specified HTTP method and URL path. Currently, supports GET and POST methods. Other methods are silently ignored.

Example: server.Register(http.MethodGet, "/status", statusHandler)

func (*Server) Start

func (s *Server) Start(socketPath string) error

Start creates and binds to a Unix socket, then starts the HTTP server in a goroutine. If the socket file already exists, it will be removed and recreated.

Example access: curl --unix-socket /path/to/socket http://localhost/endpoint

Jump to

Keyboard shortcuts

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