From 9a2da81b11ad0064cca24ce7974827d032309369 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 1 May 2023 07:56:25 -0600 Subject: name change gus -> sliderule --- finger/request.go | 12 ++++++------ finger/request_test.go | 2 +- finger/response.go | 10 +++++----- finger/serve.go | 12 ++++++------ finger/system.go | 6 +++--- 5 files changed, 21 insertions(+), 21 deletions(-) (limited to 'finger') diff --git a/finger/request.go b/finger/request.go index 833072d..bd2d35a 100644 --- a/finger/request.go +++ b/finger/request.go @@ -7,7 +7,7 @@ import ( "net/url" "strings" - "tildegit.org/tjp/gus" + sr "tildegit.org/tjp/sliderule" ) // ForwardingDenied is returned in response to requests for forwarding service. @@ -16,7 +16,7 @@ var ForwardingDenied = errors.New("Finger forwarding service denied.") // InvalidFingerQuery is sent when a client doesn't properly format the query. var InvalidFingerQuery = errors.New("Invalid finger query .") -// ParseRequest builds a gus.Request by reading a finger protocol request. +// ParseRequest builds a sliderule.Request by reading a finger protocol request. // // At the time of writing, there is no firm standard on how to represent finger // queries as URLs (the finger protocol itself predates URLs entirely), but there @@ -26,11 +26,11 @@ var InvalidFingerQuery = errors.New("Invalid finger query .") // - There is an IETF draft: // https://datatracker.ietf.org/doc/html/draft-ietf-uri-url-finger // -// As this function builds a *gus.Request (which is mostly a wrapper around a URL) +// As this function builds a *sliderule.Request (which is mostly a wrapper around a URL) // from nothing but an io.Reader, it doesn't have the context of the hostname which // the receiving server was hosting. So it only has the host component if it // arrived in the body of the query in the form username@hostname. Bear in mind that -// in gus handlers, request objects will also carry a reference to the server so +// in sliderule handlers, request objects will also carry a reference to the server so // that hostname is always available as request.Server.Hostname(). // // The primary deviation from the IETF draft is that a query-specified host becomes @@ -47,7 +47,7 @@ var InvalidFingerQuery = errors.New("Invalid finger query .") // In accordance with the recommendation of RFC 1288 section 3.2.1 // (https://datatracker.ietf.org/doc/html/rfc1288#section-3.2.1), any queries which // include a jump-host (user@host1@host2) are rejected with the ForwardingDenied error. -func ParseRequest(rdr io.Reader) (*gus.Request, error) { +func ParseRequest(rdr io.Reader) (*sr.Request, error) { line, err := bufio.NewReader(rdr).ReadString('\n') if err != nil { return nil, err @@ -66,7 +66,7 @@ func ParseRequest(rdr io.Reader) (*gus.Request, error) { return nil, ForwardingDenied } - return &gus.Request{URL: &url.URL{ + return &sr.Request{URL: &url.URL{ Scheme: "finger", Host: hostname, Path: "/" + username, diff --git a/finger/request_test.go b/finger/request_test.go index 4b7fcbd..87fbc8c 100644 --- a/finger/request_test.go +++ b/finger/request_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "tildegit.org/tjp/gus/finger" + "tildegit.org/tjp/sliderule/finger" ) func TestParseRequest(t *testing.T) { diff --git a/finger/response.go b/finger/response.go index 07ca9a1..8612f45 100644 --- a/finger/response.go +++ b/finger/response.go @@ -5,18 +5,18 @@ import ( "io" "strings" - "tildegit.org/tjp/gus" + sr "tildegit.org/tjp/sliderule" ) // Error produces a finger Response containing the error message and Status 1. -func Error(msg string) *gus.Response { +func Error(msg string) *sr.Response { if !strings.HasSuffix(msg, "\r\n") { msg += "\r\n" } - return &gus.Response{Body: bytes.NewBufferString(msg), Status: 1} + return &sr.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} +func Success(body io.Reader) *sr.Response { + return &sr.Response{Body: body} } diff --git a/finger/serve.go b/finger/serve.go index 68b0fa5..5675dcf 100644 --- a/finger/serve.go +++ b/finger/serve.go @@ -7,14 +7,14 @@ import ( "net" "strings" - "tildegit.org/tjp/gus" - "tildegit.org/tjp/gus/internal" - "tildegit.org/tjp/gus/logging" + sr "tildegit.org/tjp/sliderule" + "tildegit.org/tjp/sliderule/internal" + "tildegit.org/tjp/sliderule/logging" ) type fingerServer struct { internal.Server - handler gus.Handler + handler sr.Handler } func (fs fingerServer) Protocol() string { return "FINGER" } @@ -25,9 +25,9 @@ func NewServer( hostname string, network string, address string, - handler gus.Handler, + handler sr.Handler, errLog logging.Logger, -) (gus.Server, error) { +) (sr.Server, error) { fs := &fingerServer{handler: handler} if strings.IndexByte(hostname, ':') < 0 { diff --git a/finger/system.go b/finger/system.go index 4bcf573..aa2cc84 100644 --- a/finger/system.go +++ b/finger/system.go @@ -6,15 +6,15 @@ import ( "errors" "os/exec" - "tildegit.org/tjp/gus" + sr "tildegit.org/tjp/sliderule" ) // ListingDenied is returned to reject online user listing requests. var ListingDenied = errors.New("Finger online user list denied.") // SystemFinger handles finger requests by invoking the finger(1) command-line utility. -func SystemFinger(allowListings bool) gus.Handler { - return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { +func SystemFinger(allowListings bool) sr.Handler { + return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response { fingerPath, err := exec.LookPath("finger") if err != nil { _ = request.Server.LogError( -- cgit v1.2.3