Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCommand ¶
RegisterCommand registers an implementation of the Command interface under a command name
Types ¶
type Command ¶
type Command interface {
// ShotUsage provides a short description of command argument syntax and possibly a comment.
// to be printed a listing of commands.
ShortUsage() (syntax string, comment string)
// Usage let the command provide it's own full documentation, being passed the command name
// the command is registered under.
Usage(cmd string, out io.Writer)
// Invoke invokes the command being passed a context an io.Writer to the socket
// the command name used to invoke it and it's arguments.
// Invoke has the option of returning function to be invoked
// asynchronously and - optionally command line to potentially make it persistent.
// The persistent command will be re-executed
// after a reload - whether or not that is in a new process
Invoke(ctx context.Context, conn io.Writer, cmd string, args []string) (async func(), persistent string, err error)
}
Command is the interface of a specific command
type Server ¶
type Server struct {
// Path on which the server will listen.
Addr string
// Systemd socket name. If no Addr is given the socket can be provided
// via systemd socket activation.
ListenerFdName string
// The command invoking the help system
HelpCommand string
// The command to cause the server to close a connection.
QuitCommand string
// The command to cause the server to close a connection after replying
OneshotCommand string
// A logger to log errors during client connections to.
Logger srv.LoggerFunc
// contains filtered or unexported fields
}
Server implements a server accepting connections on a UNIX domain socket on which registered commands can be invoked. The client connections to this socket will survive process Reload and Replacement.
func (*Server) Description ¶
Description implement gone/daemon/srv.Descripter interface.
func (*Server) Listen ¶
Listen implement the gone/daemon/srv.Listener interface and pick an already open listener FD or create one.
Click to show internal directories.
Click to hide internal directories.