From 4f6f3dcd4b8c71f5caa52864092dbde22665a645 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 30 Jan 2023 11:34:13 -0700 Subject: finger protocol --- finger/response.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 finger/response.go (limited to 'finger/response.go') diff --git a/finger/response.go b/finger/response.go new file mode 100644 index 0000000..07ca9a1 --- /dev/null +++ b/finger/response.go @@ -0,0 +1,22 @@ +package finger + +import ( + "bytes" + "io" + "strings" + + "tildegit.org/tjp/gus" +) + +// Error produces a finger Response containing the error message and Status 1. +func Error(msg string) *gus.Response { + if !strings.HasSuffix(msg, "\r\n") { + msg += "\r\n" + } + return &gus.Response{Body: bytes.NewBufferString(msg), Status: 1} +} + +// Success produces a finger response with a Status of 0. +func Success(body io.Reader) *gus.Response { + return &gus.Response{Body: body} +} -- cgit v1.2.3