debug

package
v1.74.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

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