X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/d28e3b2858db322899a81b59a30400c1acad2b42..c781f79f3c8cb9a7577ee1574d196988da2719b3:/socket.go?ds=sidebyside diff --git a/socket.go b/socket.go index 0dffeb0..f87bec7 100644 --- a/socket.go +++ b/socket.go @@ -20,15 +20,6 @@ const ( terminalSource = "terminal" ) -// checkSocketPath makes sure that path fits in the address of a Unix socket. -func checkSocketPath(path string) error { - if len(path) > socketPathBytes { - return fmt.Errorf("socket path %s is longer than %d bytes: set ONECHAT_DIR to a shorter path", path, socketPathBytes) - } - - return nil -} - // SocketRequest is one line from a client: "send" with the text of a user // message, "interrupt", "stop" with the name of a subagent in Text, or // "whatsapp" with the text after /whatsapp of a WhatsApp command, or "backup" @@ -40,3 +31,12 @@ type SocketRequest struct { Text string `json:"text,omitempty"` Path string `json:"path,omitempty"` } + +// checkSocketPath makes sure that path fits in the address of a Unix socket. +func checkSocketPath(path string) error { + if len(path) > socketPathBytes { + return fmt.Errorf("socket path %s is longer than %d bytes: set ONECHAT_DIR to a shorter path", path, socketPathBytes) + } + + return nil +}