💾 Archived View for source.community › ckaznocha › gemini › raw › main › handler.go captured on 2024-05-10 at 11:18:56.

View Raw

More Information

⬅️ Previous capture (2021-12-17)

-=-=-=-=-=-=-

package gemini

import (
	"context"
)

// Handler is an interface that handles Gemini incoming requests.
type Handler interface {
	ServeGemini(context.Context, ResponseWriter, *Request)
}

// HandlerFunc is an adapter which allows a function to be used as a Handler.
type HandlerFunc func(context.Context, ResponseWriter, *Request)

// ServeGemini implements the Hander interface for a HandlerFunc.
func (f HandlerFunc) ServeGemini(ctx context.Context, w ResponseWriter, r *Request) {
	f(ctx, w, r)
}