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 ¶
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 ¶
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