Documentation ¶
Index ¶
- Variables
- func NotFound(resp ResponseWriter, req *url.URL)
- func ProxyTo(resp ResponseWriter, req *url.URL, ...)
- func RunExternal(resp ResponseWriter, req *url.URL, command, contentType string)
- func TemporaryFailure(resp ResponseWriter, req *url.URL, message string)
- func TemporaryRedirect(resp ResponseWriter, req *url.URL, destination string)
- type Client
- type Handler
- func FileHandler(root string) Handler
- func NotFoundHandler() Handler
- func ProxyToHandler(upstream, upstreamIdentity, stripPattern string) Handler
- func RunExternalHandler(command, contentType string) Handler
- func TemporaryFailureHandler(message string) Handler
- func TemporaryRedirectHandler(destination string) Handler
- type HandlerFunc
- type KnownHosts
- func (k *KnownHosts) IsKnownAs(hostname string, certificate *x509.Certificate) bool
- func (k *KnownHosts) IsKown(hostname string) bool
- func (k *KnownHosts) Load(filePath string) error
- func (k *KnownHosts) ReadFrom(reader io.Reader) (int64, error)
- func (k *KnownHosts) Remember(hostname string, certificate *x509.Certificate)
- func (k *KnownHosts) Save(filePath string) error
- func (k *KnownHosts) WriteTo(writer io.Writer) (int64, error)
- type Response
- type ResponseWriter
- type ServeMux
- type Server
- type VhostMux
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUntrustedHost = errors.New("The host is not trusted (yet). Add it to the known hosts if it is to be trusted") ErrInvalidHostCertificate = errors.New("The received host certificate does not match the known one") ErrInvalidResponseStatusCode = errors.New("Could not parse the response status code") ErrResponseStatusTooBig = errors.New("Response status/meta line exceeded its maximum size") ErrResponseStatusTooSmall = errors.New("Response status/meta line is too small") ErrUnsupportedScheme = errors.New("only the gemini:// scheme is supported") SchemeGemini = "gemini" )
View Source
var ( StatusInput = 10 StatusSuccess = 20 StatusSuccessEndClientSession = 21 StatusRedirectTemporary = 30 StatusRedirectPermanent = 31 StatusTemporaryFailure = 40 StatusCgiError = 42 StatusProxyError = 43 StatusSlowDow = 44 StatusPermanentFailure = 50 StatusNotFound = 51 StatusGone = 52 StatusProxyRequestRefused = 53 StatusBadRequest = 59 StatusClientCertificateRequired = 60 StatusTransientCertificateRequired = 61 StatusAuthorisedCertificateRequired = 62 StatusCertificateNotAccepted = 63 StatusFutureCertificateRejected = 64 StatusExpiredCertificateRejected = 65 )
View Source
var (
ErrServerClosed = errors.New("Server closed")
)
Functions ¶
func NotFound ¶
func NotFound(resp ResponseWriter, req *url.URL)
NotFound replies to the request with a “NOT FOUND“ reply
func ProxyTo ¶
func ProxyTo(resp ResponseWriter, req *url.URL, upstream, upstreamIdentity, stripPattern string)
func RunExternal ¶
func RunExternal(resp ResponseWriter, req *url.URL, command, contentType string)
func TemporaryFailure ¶
func TemporaryFailure(resp ResponseWriter, req *url.URL, message string)
TemporaryFailure replies to the request with a “TEMPORARY FAILURE“ reply message will be used as the response meta value
func TemporaryRedirect ¶
func TemporaryRedirect(resp ResponseWriter, req *url.URL, destination string)
TemporaryRedirect replies to the request with a “TEMPORARY REDIRECT“ reply destination will be used as the reponse meta value
Types ¶
type Client ¶
type Client struct { Certificate *tls.Certificate Key crypto.PrivateKey FollowRedirects bool }
type Handler ¶
type Handler interface {
ServeGemini(resp ResponseWriter, req *url.URL)
}
func FileHandler ¶
func NotFoundHandler ¶
func NotFoundHandler() Handler
NotFoundHandler creates a simple handler that replies to each request with a “NOT FOUND“ reply.
func ProxyToHandler ¶
func RunExternalHandler ¶
func TemporaryFailureHandler ¶
TemporaryFailureHandler creates a simple handler that replies to earch request with a “TEMPORARY FAILURE“ reply. message will be used as the response meta value
type HandlerFunc ¶
type HandlerFunc func(resp ResponseWriter, req *url.URL)
func (HandlerFunc) ServeGemini ¶
func (hf HandlerFunc) ServeGemini(resp ResponseWriter, req *url.URL)
type KnownHosts ¶
func NewKnownHosts ¶
func NewKnownHosts() *KnownHosts
func (*KnownHosts) IsKnownAs ¶
func (k *KnownHosts) IsKnownAs(hostname string, certificate *x509.Certificate) bool
func (*KnownHosts) IsKown ¶
func (k *KnownHosts) IsKown(hostname string) bool
func (*KnownHosts) Load ¶
func (k *KnownHosts) Load(filePath string) error
func (*KnownHosts) Remember ¶
func (k *KnownHosts) Remember(hostname string, certificate *x509.Certificate)
func (*KnownHosts) Save ¶
func (k *KnownHosts) Save(filePath string) error
type Response ¶
type ResponseWriter ¶
type ServeMux ¶
type ServeMux struct {
// contains filtered or unexported fields
}
func NewServeMux ¶
func NewServeMux() *ServeMux
func (*ServeMux) ServeGemini ¶
func (mux *ServeMux) ServeGemini(resp ResponseWriter, req *url.URL)
type VhostMux ¶
func NewVhostMux ¶
func NewVhostMux() *VhostMux
func (*VhostMux) ServeGemini ¶
func (mux *VhostMux) ServeGemini(resp ResponseWriter, req *url.URL)
Click to show internal directories.
Click to hide internal directories.