control

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package control implements a tiny request/response protocol over a Unix socket so `yomiro gw status/pause/resume/reload` can talk to a running daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Action string         `json:"action"` // "status", "pause", "resume", "reload"
	Args   map[string]any `json:"args,omitempty"`
}

Request is a single command from the CLI.

type Response

type Response struct {
	OK     bool           `json:"ok"`
	Detail string         `json:"detail,omitempty"`
	Data   map[string]any `json:"data,omitempty"`
}

Response is the daemon's reply.

func Send

func Send(ctx context.Context, path string, req Request) (*Response, error)

Send connects to the socket, sends one Request, reads one Response.

type Server

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

Server holds a listening socket.

func Listen

func Listen(path string, handler func(Request) Response) (*Server, error)

Listen starts a Unix-socket listener and dispatches Requests to handler.

func (*Server) Close

func (s *Server) Close() error

Close closes the listener and removes the socket file.

Jump to

Keyboard shortcuts

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