Versions in this module Expand all Collapse all v0 v0.0.2 Jul 4, 2023 v0.0.1 Dec 1, 2021 v0.0.0 Dec 1, 2021retracted Changes in this version + var ErrClosingListener = errors.New("error closing listener") + var ErrClosingListeners = errors.New("error closing listeners") + var ErrIO = errors.New("IO error") + var ErrMalformedURI = errors.New("malformed URI") + var ErrMaxRequestLengthExceeded = fmt.Errorf("the request length exceeded the max size of %d bytes", maxRequestLength) + var ErrOpeningConnection = errors.New("error opening connection") + var ErrRequestRead = errors.New("unable to read request") + var ErrServerShutdown = errors.New("server shutdown") + var ErrServing = errors.New("unable to serve requests") + var ErrStartingServer = errors.New("unable to start server") + type Handler interface + ServeGemini func(context.Context, ResponseWriter, *Request) + type HandlerFunc func(context.Context, ResponseWriter, *Request) + func (f HandlerFunc) ServeGemini(ctx context.Context, w ResponseWriter, r *Request) + type Request struct + RemoteAddr string + Subject *pkix.Name + URI *URI + func ReadRequest(b *bufio.Reader) (*Request, error) + type ResponseWriter interface + Failure func(ctx context.Context, code StatusCode, msg string) + Input func(ctx context.Context, prompt string, isSensitive bool) + Redirect func(ctx context.Context, redirectURL string, isPermanant bool) + Success func(ctx context.Context, mimeType string) io.Writer + type ServeMux struct + func NewServeMux() *ServeMux + func (sm *ServeMux) Handle(pattern string, handler Handler) + func (sm *ServeMux) HandleFunc(pattern string, handler func(context.Context, ResponseWriter, *Request)) + func (sm *ServeMux) Handler(r *Request) (h Handler, pattern string) + func (sm *ServeMux) ServeGemini(ctx context.Context, w ResponseWriter, r *Request) + type Server struct + BaseContext func(net.Listener) context.Context + ConnContext func(ctx context.Context, c net.Conn) context.Context + Handler Handler + LogHandler func(message string, isError bool) + TLSConfig *tls.Config + func ServerFromCtx(ctx context.Context) (*Server, bool) + func (s *Server) ListenAndServeTLS(addr, certFile, keyFile string) error + func (s *Server) RegisterOnShutdown(f func()) + func (s *Server) Serve(l net.Listener) error + func (s *Server) ServeTLS(l net.Listener, certFile, keyFile string) error + func (s *Server) Shutdown(ctx context.Context) error + type StatusCode uint8 + const StatusBadRequest + const StatusCGIError + const StatusCertificateNotAuthorised + const StatusCertificateNotValid + const StatusClientCertificateRequired + const StatusGone + const StatusInput + const StatusNotFound + const StatusPermanentFailure + const StatusPermanentRedirect + const StatusProxyError + const StatusProxyRequestRefused + const StatusSensitiveInput + const StatusServerFailure + const StatusSlowDown + const StatusSuccess + const StatusTemporaryFailure + const StatusTemporaryRedirect + func (c StatusCode) Description() string + func (c StatusCode) MarshalText() ([]byte, error) + func (c StatusCode) ToCategory() StatusCodeCategory + func (i StatusCode) String() string + type StatusCodeCategory uint8 + const StatusCategoryClientCertificateRequired + const StatusCategoryInput + const StatusCategoryPermanentFailure + const StatusCategoryRedirect + const StatusCategorySuccess + const StatusCategoryTemporaryFailure + const StatusCategoryUndefined + const StatusCategoryUndefinedX + const StatusCategoryUndefinedXX + const StatusCategoryUndefinedXXX + func (c StatusCodeCategory) ToCode() StatusCode + func (i StatusCodeCategory) String() string + type URI struct + Fragment string + Host string + Path string + Port string + Query string + RawQuery string + func ParseRequestURI(rawURI string) (*URI, error) + func (u *URI) String() string