summaryrefslogtreecommitdiff
path: root/gemini/serve.go
diff options
context:
space:
mode:
Diffstat (limited to 'gemini/serve.go')
-rw-r--r--gemini/serve.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/gemini/serve.go b/gemini/serve.go
index 9173212..6fee458 100644
--- a/gemini/serve.go
+++ b/gemini/serve.go
@@ -11,7 +11,7 @@ import (
"strconv"
"strings"
- sr "tildegit.org/tjp/sliderule"
+ "tildegit.org/tjp/sliderule/internal/types"
"tildegit.org/tjp/sliderule/internal"
"tildegit.org/tjp/sliderule/logging"
)
@@ -19,7 +19,7 @@ import (
type server struct {
internal.Server
- handler sr.Handler
+ handler types.Handler
}
func (s server) Protocol() string { return "GEMINI" }
@@ -30,10 +30,10 @@ func NewServer(
hostname string,
network string,
address string,
- handler sr.Handler,
+ handler types.Handler,
errorLog logging.Logger,
tlsConfig *tls.Config,
-) (sr.Server, error) {
+) (types.Server, error) {
s := &server{handler: handler}
hostname = internal.JoinDefaultPort(hostname, "1965")
@@ -53,7 +53,7 @@ func NewServer(
func (s *server) handleConn(conn net.Conn) {
buf := bufio.NewReader(conn)
- var response *sr.Response
+ var response *types.Response
request, err := ParseRequest(buf)
if err != nil {
response = BadRequest(err.Error())
@@ -112,9 +112,9 @@ func sizeParam(path string) (int, error) {
// Optionally, it will also allow through titan:// requests.
//
// Filtered requests will be turned away with a 53 response "proxy request refused".
-func GeminiOnly(allowTitan bool) sr.Middleware {
- return func(inner sr.Handler) sr.Handler {
- return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response {
+func GeminiOnly(allowTitan bool) types.Middleware {
+ return func(inner types.Handler) types.Handler {
+ return types.HandlerFunc(func(ctx context.Context, request *types.Request) *types.Response {
if request.Scheme == "gemini" || (allowTitan && request.Scheme == "titan") {
return inner.Handle(ctx, request)
}