gmitools

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MPL-2.0 Imports: 0 Imported by: 1

README

gmitools

Go gemini tools provides tools for the gemini protocol.

This project is currently under development. I welcome suggestions, criticisms, and patches.

Module structure

There are several tools that is provided with this module.

gmitools

Constants for the module

  • Method type
  • StatusCode type
gmitools/server

Basics for a gemini server. Create a GeminiServer with NewGeminiServer() and supply a Handler to process requests. Start the server with ListenAndServe("")

  • GeminiServer struct
  • Handler interface
  • Request struct
  • ResponseWriter interface
  • Header type
gmitools/client

Basics for a gemini client. Create a request with NewReq or craft it by hand. Requests support both gemini and titan as well as client certificates.

  • Request struct
  • Response struct
gmitools/router

Routing handler for gemini servers. Create a new router with NewRouter(). Add routes with HandlePath() or HandlePrefix(). In your handler for paths, you can capture variables with the Vars() command. You can also create your own custom matchers if the included path or prefix matchers don't work for you.

  • Route struct
  • Matcher interface
  • Router struct
gmitools/forms

Create forms that are handled entirely by a single route. Context comes from client certificates, but you have to provide the storage method. Two included form types are sequence and smorgas.

Sequence forms is designed for a sequence of inputs. e.g. username, password. Create a new sequence form with NewSequenceForm()

Smorgas forms is designed for use with a form page with links to each form element. Going to the link will prompt the user for the corresponding input. Create a new smorgas form with NewSmorgasForm()

  • FormData type
  • FieldHandler type
  • Form struct
  • SequenceField struct
  • SmorgasField struct

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Method

type Method string
const (
	MethodGemini Method = "gemini"
	MethodTitan  Method = "titan"
)

type StatusCode

type StatusCode int
const (
	StatusInput            StatusCode = 10
	StatusSensitiveInput   StatusCode = 11
	StatusSuccess          StatusCode = 20
	StatusRedirect         StatusCode = 30
	StatusRedirectPerm     StatusCode = 31
	StatusTempFail         StatusCode = 40
	StatusUnavailable      StatusCode = 41
	StatusCGIError         StatusCode = 42
	StatusProxyError       StatusCode = 43
	StatusSlowDown         StatusCode = 44
	StatusPermFail         StatusCode = 50
	StatusNotFound         StatusCode = 51
	StatusGone             StatusCode = 52
	StatusProxyRefused     StatusCode = 53
	StatusBadRequest       StatusCode = 59
	StatusCertRequired     StatusCode = 60
	StatusCertUnauthorized StatusCode = 61
	StatusCertNotValid     StatusCode = 62
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL