Documentation
¶
Overview ¶
Package ipc is a helper for passing Cobra commands across a Unix domain socket (UDS).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶ added in v0.4.9
type Client struct { Foreground bool RespCB func(string) bool // contains filtered or unexported fields }
Client is the type used when communicating with an IPCServer.
type ConnWriter ¶
type ConnWriter struct {
// contains filtered or unexported fields
}
ConnWriter is an io.Writer that will relay any bytes written to it into the associated connection.
func (*ConnWriter) Write ¶
func (cw *ConnWriter) Write(p []byte) (int, error)
Write will write bytes to the connection.
func (*ConnWriter) Writeln ¶
func (cw *ConnWriter) Writeln(format string, args ...any)
Writeln will write a formatted message to the connection.
type IPCServer ¶
type IPCServer struct {
// contains filtered or unexported fields
}
IPCServer is the type to set up and listen for clients that want to relay commands for the server to execute.
func (*IPCServer) Start ¶
func (ipc *IPCServer) Start(ctx context.Context, log *zerolog.Logger, path string, cmd *cobra.Command) error
Start will set up and listen on a Unix domain socket (UDS) located at the provided path until the context provided is canceled. Any clients that attach may issue string commands which will be parsed and processed by the provided Cobra command.