diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-01-30 11:34:13 -0700 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-01-30 11:36:48 -0700 |
commit | 4f6f3dcd4b8c71f5caa52864092dbde22665a645 (patch) | |
tree | 19ae4d9203774173b83c25a91d7787d88bd3aa6a /finger/response.go | |
parent | 9cbc5cdd467ccd8e68f0f5d1d971ab76c2946624 (diff) |
finger protocol
Diffstat (limited to 'finger/response.go')
-rw-r--r-- | finger/response.go | 22 |
1 files changed, 22 insertions, 0 deletions
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} +} |