💾 Archived View for source.community › ckaznocha › gemini › raw › main › handler.go captured on 2021-12-17 at 13:26:06.

View Raw

More Information

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

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)
}